From f08eb1640388e1f067102a22ec40c30f263d92c6 Mon Sep 17 00:00:00 2001 From: Jesse Morgan Date: Thu, 2 Jun 2011 16:17:25 -0700 Subject: Added user management --- htdocs/moderate/account.php | 58 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) (limited to 'htdocs/moderate/account.php') diff --git a/htdocs/moderate/account.php b/htdocs/moderate/account.php index 5fc87db..ac28b4e 100644 --- a/htdocs/moderate/account.php +++ b/htdocs/moderate/account.php @@ -10,11 +10,69 @@ require_once('../src/base.inc.php'); +$error = ''; + +// Handle form? +if ($_SERVER['REQUEST_METHOD'] == 'POST') { + $user = $_SESSION['currentUser']; + + // Change password + if (isset($_POST['oldpassword']) and trim($_POST['oldpassword']) != "" + and isset($_POST['newpassword']) and trim($_POST['newpassword']) != "" + and isset($_POST['newpassword2']) and trim($_POST['newpassword2']) != "") { + + if ($user->authenticate($_POST['oldpassword'])) { + if ($_POST['newpassword'] == $_POST['newpassword2']) { + $user->setPassword($_POST['newpassword']); + + } else { + $error .= '

Passwords do not match.

'; + } + } else { + $error .= '

"Old Password" does not match your current password.

'; + } + } + + // Set Notify + $notify = isset($_POST['notify']) and $_POST['notify'] == '1'; + $user->setNotify($notify); + + $user->save(); +} + + require_once('src/header.inc.php'); echo "

Your Account

"; +if ($error != '') { + echo "
$error
"; +} +?> + +
+

To change your password, enter your old and new passwords +below.

+

+

+

+ +
+

+
+ +

+ +
+ +