2002-08-13 23:58:24 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
require_once("db.inc");
|
|
|
|
require_once("edit.inc");
|
|
|
|
require_once("util.inc");
|
|
|
|
|
2002-12-04 19:14:00 +00:00
|
|
|
$authenticator = init_session();
|
2002-08-13 23:58:24 +00:00
|
|
|
db_init();
|
2002-12-04 19:14:00 +00:00
|
|
|
$user = get_user_from_auth($authenticator);
|
2002-08-13 23:58:24 +00:00
|
|
|
|
|
|
|
page_head("Change Password");
|
2002-11-12 17:01:16 +00:00
|
|
|
if (!$user) {
|
|
|
|
print_login_form();
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
if ($HTTP_POST_VARS["my_pass"] == $user->web_password) {
|
|
|
|
if ($HTTP_POST_VARS["new_pass"] != $HTTP_POST_VARS["new_pass2"]) {
|
|
|
|
printf(
|
|
|
|
TABLE2."\n"
|
|
|
|
."<tr><td>".DIFFPASS."</td></tr>\n"
|
|
|
|
."</table>"
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
$query = sprintf("update user set web_password='%s' where id=%d",
|
|
|
|
$HTTP_POST_VARS["new_pass"], $user->id);
|
|
|
|
$result = mysql_query($query);
|
|
|
|
if ($result) {
|
|
|
|
printf(
|
|
|
|
TABLE2."\n"
|
|
|
|
."<tr><td>Password changed successfully. Use your new password to\n"
|
2002-12-19 18:08:43 +00:00
|
|
|
." <a href=login_form.php>login</a> to your account.</td></tr>\n"
|
2002-11-12 17:01:16 +00:00
|
|
|
."</table>\n"
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
printf(
|
|
|
|
TABLE2."\n"
|
|
|
|
."<tr><td>Password was unable to be changed. Continue using your old \n"
|
2002-12-19 18:08:43 +00:00
|
|
|
."password to <a href=login_form.php>login</a> to your account. You can try \n"
|
2002-11-12 17:01:16 +00:00
|
|
|
."changing your password again later.</td></tr>\n"
|
|
|
|
."</table>"
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2002-08-13 23:58:24 +00:00
|
|
|
} else {
|
2002-11-12 17:01:16 +00:00
|
|
|
printf(
|
|
|
|
TABLE2."\n"
|
|
|
|
."<tr>".TD2.BADPASS."</td></tr>\n"
|
|
|
|
."</table>\n"
|
|
|
|
);
|
2002-08-13 23:58:24 +00:00
|
|
|
}
|
|
|
|
page_tail();
|
|
|
|
?>
|