-
Notifications
You must be signed in to change notification settings - Fork 0
/
account.php
502 lines (413 loc) · 21.2 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
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
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
<?php
//
// TorrentTrader v2.x
// $LastChangedDate: 2011-11-27 18:16:07 +0000 (Sun, 27 Nov 2011) $
// $LastChangedBy: dj-howarth1 $
//
// http://www.torrenttrader.org
//
//
require_once("backend/functions.php");
dbconn(false);
loggedinonly();
stdhead(T_("USERCP"));
function navmenu(){
?>
<br /><table class="f-border" align='center' cellpadding='0' cellspacing='3' width='100%'><tr><td>
<table class="f-title" cellpadding='0' cellspacing='3' width='100%'>
<tr>
<td width='100%' height="32" align='center'>
<?php print("<a href='account.php'><b>".T_("YOUR_PROFILE")."</b></a>");?>
|
<?php print("<a href='account.php?action=edit_settings&do=edit'><b>".T_("YOUR_SETTINGS")."</b></a>");?>
|
<?php print("<a href='account.php?action=changepw'><b>".T_("CHANGE_PASS")."</b></a>");?>
|
<?php print("<a href='account.php?action=mytorrents'><b>".T_("YOUR_TORRENTS")."</b></a>");?>
|
<?php print("<a href='mailbox.php'><b>".T_("YOUR_MESSAGES")."</b></a>");?>
</td></tr>
</table>
</td></tr></table>
<?php
}//end func
$action = $_REQUEST["action"];
$do = $_REQUEST["do"];
if (!$action){
begin_frame(T_("USER").": $CURUSER[username] (".T_("ACCOUNT_PROFILE").")");
$usersignature = stripslashes($CURUSER["signature"]);
$hash = sha1($CURUSER["id"].$CURUSER["secret"].$CURUSER["password"].getip().$CURUSER["secret"]);
navmenu();
?>
<table class="f-border comment" cellpadding="10" border="0" width="100%">
<tr>
<td width="50%" valign="top">
<b><?php echo T_("USERNAME"); ?>:</b> <?php echo $CURUSER["username"]; ?><br />
<b><?php echo T_("CLASS"); ?>:</b> <?php echo $CURUSER["level"]; ?><br />
<b><?php echo T_("EMAIL"); ?>:</b> <?php echo $CURUSER["email"]; ?><br />
<b><?php echo T_("JOINED"); ?>:</b> <?php echo utc_to_tz($CURUSER["added"]); ?><br />
<b><?php echo T_("AGE"); ?>:</b> <?php echo $CURUSER["age"]; ?><br />
<b><?php echo T_("GENDER"); ?>:</b> <?php echo T_($CURUSER["gender"]); ?><br />
<b><?php echo T_("PREFERRED_CLIENT"); ?>:</b> <?php echo htmlspecialchars($CURUSER["client"]); ?><br />
<b><?php echo T_("DONATED"); ?>:</b> <?php echo $site_config['currency_symbol']; ?><?php echo number_format($CURUSER["donated"], 2); ?><br />
<b><?php echo T_("CUSTOM_TITLE"); ?>:</b> <?php echo format_comment($CURUSER["title"]); ?><br />
<b><?php echo T_("ACCOUNT_PRIVACY_LVL"); ?>:</b> <?php echo T_($CURUSER["privacy"]); ?><br />
<b><?php echo T_("SIGNATURE"); ?>:</b> <?php echo format_comment($usersignature); ?><br />
<b><?php echo T_("PASSKEY"); ?>:</b> <?php echo $CURUSER["passkey"]; ?><br />
<b><?php echo "Cookie 'UID'"; ?>:</b> <?php echo $CURUSER["id"]; ?><br />
<b><?php echo T_("COOKIE"); ?>:</b> <?php echo $hash; ?><br />
<?php
if ($CURUSER["invited_by"]) {
$res = SQL_Query_exec("SELECT username FROM users WHERE id=$CURUSER[invited_by]");
$row = mysql_fetch_assoc($res);
echo "<b>".T_("INVITED_BY").":</b> <a href=\"account-details.php?id=$CURUSER[invited_by]\">$row[username]</a><br />";
}
echo "<b>".T_("INVITES").":</b> " . number_format($CURUSER["invites"]) . "<br />";
$invitees = array_reverse(explode(" ", $CURUSER["invitees"]));
$rows = array();
foreach ($invitees as $invitee) {
$res = SQL_Query_exec("SELECT id, username FROM users WHERE id='$invitee' and status='confirmed'");
if ($row = mysql_fetch_assoc($res)) {
$rows[] = "<a href=\"account-details.php?id=$row[id]\">$row[username]</a>";
}
}
if ($rows)
echo "<b>".T_("INVITED").":</b> ".implode(", ", $rows)."<br />";
?>
<?php print("<b>".T_("IP").":</b> " . $CURUSER["ip"] . "\n"); ?><br />
</td></tr>
</table>
<br /><br />
<?php
end_frame();
}
/////////////// MY TORRENTS ///////////////////
if ($action=="mytorrents"){
begin_frame(T_("YOUR_TORRENTS"));
navmenu();
//page numbers
$page = (int) $_GET['page'];
$perpage = 200;
$res = SQL_Query_exec("SELECT COUNT(*) FROM torrents WHERE torrents.owner = " . $CURUSER["id"] ."");
$arr = mysql_fetch_row($res);
$pages = floor($arr[0] / $perpage);
if ($pages * $perpage < $arr[0])
++$pages;
if ($page < 1)
$page = 1;
else
if ($page > $pages)
$page = $pages;
for ($i = 1; $i <= $pages; ++$i)
if ($i == $page)
$pagemenu .= "$i\n";
else
$pagemenu .= "<a href='account.php?action=mytorrents&page=$i'>$i</a>\n";
if ($page == 1)
$browsemenu .= "";
else
$browsemenu .= "<a href='account.php?action=mytorrents&page=" . ($page - 1) . "'>[Prev]</a>";
$browsemenu .= " ";
if ($page == $pages)
$browsemenu .= "";
else
$browsemenu .= "<a href='account.php?action=mytorrents&page=" . ($page + 1) . "'>[Next]</a>";
$offset = ($page * $perpage) - $perpage;
//end page numbers
$where = "WHERE torrents.owner = " . $CURUSER["id"] ."";
$orderby = "ORDER BY added DESC";
$query = SQL_Query_exec("SELECT torrents.id, torrents.category, torrents.name, torrents.added, torrents.hits, torrents.banned, torrents.comments, torrents.seeders, torrents.leechers, torrents.times_completed, categories.name AS cat_name, categories.parent_cat AS cat_parent FROM torrents LEFT JOIN categories ON category = categories.id $where $orderby LIMIT $offset,$perpage");
$allcats = mysql_num_rows($query);
if($allcats == 0) {
echo '<div class="f-border comment"><br /><b>'.T_("NO_UPLOADS").'</b></div>';
}else{
print("<p align='center'>$pagemenu<br />$browsemenu</p>");
?>
<table align="center" cellpadding="5" cellspacing="3" class="table_table" width="100%">
<tr>
<th class="table_head"><?php echo T_("TYPE"); ?></th>
<th class="table_head"><?php echo T_("NAME"); ?></th>
<th class="table_head"><?php echo T_("COMMENTS"); ?></th>
<th class="table_head"><?php echo T_("HITS"); ?></th>
<th class="table_head"><?php echo T_("SEEDS"); ?></th>
<th class="table_head"><?php echo T_("LEECHERS"); ?></th>
<th class="table_head"><?php echo T_("COMPLETED"); ?></th>
<th class="table_head"><?php echo T_("ADDED"); ?></th>
<th class="table_head"><?php echo T_("EDIT"); ?></th>
</tr>
<?php
while($row = mysql_fetch_assoc($query))
{
$char1 = 35; //cut length
$smallname = CutName(htmlspecialchars($row["name"]), $char1);
echo "<tr><td class='table_col2' align='center'>$row[cat_parent]: $row[cat_name]</td><td class='table_col1' align='left'><a href='torrents-details.php?id=$row[id]'>$smallname</a></td><td class='table_col2' align='center'><a href='comments.php?type=torrent&id=$row[id]'>".number_format($row["comments"])."</a></td><td class='table_col1' align='center'>".number_format($row["hits"])."</td><td class='table_col2' align='center'>".number_format($row["seeders"])."</td><td class='table_col1' align='center'>".number_format($row["leechers"])."</td><td class='table_col2' align='center'>".number_format($row["times_completed"])."</td><td class='table_col1' align='center'>".get_elapsed_time(sql_timestamp_to_unix_timestamp($row["added"]))."</td><td class='table_col2'><a href='torrents-edit.php?id=$row[id]'>EDIT</a></td></tr>\n";
}
echo "</table><br />";
print("<p align='center'>$pagemenu<br />$browsemenu</p>");
}
end_frame();
}
/////////////////////// EDIT SETTINGS ////////////////
if ($action=="edit_settings"){
if ($do=="edit"){
begin_frame(T_("EDIT_SETTINGS"));
navmenu();
?>
<form enctype="multipart/form-data" method="post" action="account.php">
<input type="hidden" name="action" value="edit_settings" />
<input type="hidden" name="do" value="save_settings" />
<table class="f-border" cellspacing="0" cellpadding="5" width="100%" align="center">
<?php
$ss_r = SQL_Query_exec("SELECT * from stylesheets");
$ss_sa = array();
while ($ss_a = mysql_fetch_array($ss_r))
{
$ss_id = $ss_a["id"];
$ss_name = $ss_a["name"];
$ss_sa[$ss_name] = $ss_id;
}
ksort($ss_sa);
reset($ss_sa);
while (list($ss_name, $ss_id) = each($ss_sa))
{
if ($ss_id == $CURUSER["stylesheet"]) $ss = " selected='selected'"; else $ss = "";
$stylesheets .= "<option value='$ss_id'$ss>$ss_name</option>\n";
}
$countries = "<option value='0'>----</option>\n";
$ct_r = SQL_Query_exec("SELECT id,name from countries ORDER BY name");
while ($ct_a = mysql_fetch_array($ct_r))
$countries .= "<option value='$ct_a[id]'" . ($CURUSER["country"] == $ct_a['id'] ? " selected='selected'" : "") . ">$ct_a[name]</option>\n";
$teams = "<option value='0'>--- ".T_("NONE_SELECTED")." ----</option>\n";
$sashok = SQL_Query_exec("SELECT id,name FROM teams ORDER BY name");
while ($sasha = mysql_fetch_array($sashok))
$teams .= "<option value='$sasha[id]'" . ($CURUSER["team"] == $sasha['id'] ? " selected='selected'" : "") . ">$sasha[name]</option>\n";
$acceptpms = $CURUSER["acceptpms"] == "yes";
print ("<tr><td align='right' class='table_col2'><b>" . T_("ACCEPT_PMS") . ":</b> </td><td class='table_col2'><input type='radio' name='acceptpms'" . ($acceptpms ? " checked='checked'" : "") .
" value='yes' /><b>".T_("FROM_ALL")."</b> <input type='radio' name='acceptpms'" .
($acceptpms ? "" : " checked='checked'") . " value='no' /><b>" . T_("FROM_STAFF_ONLY") . "</b><br /><i>".T_("ACCEPTPM_WHICH_USERS")."</i></td></tr>");
$gender = "<option value='Male'" . ($CURUSER["gender"] == "Male" ? " selected='selected'" : "") . ">" . T_("Male") . "</option>\n"
."<option value='Female'" . ($CURUSER["gender"] == "Female" ? " selected='selected'" : "") . ">" . T_("Female") . "</option>\n";
// START CAT LIST SQL
$r = SQL_Query_exec("SELECT id,name,parent_cat FROM categories ORDER BY parent_cat ASC, sort_index ASC");
if (mysql_num_rows($r) > 0)
{
$categories .= "<table><tr>\n";
$i = 0;
while ($a = mysql_fetch_assoc($r))
{
$categories .= ($i && $i % 2 == 0) ? "</tr><tr>" : "";
$categories .= "<td class='bottom' style='padding-right: 5px'><input name='cat$a[id]' type=\"checkbox\" " . (strpos($CURUSER['notifs'], "[cat$a[id]]") !== false ? " checked='checked'" : "") . " value='yes' /> " .htmlspecialchars($a["parent_cat"]).": " . htmlspecialchars($a["name"]) . "</td>\n";
++$i;
}
$categories .= "</tr></table>\n";
}
// END CAT LIST SQL
function priv($name, $descr) {
global $CURUSER;
if ($CURUSER["privacy"] == $name)
return "<input type=\"radio\" name=\"privacy\" value=\"$name\" checked=\"checked\" /> $descr";
return "<input type=\"radio\" name=\"privacy\" value=\"$name\" /> $descr";
}
print("<tr><td align='right' class='table_col1'><b>" . T_("ACCOUNT_PRIVACY_LVL") . ":</b> </td><td align='left' class='table_col1'>". priv("normal", "<b>" . T_("NORMAL") . "</b>") . " " . priv("low", "<b>" . T_("LOW") . "</b>") . " " . priv("strong", "<b>" . T_("STRONG") . "</b>") . "<br /><i>".T_("ACCOUNT_PRIVACY_LVL_MSG")."</i></td></tr>");
print("<tr><td align='right' class='table_col2'><b>" . T_("EMAIL_NOTIFICATION") . ":</b> </td><td align='left' class='table_col2'><input type='checkbox' name='pmnotif' " . (strpos($CURUSER['notifs'], "[pm]") !== false ? " checked='checked'" : "") .
" value='yes' /><b>" . T_("PM_NOTIFY_ME") . "</b><br /><i>".T_("EMAIL_WHEN_PM")."</i></td></tr>");
//print("<tr><td align=right class=table_col1 valign=top><b>".T_("CATEGORY_FILTER").": </b></td><td align=left class=table_col1><i>The system will only display the following categories when browsing (uncheck all to disable filter).</i><br />".$categories."</td></tr>");
print("<tr><td align='right' class='table_col1'><b>" . T_("THEME") . ":</b> </td><td align='left' class='table_col1'><select name='stylesheet'>\n$stylesheets\n</select></td></tr>");
print("<tr><td align='right' class='table_col2'><b>" . T_("PREFERRED_CLIENT") .":</b> </td><td align='left' class='table_col2'><input type='text' size='20' maxlength='20' name='client' value=\"" . htmlspecialchars($CURUSER["client"]) . "\" /></td></tr>");
print("<tr><td align='right' class='table_col1'><b>" . T_("AGE") . ":</b> </td><td align='left' class='table_col1'><input type='text' size='3' maxlength='2' name='age' value=\"" . htmlspecialchars($CURUSER["age"]) . "\" /></td></tr>");
print("<tr><td align='right' class='table_col2'><b>" . T_("GENDER") . ":</b> </td><td align='left' class='table_col2'><select size='1' name='gender'>\n$gender\n</select></td></tr>");
print("<tr><td align='right' class='table_col1'><b>" . T_("COUNTRY") . ":</b> </td><td align='left' class='table_col1'><select name='country'>\n$countries\n</select></td></tr>");
if ($CURUSER["class"] > 1)
print("<tr><td align='right' class='table_col2'><b>".T_("TEAM").":</b> </td><td align='left' class='table_col2'><select name='teams'>\n$teams\n</select></td></tr>");
print("<tr><td align='right' class='table_col1'><b>" . T_("AVATAR_UPLOAD") . ":</b> </td><td align='left' class='table_col1'><input type='text' name='avatar' size='50' value=\"" . htmlspecialchars($CURUSER["avatar"]) .
"\" /><br />\n<i>Link to your externally hosted avatar image: 80x80px</i><br /></td></tr>");
print("<tr><td align='right' class='table_col2'><b>" . T_("CUSTOM_TITLE") . ":</b> </td><td align='left' class='table_col2'><input type='text' name='title' size='50' value=\"" . strip_tags($CURUSER["title"]) .
"\" /><br />\n <i>" . T_("HTML_NOT_ALLOWED") . "</i></td></tr>");
print("<tr><td align='right' class='table_col1' valign='top'><b>" . T_("SIGNATURE") . ":</b> </td><td align='left' class='table_col1'><textarea name='signature' cols='50' rows='10'>" . htmlspecialchars($CURUSER["signature"]) .
"</textarea><br />\n <i>".sprintf(T_("MAX_CHARS"), 150).", " . T_("HTML_NOT_ALLOWED") . "</i></td></tr>");
print("<tr><td align='right' class='table_col2'><b>".T_("RESET_PASSKEY").":</b> </td><td align='left' class='table_col2'><input type='checkbox' name='resetpasskey' value='1' /> <i>".T_("RESET_PASSKEY_MSG").".</i></td></tr>");
print("<tr><td align='right' class='table_col1'><b>Hide Shoutbox:</b></td><td align='left' class='table_col1'><input type='checkbox' name='hideshoutbox' value='yes' ".($CURUSER['hideshoutbox'] == 'yes' ? 'checked="checked"' : '')." /> <i>I would like to hide the shoutbox.</i></td></tr> ");
print("<tr><td align='right' class='table_col2'><b>" . T_("EMAIL") . ":</b> </td><td align='left' class='table_col2'><input type=\"text\" name=\"email\" size=\"50\" value=\"" . htmlspecialchars($CURUSER["email"]) .
"\" /><br />\n<i>".T_("REPLY_TO_CONFIRM_EMAIL")."</i><br /></td></tr>");
ksort($tzs);
reset($tzs);
while (list($key, $val) = each($tzs)) {
if ($CURUSER["tzoffset"] == $key)
$tz .= "<option value=\"$key\" selected='selected'>$val[0]</option>\n";
else
$tz .= "<option value=\"$key\">$val[0]</option>\n";
}
print("<tr><td align='right' class='table_col1'><b>".T_("TIMEZONE").":</b> </td><td align='left' class='table_col1'><select name='tzoffset'>$tz</select></td></tr>");
?>
<tr><td colspan="2" align="center"><input type="submit" value="<?php echo T_("SUBMIT");?>" /> <input type="reset" value="<?php echo T_("REVERT");?>" /></td></tr>
</table></form>
<?php
end_frame();
}
if ($do == "save_settings"){
begin_frame(T_("EDIT_ACCOUNT_SETTINGS"));
navmenu();
$set = array();
$updateset = array();
$changedemail = $newsecret = 0;
$email = $_POST["email"];
if ($email != $CURUSER["email"]) {
if (!validemail($email))
$message = T_("NOT_VALID_EMAIL");
$changedemail = 1;
}
$acceptpms = $_POST["acceptpms"];
$pmnotif = $_POST["pmnotif"];
$privacy = $_POST["privacy"];
$notifs = ($pmnotif == 'yes' ? "[pm]" : "");
$r = SQL_Query_exec("SELECT id FROM categories");
$rows = mysql_num_rows($r);
for ($i = 0; $i < $rows; ++$i) {
$a = mysql_fetch_assoc($r);
if ($_POST["cat$a[id]"] == 'yes')
$notifs .= "[cat$a[id]]";
}
if ($_POST['resetpasskey']) $updateset[] = "passkey=''";
$avatar = strip_tags( $_POST["avatar"] );
if ( $avatar != null )
{
# Allowed Image Extenstions.
$allowed_types = &$site_config["allowed_image_types"];
# We force http://
if ( !preg_match( "#^\w+://#i", $avatar ) ) $avatar = "http://" . $avatar;
# Clean Avatar Path.
$avatar = cleanstr( $avatar );
# Validate Image.
$im = @getimagesize( $avatar );
if ( !$im[ 2 ] || !@array_key_exists( $im['mime'], $allowed_types ) )
$message = "The avatar url was determined to be of a invalid nature.";
# Save New Avatar.
$updateset[] = "avatar = " . sqlesc($avatar);
}
$title = strip_tags($_POST["title"]);
$signature = $_POST["signature"];
$stylesheet = $_POST["stylesheet"];
$language = $_POST["language"];
$client = strip_tags($_POST["client"]);
$age = $_POST["age"];
$gender= $_POST["gender"];
$country = $_POST["country"];
$teams = $_POST["teams"];
$privacy = $_POST["privacy"];
$timezone = (int)$_POST['tzoffset'];
if (is_valid_id($stylesheet))
$updateset[] = "stylesheet = '$stylesheet'";
if (is_valid_id($language))
$updateset[] = "language = '$language'";
if (is_valid_id($teams))
$updateset[] = "team = '$teams'";
if (is_valid_id($country))
$updateset[] = "country = $country";
if ($acceptpms == "yes")
$acceptpms = 'yes';
else
$acceptpms = 'no';
if (is_valid_id($age))
$updateset[] = "age = '$age'";
$hideshoutbox = ($_POST["hideshoutbox"] == "yes") ? "yes" : "no";
$updateset[] = "hideshoutbox = ".sqlesc($hideshoutbox);
$updateset[] = "acceptpms = ".sqlesc($acceptpms);
$updateset[] = "commentpm = " . sqlesc($pmnotif == "yes" ? "yes" : "no");
$updateset[] = "notifs = ".sqlesc($notifs);
$updateset[] = "privacy = ".sqlesc($privacy);
$updateset[] = "gender = ".sqlesc($gender);
$updateset[] = "client = ".sqlesc($client);
$updateset[] = "signature = ".sqlesc($signature);
$updateset[] = "title = ".sqlesc($title);
$updateset[] = "tzoffset = $timezone";
/* ****** */
if (!$message) {
if ($changedemail) {
$sec = mksecret();
$hash = md5($sec . $email . $sec);
$obemail = rawurlencode($email);
$updateset[] = "editsecret = " . sqlesc($sec);
$thishost = $_SERVER["HTTP_HOST"];
$thisdomain = preg_replace('/^www\./is', "", $thishost);
$body = <<<EOD
You have requested that your user profile (username {$CURUSER["username"]})
on {$site_config["SITEURL"]} should be updated with this email address ($email) as
user contact.
If you did not do this, please ignore this email. The person who entered your
email address had the IP address {$_SERVER["REMOTE_ADDR"]}. Please do not reply.
To complete the update of your user profile, please follow this link:
{$site_config["SITEURL"]}/account-ce.php?id={$CURUSER["id"]}&secret=$hash&email=$obemail
Your new email address will appear in your profile after you do this. Otherwise
your profile will remain unchanged.
EOD;
sendmail($email, "$site_config[SITENAME] profile update confirmation", $body, "From: $site_config[SITEEMAIL]", "-f$site_config[SITEEMAIL]");
$mailsent = 1;
} //changedemail
SQL_Query_exec("UPDATE users SET " . implode(",", $updateset) . " WHERE id = " . $CURUSER["id"]."");
$edited=1;
echo "<br /><br /><center><b><font color='#ff0000'>Updated OK</font></b></center><br /><br />";
if ($changedemail) {
echo "<br /><center><b>".T_("EMAIL_CHANGE_SEND")."</b></center><br /><br />";
}
}else{
echo "<br /><br /><center><b><font color='#ff0000'>".T_("ERROR").": ".$message."</font></b></center><br /><br />";
}// message
end_frame();
}// end do
}//end action
if ($action=="changepw"){
if ($do=="newpassword"){
$chpassword = $_POST['chpassword'];
$passagain = $_POST['passagain'];
if ($chpassword != "") {
if (strlen($chpassword) < 6)
$message = T_("PASS_TOO_SHORT");
if ($chpassword != $passagain)
$message = T_("PASSWORDS_NOT_MATCH");
$chpassword = passhash($chpassword);
$secret = mksecret();
}
if ((!$chpassword) || (!$passagain))
$message = "You must enter something!";
begin_frame();
navmenu();
if (!$message){
SQL_Query_exec("UPDATE users SET password = " . sqlesc($chpassword) . ", secret = " . sqlesc($secret) . " WHERE id = " . $CURUSER["id"]."") or die(mysql_error());
echo "<br /><br /><center><b>".T_("PASSWORD_CHANGED_OK")."</b></center>";
logoutcookie();
}else{
echo "<br /><br /><b><center>".$message."</center></b><br /><br />";
}
end_frame();
stdfoot();
die();
}//do
begin_frame(T_("CHANGE_YOUR_PASS"));
navmenu();
?>
<form method="post" action="account.php?action=changepw">
<input type="hidden" name="do" value="newpassword" />
<div class="f-border comment">
<table border="0" align="center" cellpadding="10">
<tr>
<td align="right"><b><?php echo T_("NEW_PASSWORD"); ?>:</b></td>
<td align="left"><input type="password" name="chpassword" size="50" /></td>
</tr>
<tr>
<td align="right"><b><?php echo T_("REPEAT"); ?>:</b></td>
<td align="left"><input type="password" name="passagain" size="50" /></td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="reset" value="<?php echo T_("REVERT"); ?>" />
<input type="submit" value="<?php echo T_("SUBMIT"); ?>" />
</td>
</tr>
</table>
</div>
</form>
<?php
end_frame();
}
stdfoot();
?>