-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsignOut.php
More file actions
42 lines (42 loc) · 1008 Bytes
/
signOut.php
File metadata and controls
42 lines (42 loc) · 1008 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
session_start();
?>
<?php
if(empty($_SESSION["id"])){
header("Location: /Project/index.php");
}
echo $_SESSION["id"]." is setted at the time of login";
if (isset($_POST['signout'])) {
signout();
}
if (isset($_POST['updateEmail'])) {
updateEmail();
}
function signout() {
session_unset();
// destroy the session
session_destroy();
header("Location: /Project/index.php");
}
function updateEmail(){
include 'Mysql_connect.php';
$emailId=$_POST['emailid'];
$id=$_SESSION["id"];
$sql = "update user set email='".$emailId."' where id=".$id;
if($conn->query($sql)==true){
echo '<script language="javascript">';
echo 'alert("email id added")';
echo '</script>';
}
}
?>
<html>
<body>
<form action="signOut.php" method="POST">
Email :- <input type="email" name="emailid">
<input type="submit" value="Update Email" name="updateEmail">
<br>
<input type="submit" value="Sign out" name="signout" >
</form>
</body>
</html>