-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprofile.php
244 lines (190 loc) · 6.67 KB
/
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
244
<?php
require_once 'includes/header.inc.php';
if (!isset($_SESSION['email'])) {
header("Location:index.php");
}
?>
<!-- CSS -->
<link rel="stylesheet" href="css/profile.css">
<div class="well msg text-center">
<?php
if (isset($_GET['status'])) {
$st = $_GET['status'];
switch ($st) {
case 0:
echo '<p class="text-center py-2 neg-msg bg-light">Invalid email input</p>';
break;
case 1:
echo '<p class="text-center py-2 neg-msg bg-light">Incorrect password</p>';
break;
case 2:
echo '<p class="text-center py-2 neg-msg bg-light">Error... Please try again later</p>';
break;
case 200:
echo '<p class="text-center py-2 pos-msg bg-light">Email updated successfully!</p>';
break;
case 3:
echo '<p class="text-center py-2 neg-msg bg-light">Password change error. Password do not match</p>';
break;
case 4:
echo '<p class="text-center py-2 neg-msg bg-light">Invalid password input</p>';
break;
case 300:
echo '<p class="text-center py-2 pos-msg bg-light">Password changed successfully!</p>';
break;
case 11:
echo '<p class="text-center py-2 neg-msg bg-light">Cannot reorder so soon...Please select another pack or wait the designated period</p>';
break;
case 12:
echo '<p class="text-center py-2 neg-msg bg-light">Error reordering.. Please try again later or contact us</p>';
break;
case 110:
echo '<p class="text-center py-2 text-success bg-light">Reorder successful!</p>';
break;
}
}
?>
</div>
<div class="container bg-primary user-p-cont">
<div class="container col-10 mx-auto bg-light user-p">
<h3 class="text-center">Account Information</h3>
<hr>
<div class="row justify-content-center">
<div class="col-4 col-md-4">
<h4>Client Id: </h4>
</div>
<div class="col-8 col-md-2">
<h4 id="cmp-id">#<?php echo $_SESSION['id']; ?></h4>
</div>
</div>
<div class="row justify-content-center">
<div class="col-4 col-md-4">
<h4>Company: </h4>
</div>
<div class="col-8 col-md-2">
<h4 id="nm"><?php echo $_SESSION['name']; ?></h4>
</div>
</div>
<div class="row justify-content-center">
<div class="col-4 col-md-4">
<h4>Phone: </h4>
</div>
<div class="col-8 col-md-2">
<h4 id="em"><?php echo $_SESSION['email']; ?></h4>
</div>
</div>
<br>
<p class="text-center"><a href="includes/logout.inc.php"><button class="btn btn-danger col-12 col-md-4" type="button" name="button">Log Out</button></a></p>
</div>
<br><br>
<div class="container bg-light col-10 mx-auto ord-items">
<h3 class="text-center mt-1">Recent Orders</h3>
<hr>
<div class="items">
</div>
</div>
<br><br>
<div class="container bg-light col-10 mx-auto acc-pref">
<h3 class="text-center mt-1">Account Preferences</h3>
<hr>
<div class="row">
<h4 class="col-5 col-md-2 pref-it">Email:</h4>
<h4 class="col-7 col-md-5 pref-it"><?php echo $_SESSION['email']; ?></h4>
<button class="col-9 col-md-2 mx-5 btn btn-warning" id="show-email">Change</button>
</div>
<br>
<!-- Email Dropdown -->
<div class="wrap-em-ch border border-warning">
<div class="row justify-content-center">
<h4 class="my-4">Change Email</h4>
</div>
<form action="includes/preferences.inc.php" method="post">
<div class="row pass-c justify-content-center">
<div class="col-10 col-md-6">
<input class="form-control" type="text" name="email" placeholder="New Email...">
</div>
</div>
<div class="row pass-c justify-content-center mt-2">
<div class="col-10 col-md-6">
<input class="form-control" type="password" name="pass" placeholder="Password...">
</div>
</div>
<br>
<div class="row justify-content-center my-3">
<button class="btn btn-warning mr-3" id="sub-em" type="submit" name="sub-em">Change</button>
<button class="btn btn-danger ml-3" id="cancel-email" type="button" name="button">Cancel</button>
</div>
</form>
</div>
<!-- Password -->
<br>
<div class="row">
<h4 class="col-5 col-md-2 pref-it">Password:</h4>
<h4 class="col-6 col-md-5 pref-it">Click to change</h4>
<button class="col-9 col-md-2 mx-5 btn btn-warning" id="show-pass">Change</button>
</div>
<br><br>
<!-- Password Dropdown -->
<div class="wrap-pas-ch border border-warning">
<div class="row justify-content-center">
<h4 class="my-4">Change Password</h4>
</div>
<form action="includes/preferences.inc.php" method="post">
<div class="row pass-c justify-content-center">
<div class="col-10 col-md-6">
<input class="form-control" type="password" name="old-pass" placeholder="Old Password...">
</div>
</div>
<br>
<div class="row pass-c justify-content-center mb-2">
<div class="col-10 col-md-6">
<input class="form-control" type="password" name="new-pass" placeholder="New Password...">
</div>
</div>
<div class="row pass-c justify-content-center">
<div class="col-10 col-md-6">
<input class="form-control" type="password" name="re-pass" placeholder="Retype Password...">
</div>
</div>
<div class="row justify-content-center my-3">
<button class="btn btn-warning mr-3" id="sub-pass" type="submit" name="sub-pass">Change</button>
<button class="btn btn-danger ml-3" id="cancel-pass" type="button" name="button">Cancel</button>
</div>
</form>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
var k = 9;
$(".items").load("includes/profile.inc.php",{
k : k
});
// Message
(function(){
console.log("fired")
setTimeout(function(){
$(".msg").slideUp("slow")
},6000);
})();
// Password
$("#show-pass").click(function(){
$(".wrap-pas-ch").slideDown("slow");
$("html, body").animate({ scrollTop: $(document).height() }, 1000);
});
$("#cancel-pass").click(function(){
$(".wrap-pas-ch").slideUp("slow");
});
// email
$("#show-email").click(function(){
$(".wrap-em-ch").slideDown("slow");
$("html, body").animate({ scrollTop: $(document).height() }, 1000);
});
$("#cancel-email").click(function(){
$(".wrap-em-ch").slideUp("slow");
});
});//End of document
</script>
</body>
</html>