function authenticate() { $controller = new Controller(); $uname = $_POST['user']; $pwd = $_POST['pwd']; $result = $controller->checkLogin($uname, $pwd); if (!$result) { header('location: login.php'); exit; } session_start(); // the result is Admin Object, successfully logged in, the sessions start $_SESSION['user'] = $result; header('location: admin/manageDevices.php'); exit; }
public function resetPasswd() { parent::checkLogin(); if (isset($_POST['send'])) { $model = new UserModel(); $model->stuId = $_SESSION['ticeStuId']; $model->oldPassword = sha1(trim($_POST['oldPassword'])); $model->password = sha1(trim($_POST['password'])); if ($model->resetPasswd()) { Tool::alert('密码修改成功'); } else { Tool::alertBackNoRefresh('原密码不正确或密码修改失败:('); } } $this->render('site/resetPasswd'); }