-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathaccount.php
98 lines (97 loc) · 4.11 KB
/
account.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<?php
session_start();
// Only Allow Logged In Users
if (!(isset($_SESSION['loggedinanimeheaven']) && $_SESSION['loggedinanimeheaven'] == true)) {
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>AnimeHeaven</title>
<!-- Favicon -->
<link rel="shortcut icon" type="image/png" href="./media/images/ah_logo.png"/>
<!-- Stylesheets -->
<link rel="stylesheet" href="./css/global.css">
<link rel="stylesheet" href="./css/account.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" integrity="sha512-iBBXm8fW90+nuLcSKlbmrPcLa0OT92xO1BIsZ+ywDWZCvqsWgccV3gFoRBv0z+8dLJgyAHIhR35VZc2oM/gI1w==" crossorigin="anonymous" />
</head>
<body>
<!-- Header Start -->
<header class="site-header">
<div class="wrapper site-header__wrapper">
<div class="site-header__start">
<a href="./homepage.php" class="brand"><img src="./media/images/ah_logo.png" alt="Logo"></a>
</div>
<div class="site-header__middle">
<nav class="nav">
<button class="nav__toggle" aria-expanded="false" type="button">
<i class="fas fa-bars"></i>
</button>
<ul class="nav__wrapper">
<li class="nav__item"><a href="./homepage.php">Home</a></li>
<li class="nav__item"><a href="./search.php">Search</a></li>
<li class="nav__item"><a href="./account.php">Account</a></li>
<?php
if (isset($_SESSION['uid'])) {
if ($_SESSION['uid'] == 1) {
echo '<li class="nav__item"><a href="./admin.php">Admin</a></li>';
}
}
?>
</ul>
</nav>
</div>
<div class="site-header__end">
<a class="button" href="./handlers/logoutHandler.php">Logout</a>
</div>
</div>
</header>
<!-- Header End -->
<!-- Content Starts -->
<?php
include './db.php';
$uid = $_SESSION['uid'];
$sql = "SELECT * FROM users WHERE uid = $uid";
$result = $conn -> query($sql);
$user = $result -> fetch_assoc();
?>
<div class="account-box">
<form action="./handlers/accountHandler.php" method="POST" class="account-box-form">
<h3 class="account-box-title">Update Details</h3>
<div class="form-group">
<label htmlFor="name">Name</label>
<input type="text" name="name" id="name" placeholder="Enter your name" value="<?php echo ucwords($user['name']) ?>" required />
</div>
<div class="form-group">
<label htmlFor="email">Email</label>
<input type="email" name="email" id="email" placeholder="Email address" value="<?php echo $user['email'] ?>" required/>
</div>
<div class="form-group">
<label htmlFor="password">New Password</label>
<input type="password" name="password" id="password" autoComplete="true" placeholder="Enter new password" value="<?php echo $user['password'] ?>" required />
</div>
<div class="form-group">
<label htmlFor="confirmpassword">Confirm New Password</label>
<input type="password" name="confirmpassword" id="confirmpassword" autoComplete="true" placeholder="Confirm new password" value="<?php echo $user['password'] ?>" required />
</div>
<button type="submit" class="btn btn-primary" name="account_form" value="Update">
Update
</button>
</form>
</div>
<!-- Content Ends -->
<!-- Footer Start -->
<footer>
<img src="./media/images/ah_logo.png">
<h3> © Made by <a href="https://www.subhashissuara.com/" target="_blank">Subhashis Suara</a> and <a href="https://github.com/AvinashKumarTiu" target="_blank">Avinash Kumar Tiu</a></h3>
</footer>
</div>
<!-- Footer End -->
<!-- JS Scripts -->
<script src="./scripts/script.js"></script>
</body>
</html>