/
myaccount.php
132 lines (75 loc) · 3.25 KB
/
myaccount.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
$message = "";
$user = mysql_fetch_assoc(getUserByID(getSessionVariable('user_id')));
if($pageid == "savepassword"){
$curpass = $_POST['curpass'];
$newpass = $_POST['newpass'];
$confpass = $_POST['confpass'];
if($curpass != "" && $newpass != "" && $confpass != ""){
if(encrypt($curpass) == $user['password']){
if($newpass == $confpass){
changeUserPassword(getSessionVariable('user_id'), $newpass);
$user = mysql_fetch_assoc(getUserByID(getSessionVariable('user_id')));
$message = "<font color=\"#005500\"><b>Password Updated!</b></font><br><br>";
}
else{
$message = "<font color=\"#FF0000\"><b>Error: The New Passwords Don't Match</b></font><br><br>";
}
}
else{
$message = "<font color=\"#FF0000\"><b>Error: Current Password Incorrect</b></font><br><br>";
}
}else{
$message = "<font color=\"#005500\"><b>Error: A Required Field Was Left Blank</b></font><br><br>";
}
}
else if($pageid == "saveemail"){
$email = $_POST['email'];
if($email != ""){
changeUserEmail(getSessionVariable('user_id'), $email);
$user = mysql_fetch_assoc(getUserByID(getSessionVariable('user_id')));
$message = "<font color=\"#005500\"><b>Email Updated!</b></font><br><br>";
}else{
$message = "<font color=\"#FF0000\"><b>Error: Email Field Was Left Blank</b></font><br><br>";
}
}
$passwordRows = "";
if(!getConfigVar("use_ldap")){
$passwordRows = "<tr>
<td class=\"centeredcellbold\">Change Password</td>
<td class=\"centeredcellbold\">Current Password</td>
<td class=\"centeredcellbold\">New Password</td>
<td class=\"centeredcellbold\">Confirm Password</td>
</tr>
<tr>
<form action=\"./index.php?pageid=savepassword\" method=\"POST\"><td class=\"centeredcellbold\"><input type=\"submit\" value=\"Save Password\"></td>
<td class=\"centeredcell\"><input type=\"password\" name=\"curpass\"></td>
<td class=\"centeredcell\"><input type=\"password\" name=\"newpass\"></th>
<td class=\"centeredcell\"><input type=\"password\" name=\"confpass\"></td></form>
</tr>";
}
echo "
<center><h3>My Account</h3>".$message."</center>
<table class=\"myaccount\">
<tr>
<td colspan=4 class=\"header\">Edit User Information</td>
</tr>
<tr>
<td class=\"centeredcellbold\">Username</td>
<td colspan=3 class=\"centeredcell\">".$user['username']."</td>
</tr>
<tr>
<td class=\"centeredcellbold\">Name</th>
<td colspan=3 class=\"centeredcell\">".$user['name']."</td>
</tr>
".$passwordRows."
<tr>
<form action=\"./index.php?pageid=saveemail\" method=\"POST\">
<td colspan=1 class=\"centeredcellbold\">Email</th><td colspan=3 class=\"centeredcell\"><input type=\"text\" name=\"email\" size=30 value=\"".$user['email']."\"><input type=\"submit\" value=\"Save Email\"></td></form>
</tr>
<tr>
<td colspan=1 class=\"centeredcellbold\">Warnings</th>
<td class=\"centeredcellbold\" colspan=3><a href=\"./index.php?pageid=viewmywarnings\">".mysql_num_rows(getActiveWarningsForUser($user['user_id']))."(".mysql_num_rows(getWarningsForUser($user['user_id'])).")</a></td>
</tr>
</table>";
?>