コード例 #1
0
ファイル: userReset.php プロジェクト: hashimmm/sux0r
 /**
  * Process the form
  *
  * @param array $clean reference to validated $_POST
  */
 function formProcess(&$clean)
 {
     // Captcha
     unset($_SESSION['captcha']);
     unset($clean['captcha']);
     $user = $this->user->getByEmail($clean['user']);
     if (!$user) {
         throw new Exception('Invalid user?!');
     } elseif (@$user['banned']) {
         // Banned user, abort
         suxUser::killSession();
         suxFunct::redirect(suxFunct::makeUrl('/banned'));
     }
     // Array
     $reset_user = array();
     $reset_user['nickname'] = $user['nickname'];
     $reset_user['password'] = $this->user->generatePw();
     $reset_user_id = $user['users_id'];
     // Email
     $subject = "{$GLOBALS['CONFIG']['TITLE']}: {$this->r->gtext['reset_mail_1']} {$reset_user['nickname']}";
     $message = "{$this->r->gtext['reset_mail_2']}:\n\n{$reset_user['password']}\n\n";
     $message .= "{$this->r->gtext['reset_mail_3']}: {$_SERVER['REMOTE_ADDR']}\n\n";
     $message .= "---\n" . suxFunct::makeUrl('/', null, true) . "\n\n";
     // Do the dirty
     $this->user->save($reset_user_id, $reset_user);
     mb_send_mail($user['email'], $subject, $message);
 }
コード例 #2
0
ファイル: userAuthenticate.php プロジェクト: hashimmm/sux0r
 /**
  * Logout
  */
 function logout()
 {
     // Don't kill session (with password failures, perhaps?) if the
     // user isn't actually logged in.
     if ($this->user->loginCheck()) {
         $this->log->write($_SESSION['users_id'], 'sux0r::userAuthenticate() logout', 1);
         // Log, private
         suxUser::killSession();
     }
     // Ask browser to clear authentication
     header('HTTP/1.0 401 Unauthorized');
     header('WWW-Authenticate: Invalid');
     $this->r->title .= " | {$this->r->gtext['logout']}";
     // Template
     $this->tpl->display('logout.tpl');
 }