-
Notifications
You must be signed in to change notification settings - Fork 1
/
home.php
54 lines (44 loc) · 1.29 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
<?php
include 'config.php';
session_start();
$user_id = $_SESSION['user_id'];
if(!isset($user_id)){
header('location:login.php');
};
if(isset($_GET['logout'])){
unset($user_id);
session_destroy();
header('location:login.php');
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Home</title>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<div class="container">
<div class="profile">
<?php
$select = mysqli_query($conn, "SELECT * FROM `users` WHERE id = '$user_id'") or die('query failed');
if(mysqli_num_rows($select) > 0){
$fetch = mysqli_fetch_assoc($select);
}
if($fetch['image'] == ''){
echo '<img src="images/default-avatar.png">';
}else{
echo '<img src="uploaded_img/'.$fetch['image'].'">';
}
?>
<h3><?php echo $fetch['name']; ?></h3>
<a href="update_profile.php" class="btn">Update Profile</a>
<a href="home.php?logout=<?php echo $user_id; ?>" class="delete-btn">Logout</a>
<p>New <a href="login.php">Login</a> or <a href="register.php">Register</a></p>
</div>
</div>
</body>
</html>