-
Notifications
You must be signed in to change notification settings - Fork 0
/
user_profile.php
243 lines (197 loc) · 7.77 KB
/
user_profile.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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
<?php
include "config.php";
session_start();
if (isset($_SESSION['user_email'])) {
$user_email = $_SESSION['user_email'];
// Query to retrieve the data columns
$sql = "SELECT user_fname, user_name, user_gender, user_pn, user_img FROM reg_user WHERE user_email = '$user_email'";
// Execute the query
$result = mysqli_query($connection, $sql);
if (mysqli_num_rows($result) > 0) {
// Fetch the result as an associative array
$row = mysqli_fetch_assoc($result);
$user_name = $row['user_name'];
$user_fname = $row['user_fname'];
$user_img = $row['user_img'];
$user_gender = $row['user_gender'];
$user_pn = $row['user_pn'];
}
} else {
echo "<script> alert('User email not found.')</script>";
// Redirect the user to the login page or handle the error accordingly
exit();
}
if (isset($_POST["deletebtn"])){
$user_email = $_POST['user_email'];
$deleteSql = "DELETE FROM reg_user WHERE user_name='$user_email'";
$result = mysqli_query($connection, $sql);
if ($connection->query($deleteSql) === TRUE) {
echo "<script> alert('Your profile has been deleted successfully!')</script>";
} else {
echo "<script> alert('Error deleting User profile:')</script>" . $connection->error;
}
}
?>
<html>
<head>
<title>BallotBox23</title>
<!--CSS-->
<link rel="stylesheet" href="css/user_profile.css">
<!--JS-->
<!--Boxicons CSS-->
<link href='https://unpkg.com/[email protected]/css/boxicons.min.css' rel='stylesheet'>
</head>
<body>
<!--Top Navigation bar -->
<div class="topnav">
<div class="topnav-bar">
<div class="logo">
<img src="img/logo2.png" class="img-logo">
</div>
<span class="name">BALLOTBOX 2023</span>
<div class="username-search">
<div class="username">
<ul class="username-links">
<li><a href="user_profile.php"><?php echo $user_name; ?></a></li>
<li>
<a href="user_profile.php">
<img src="data:image/jpg;charset=utf8;base64,<?php echo base64_encode($user_img); ?>" class="profile-img">
</a>
</li>
</ul>
</div>
<div class="searchbox">
<div class="search-field">
<input type="search" placeholder="Search...">
</div>
</div>
</div>
</div>
</div>
<!--Navigation-->
<div class="navigation">
<ul class="navbar-links">
<li><a href="home.php">Home</a></li>
<li><a href="winner.html">Winner</a></li>
<li><a href="nominee.php">Nominee</a></li>
<li><a href="category.php">Category</a></li>
</ul>
</div>
<!--Noname-->
<div class="noname">
<div class="user-profile">
<!-- <div class="winner-category"> -->
<div class="card">
<h2>Personal Information</h2>
<table class="personal">
<tr>
<td colspan="2" class="first-row">
<img src="data:image/jpg;charset=utf8;base64,<?php echo base64_encode($user_img); ?>">
<input type="file" id="file" accept="image/jpg">
<label for="file">Change</label>
</td>
</tr>
<tr>
<td colspan="2" class="first-row">
<span>Username</span>
<input type="text" id="file" accept="image/jpg">
<label>Change</label>
</td>
</tr>
<tr>
<td class="t">E-mail</td>
<td class="n"><?php echo $user_email ?></td>
</tr>
<tr>
<td class="t">Name</td>
<td class="n"><?php echo $user_fname ?></td>
</tr>
<tr>
<td class="t">Mobile number</td>
<td class="n"><?php echo $user_pn ?></td>
</tr>
<tr>
<td class="t">Gender</td>
<td class="n"><?php echo $user_gender ?></td>
</tr>
<tr>
<td>
<form method="POST" action="logout.php">
<input type="hidden" name="user_email" value="<?php echo $user_email; ?>">
<button type="submit" name="deletebtn" class="btnD">Delete your profile</button>
</form>
</td>
</tr>
</table>
</div>
<div class="card">
<h2>Voted Nominee</h2>
<table class="vote">
<tr>
<th>No</th>
<th>Nomine Name</th>
<th>Voted Date</th>
</tr>
<tr>
<td>1</td>
<td>Empty</td>
<td>Empty</td>
</tr>
</table>
</div>
<!-- </div> -->
</div>
</div>
<footer class="footer-distributed">
<div class="footer-left">
<h3>BALLOTBOX2023</h3>
<p class="footer-links">
<a href="home.php">Home</a>
|
<a href="about.html">About</a>
|
<a href="about.html">Contact</a>
|
<a href="#">Blog</a>
</p>
</div>
<div class="footer-center">
<div>
<i class="fa fa-address"></i>
<p>Ballotbox2023,Colombo 07,Sri Lanka</p>
</div>
<div>
<i class="fa fa-phone"></i>
<p>+91 2*9 6**7</p>
</div>
<div>
<i class="fa fa-envelope"></i>
<p><a>[email protected]</a></p>
</div>
</div>
<div class="footer-right">
<p class="footer-company-about">
<h4 class="text-light mb-4">Informations</h4>
<a class="btn btn-link" href="Terms and Conditions.html">Terms and Conditions</a><br>
<a class="btn btn-link" href="FAQ.html">FAQ</a><br>
<a class="btn btn-link" href="Privacy.html">Privacy</a>
</p>
<div class="footer-icons">
<img src="E:\Ballotbox23\img\facebook.svg" width="10%" height="10%"><i class="fa-brands fa-facebook"></i></a>
<img src="E:\Ballotbox23\img\instagram.svg" width="10%" height="10%"><i class="fa-brands fa-square-instagram"></i></a>
<img src="E:\Ballotbox23\img\youtube.svg" width="10%" height="10%"><i class="fa-brands fa-youtube"></i></a>
<img src="E:\Ballotbox23\img\twitter.svg" width="10%" height="10%"><i class="fa-brands fa-twitter"></i></a>
<img src="E:\Ballotbox23\img\linkedin.svg" width="10%" height="10%"><i class="fa-brands fa-linkedin"></i></a>
</div>
</div>
</footer>
<div class="copyright">
<div class="row">
<div class="text-center mb-3 mb-md-0">
<B> © All Right Reserved.
Designed By <a class="border-bottom" href="index.html">BALLOTBOX 2023</B></a>
</div>
</div>
</div>
</body>
</html>