From d2579a00011f96c803f48b03757492e61413dbb5 Mon Sep 17 00:00:00 2001 From: Jeff Teunissen Date: Mon, 26 Mar 2007 07:59:59 +0000 Subject: [PATCH] Add a password-change page for members. --- chpass.php | 70 ++++++++++++++++++++++++++++++++++++++++++ parts/member_stuff.inc | 1 + 2 files changed, 71 insertions(+) create mode 100644 chpass.php diff --git a/chpass.php b/chpass.php new file mode 100644 index 0000000..bdbbd6d --- /dev/null +++ b/chpass.php @@ -0,0 +1,70 @@ + 5) { + $ret = true; + } else { + if (!$pass) { + $passwdError = "No password given!"; + } elseif ((!$copy) || ($pass != $copy)) { + $passwdError = "Passwords don't match!"; + } elseif (strlen ($pass) <= 5) { + $passwdError = "Password too short."; + } else { + $passwdError = "Unknown"; + } + } + + return $ret; + } + + if ($test) { + if (chkpass ($newpass, $confirm)) { + $query = "UPDATE members SET u_password=ENCRYPT('$newpass', '$user')" + ." WHERE u_username='$user'" + ." AND u_password=ENCRYPT('$oldpass', '$user')"; + + $result = sqlWriteQuery ($query); + if ($result === null) { + echo "

Sorry, couldn't talk to the database. Nothing changed.

"; + } elseif ($result === false) { + echo "

Something went wrong, MySQL said '$sqlError'.

"; + } elseif ($result == 0) { + echo "

Your old password was entered incorrectly, or was the same as the old one.

"; + } elseif ($result == 1) { + echo "

Your password has been changed.

"; + } else { + echo "

Uh oh, SERIOUSLY bad mojo. Find Deek ASAP!

"; + } + } else { + echo $passwdError; + } + } else { + ?> +
+

Old Password:

+

New Password:

+

Confirm:

+ + +
+ diff --git a/parts/member_stuff.inc b/parts/member_stuff.inc index 9cc4113..50dd716 100644 --- a/parts/member_stuff.inc +++ b/parts/member_stuff.inc @@ -5,6 +5,7 @@ ?>

News: [ Post ]

Plan: [ Post ]

+

Password: [ Change ]