-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlogout.php
53 lines (51 loc) · 1.46 KB
/
logout.php
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
43
44
45
46
47
48
49
50
51
52
53
<html>
<head>
<link rel="stylesheet" href="css/main.css">
</head>
<body>
<?php
session_start();
include 'setup.php';
if($_SERVER["REQUEST_METHOD"]=="POST")
{
$_SESSION["username"]=$_POST["username"];
$_SESSION["password"]=$_POST["password"];
}
$user=$_SESSION["username"];
$pass=$_SESSION["password"];
$sql="SELECT * FROM login
WHERE username=BINARY '$user' AND password=BINARY '$pass'";
$sql2="SELECT * FROM login
WHERE username= BINARY '$user'";
$result=$conn->query($sql);
$result2=$conn->query($sql2);
if($result->num_rows>0)
{
$sql1="SELECT * FROM BINARY $user";
$result1=$conn->query($sql1);
?>
<div class="log">
<a href="index.php" title='home page' class="common">Home</a>
<a href="index.php" class="common">LOGOUT</a>
<?php echo "<span class='Welcome' >Welcome $user</span>";?>
</div>
<div class="log1">
<a href="addlink.php" class="common">Add Link</a>
<a href="viewLink.php" class="common">View Link</a>
</div>
<?php
}
else if($result2->num_rows>0)
{
echo "<script>alert('Incorrect password') </script>";
echo "<script>windows.location.href='/var/www/html/Link\ Saver/login.php'</script>";
echo "<a class='common' title='go back to login page' href='login.php'>BACK</a>";
}
else
{
include 'header.php';
echo "<h2 class='not'>you are not registered with us</h2>".$conn->error;
}
?>
</body>
</html>