-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathcust_profile.php
More file actions
178 lines (166 loc) · 10.1 KB
/
cust_profile.php
File metadata and controls
178 lines (166 loc) · 10.1 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<?php
session_start();
if(!isset($_SESSION["cid"])){
header("location: restricted.php");
exit(1);
}
include("conn_db.php");
include('head.php');
?>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="css/main.css" rel="stylesheet">
<link href="css/menu.css" rel="stylesheet">
<title>My Profile | EATERIO</title>
</head>
<body class="d-flex flex-column h-100">
<?php include('nav_header.php')?>
<div class="container px-5 py-4" id="cart-body">
<div class="row my-4 pb-2 border-bottom">
<a class="nav nav-item text-decoration-none text-muted mb-2" href="#" onclick="history.back();">
<i class="bi bi-arrow-left-square me-2"></i>Go back
</a>
<?php
if(isset($_GET["up_pwd"])){
if($_GET["up_pwd"]==1){
?>
<!-- START SUCCESSFULLY UPDATE PASSWORD -->
<div class="row row-cols-1 notibar">
<div class="col mt-2 ms-2 p-2 bg-success text-white rounded text-start">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor"
class="bi bi-check-circle ms-2" viewBox="0 0 16 16">
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z" />
<path
d="M10.97 4.97a.235.235 0 0 0-.02.022L7.477 9.417 5.384 7.323a.75.75 0 0 0-1.06 1.06L6.97 11.03a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 0 0-1.071-1.05z" />
</svg>
<span class="ms-2 mt-2">Successfully updated your password!</span>
<span class="me-2 float-end"><a class="text-decoration-none link-light" href="cust_profile.php">X</a></span>
</div>
</div>
<!-- END SUCCESSFULLY UPDATE PASSWORD -->
<?php }else{ ?>
<!-- START FAILED UPDATE PASSWORD -->
<div class="row row-cols-1 notibar">
<div class="col mt-2 ms-2 p-2 bg-danger text-white rounded text-start">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor"
class="bi bi-x-circle ms-2" viewBox="0 0 16 16">
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z" />
<path
d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z" />
</svg><span class="ms-2 mt-2">Failed to update your password.</span>
<span class="me-2 float-end"><a class="text-decoration-none link-light" href="cust_profile.php">X</a></span>
</div>
</div>
<!-- END FAILED UPDATE PASSWORD -->
<?php }
}
if(isset($_GET["up_prf"])){
if($_GET["up_prf"]==1){
?>
<!-- START SUCCESSFULLY UPDATE PASSWORD -->
<div class="row row-cols-1 notibar">
<div class="col mt-2 ms-2 p-2 bg-success text-white rounded text-start">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor"
class="bi bi-check-circle ms-2" viewBox="0 0 16 16">
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z" />
<path
d="M10.97 4.97a.235.235 0 0 0-.02.022L7.477 9.417 5.384 7.323a.75.75 0 0 0-1.06 1.06L6.97 11.03a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 0 0-1.071-1.05z" />
</svg>
<span class="ms-2 mt-2">Successfully updated your profile!</span>
<span class="me-2 float-end"><a class="text-decoration-none link-light" href="cust_profile.php">X</a></span>
</div>
</div>
<!-- END SUCCESSFULLY UPDATE PASSWORD -->
<?php }else{ ?>
<!-- START FAILED UPDATE PASSWORD -->
<div class="row row-cols-1 notibar">
<div class="col mt-2 ms-2 p-2 bg-danger text-white rounded text-start">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor"
class="bi bi-x-circle ms-2" viewBox="0 0 16 16">
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z" />
<path
d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z" />
</svg><span class="ms-2 mt-2">Failed to update your profile.</span>
<span class="me-2 float-end"><a class="text-decoration-none link-light" href="cust_profile.php">X</a></span>
</div>
</div>
<!-- END FAILED UPDATE PASSWORD -->
<?php }
}
?>
<h2 class="pt-3 display-6"><svg xmlns="http://www.w3.org/2000/svg" width="40" height="40"
fill="currentColor" class="bi bi-person-circle" viewBox="0 0 16 16">
<path d="M11 6a3 3 0 1 1-6 0 3 3 0 0 1 6 0z" />
<path fill-rule="evenodd"
d="M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8zm8-7a7 7 0 0 0-5.468 11.37C3.242 11.226 4.805 10 8 10s4.757 1.225 5.468 2.37A7 7 0 0 0 8 1z" />
</svg> My Profile</h2>
</div>
<a class="btn btn-sm btn-outline-secondary me-2" href="cust_update_pwd.php">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-key"
viewBox="0 0 16 16">
<path
d="M0 8a4 4 0 0 1 7.465-2H14a.5.5 0 0 1 .354.146l1.5 1.5a.5.5 0 0 1 0 .708l-1.5 1.5a.5.5 0 0 1-.708 0L13 9.207l-.646.647a.5.5 0 0 1-.708 0L11 9.207l-.646.647a.5.5 0 0 1-.708 0L9 9.207l-.646.647A.5.5 0 0 1 8 10h-.535A4 4 0 0 1 0 8zm4-3a3 3 0 1 0 2.712 4.285A.5.5 0 0 1 7.163 9h.63l.853-.854a.5.5 0 0 1 .708 0l.646.647.646-.647a.5.5 0 0 1 .708 0l.646.647.646-.647a.5.5 0 0 1 .708 0l.646.647.793-.793-1-1h-6.63a.5.5 0 0 1-.451-.285A3 3 0 0 0 4 5z" />
<path d="M4 8a1 1 0 1 1-2 0 1 1 0 0 1 2 0z" />
</svg>
Change password
</a>
<a class="btn btn-sm btn-primary mt-2 mt-md-0" href="cust_update_profile.php">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor"
class="bi bi-pencil-square" viewBox="0 0 16 16">
<path
d="M15.502 1.94a.5.5 0 0 1 0 .706L14.459 3.69l-2-2L13.502.646a.5.5 0 0 1 .707 0l1.293 1.293zm-1.75 2.456-2-2L4.939 9.21a.5.5 0 0 0-.121.196l-.805 2.414a.25.25 0 0 0 .316.316l2.414-.805a.5.5 0 0 0 .196-.12l6.813-6.814z" />
<path fill-rule="evenodd"
d="M1 13.5A1.5 1.5 0 0 0 2.5 15h11a1.5 1.5 0 0 0 1.5-1.5v-6a.5.5 0 0 0-1 0v6a.5.5 0 0 1-.5.5h-11a.5.5 0 0 1-.5-.5v-11a.5.5 0 0 1 .5-.5H9a.5.5 0 0 0 0-1H2.5A1.5 1.5 0 0 0 1 2.5v11z" />
</svg>
Update my profile
</a>
<!-- START CUSTOMER INFORMATION -->
<?php
//Select customer record from database
$query = "SELECT c_username,c_firstname,c_lastname,c_email,c_gender,c_type FROM customer WHERE c_id = {$_SESSION['cid']} LIMIT 0,1";
$result = $mysqli ->query($query);
$row = $result -> fetch_array();
?>
<div class="row row-cols-1 mt-4">
<dl class="row">
<dt class="col-sm-3">Username</dt>
<dd class="col-sm-9"><?php echo $row["c_username"];?></dd>
<dt class="col-sm-3">Name</dt>
<dd class="col-sm-9"><?php echo $_SESSION["firstname"]." ".$_SESSION["lastname"];?></dd>
<dt class="col-sm-3">Gender</dt>
<dd class="col-sm-9"><?php
if($row["c_gender"]=="M"){echo "Male";}
else if($row["c_gender"]=="F"){echo "Female";}
else if($row["c_gender"]=="N"){echo "Non-binary";}?>
</dd>
<dt class="col-sm-3">Role</dt>
<dd class="col-sm-9"><?php
if($row["c_type"]=="STD"){echo "Student";}
else if($row["c_type"]=="INS"){echo "Instructor";}
else if($row["c_type"]=="TAS"){echo "Teaching Assistant";}
else if($row["c_type"]=="STF"){echo "Faculty Staff";}
else if($row["c_type"]=="GUE"){echo "Guest";}
else{echo "Others";}
?>
</dd>
<dt class="col-sm-3">Email</dt>
<dd class="col-sm-9"><?php echo $row["c_email"];?></dd>
</dl>
</div>
<!-- END CUSTOMER INFORMATION -->
</div>
<footer
class="footer d-flex flex-wrap justify-content-between align-items-center px-5 py-3 mt-auto bg-secondary text-light">
<span class="smaller-font">© 2021 SeriousEater Group<br /><span class="xsmall-font">Paphana Y. Sirada C.
Thanakit L.</span></span>
<ul class="nav justify-content-end list-unstyled d-flex">
<li class="ms-3"><a class="text-light" target="_blank" href="https://github.com/waterthatfrozen/EATERIO"><i
class="bi bi-github"></i></a></li>
</ul>
</footer>
</body>
</html>