-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaccount.php
132 lines (108 loc) · 5.06 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<?php
session_start();
include_once 'include/config.php';
include_once 'include/gallery_user_functions.php';
include_once 'include/getuser.php';
//get user
$user = getSessionUser();
// Connect to MySQL
$db = mysqli_connect(DBHOST, DBUSER, DBPASS, DBNAME);
// Error checking
if (!$db) {
print "<p>Error - Could not connect to MySQL</p>";
exit;
}
$error = mysqli_connect_error();
if ($error != null) {
$output = "<p>Unable to connet to database</p>" . $error;
exit($output);
}
$query = "SELECT * FROM `user` WHERE user_id=$user";
$result = mysqli_query($db, $query);
$row = mysqli_fetch_assoc($result);
?>
<!DOCTYPE html>
<html lan="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>User Settings Page </title>
<link href="css/style.css" rel="stylesheet">
<script src="https://kit.fontawesome.com/57c4c79ee8.js" crossorigin="anonymous"></script>
<link href="https://fonts.googleapis.com/css2?family=Permanent+Marker&display=swap" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<link href="https://fonts.googleapis.com/css2?family=Roboto+Condensed:ital@1&display=swap" rel="stylesheet">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
<script src="js/login.js"></script>
</head>
<body>
<!--
main nav bar
-->
<nav class="main-nav">
<div class="logo">
<img src="images/logo.png">
</div>
<div class="hamburger">
<div class="line"></div>
<div class="line"></div>
<div class="line"></div>
</div>
<div class="post-bt">
<a href="#"><i class="fas fa-plus"></i>  Post new image</a>
</div>
<ul class="nav-links">
<li><a href="gallery.php"><i class="fas fa-th"></i>  Gallery</a></li>
<li><a href="user.php"><i class="fas fa-house-user"></i>  My dashboard</a></li>
<li><a href="logout.php"><i class="fas fa-sign-out-alt"></i>  Sign out</a></li>
<li><a href="about.html"><i class="fas fa-question-circle"></i>  About</a></li>
</ul>
</nav>
<div class="user-settings">
<div class="sidebar">
<h2>Account Settings </h2>
<ul>
<li><a href="#profile"><i class="fa fa-wrench" aria-hidden="true"></i> <span> Profile</span> </a></li>
<li><a href="#password"><i class="fa fa-lock" aria-hidden="true"></i> <span> Chnage Password</span> </a> </li>
<li><a href="#"><i class="fa fa-sign-out" aria-hidden="true"></i> <span> Logout</span> </li>
<li><a href="#deactivate"><i class="fa fa-user-times" aria-hidden="true"></i> <span> Deactivate Account</span> </a> </li>
</ul>
</div>
<div class="settings">
<div id="profile" class="header"> Edit Profile </div>
<form class="info" action="include/user_update.php" method="POST" enctype="multipart/form-data">
<!-- Name <br>
<input type="text" name="Name" id="fname" value="Jerin John"><br><br>
-->
User Name <br>
<input type="text" name="Username" id="uname" value="<?php echo $row['name']?>"><br><br>
E-mail <br>
<input type="text" name="E-Mail" id="email" value="<?php echo $row['email']?>"><br><br>
<input type="hidden" name="user" value="<?php echo $row['user_id']?>">
<button type="submit" name="Update-Info">Update Info</button>
</form>
<div class="header"> Change Password </div>
<form id="password" class="info" action="include/change_password.php" method="POST" enctype="multipart/form-data">
Enter Old Password <br>
<input type="password" name="Old-Password" id="opass" value=""><br><br>
Enter New Passowrd <br>
<input type="password" name="New-Password" id="npass" value=""><br><br>
Confirm New Password <br>
<input type="password" name="D-Check-Password" id="cpass" value=""><br><br>
<input type="hidden" name="user" value="<?php echo $row['user_id']?>">
<button type="submit" name="Password-change">Change Password</button>
</form>
<div class="header"> Deactivate Account </div>
<form id="deactivate" class="info" action="include/delete_user.php" method="POST" enctype="multipart/form-data">
Enter Password <br>
<input type="password" name="Password" id="dpass" value=""><br><br>
<input type="hidden" name="user" value="<?php echo $row['user_id']?>">
<button type="submit" name="Delete-Account">Deactive Account</button>
</form>
</div>
</div>
</div>
<script src="js/nav.js"></script>
<script src="js/jquery-3.5.1.min.js"></script>
<script src="js/account.js"></script>
</body>