// autoloader code // loads classes as needed, eliminates the need for a long list of includes at the top spl_autoload_register(function ($className) { $possibilities = array('../controllers' . DIRECTORY_SEPARATOR . $className . '.php', '../back_end' . DIRECTORY_SEPARATOR . $className . '.php', '../views' . DIRECTORY_SEPARATOR . $className . '.php', $className . '.php'); foreach ($possibilities as $file) { if (file_exists($file)) { require_once $file; return true; } } return false; }); $controller = new register(); if (!is_null($_GET['adminreset'])) { $username = $_GET['username']; $controller->resetPassword($username); } if (isset($_POST['reset'])) { $username = $_POST['username']; // old password is md5'd to allow checking with db $oldpassword = md5($_POST['oldpwd']); // new password will be md5'd in back-end code $newpassword = $_POST['newpwd']; if ($username == "") { echo "<p>Please complete all fields and try again.</p>"; //exit("Please complete all fields and try again."); } if ($controller->getPassword($username) != $oldpassword) { echo "<p>Your old password is incorrect.</p>"; //exit("Your old password is incorrect."); } else {