-
Notifications
You must be signed in to change notification settings - Fork 0
/
home.php
55 lines (49 loc) · 1.46 KB
/
home.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Welcome Page</title>
<meta name="description" content="Welcome Page">
<meta name="author" content="Thuy Vo">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="css/home.css">
</head>
<body>
<div id="container">
<div class="heading">
<h1>Home Page</h1>
<ul id="login">
<?php
session_start();
function getAccount($conn,$email){
$sql="SELECT * FROM user_contact WHERE email='$email'";
$stmt = $conn->prepare($sql);
$stmt->execute();
$row = $stmt->fetch(PDO::FETCH_ASSOC);
return $row;
}
include('dbconnect.php');
$email=$_SESSION['username']['email'];
$thisAccount=getAccount($conn,$email); /* $thisAccount = bool(false) */
$firstName=$thisAccount['firstname'];
if (!isset($_SESSION['username']))
{
print '<li><a href="index.php">Register</a></li>';
print '<li><a href="login.php">Login</a></li>';
}else{
print '<li><a href="editprofile.php">Edit profile: '.$firstName.'</a></li>';
print '<li><a href="logout.php">Logout</a></li>';
}
?>
</ul>
</div>
<hr>
<div id="leftcol">
<?php
print '<h2>Welcome '.$firstName.'</h2>';
?>
<hr>
</div>
</div>
</body>
</html>