-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhome1.php
56 lines (44 loc) · 1.12 KB
/
home1.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
54
55
56
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<?php
include_once('dbclass.php');
$db= new db;
session_start();
if (isset($_SESSION['uid'])) {
echo "<center>";
echo "<h2>Home Page</h2><br/><br/><br/>";
echo "<a href='about.php'>View User Details</a><br/><br/>";
echo "<a href='order.php'>My Order</a><br/><br/>";
echo "<form method='post'><input type='submit' value='Logout' name='logout'></form>";
echo "</center>";
if(isset($_POST['logout'])){
$db->logOut();
}
}
else if(isset($_POST["uname"]) & isset($_POST["pwd"])){
$res=$db->getUser($_POST["uname"],$_POST["pwd"]);
$count=mysqli_num_rows($res);
if($count>0){
$row=mysqli_fetch_array($res,MYSQLI_ASSOC);
$_SESSION['uid']=$row['user_id'];
//echo "<script>location.href='home.php'</script>";
header("location:home1.php");
exit;
}
else{
echo "<script>alert('username or password incorrect!')</script>";
echo "<script>location.href='index.php'</script>";
}
}
else{
//echo "<script>location.href='index.php'</script>";
header("location:index.php");
exit;
}
?>
</body>
</html>