private static function _startSession() { if (!self::$_start) { session_start(); self::$_start = true; return true; } }
public function login($username, $password) { //检查用户是否存在 $userInfo = $this->_getUserByName($username); if (empty($userInfo)) { throw new Exception("error"); } //检查password是否正确 if ($userInfo["password"] != $password) { throw new Exception("error"); } //如果存在 获取用户 放入session WF_Session::Set(self::SESSION_KEY_USER, $userInfo); }
require './config.php'; if (isset($_GET['act'])) { switch ($_GET['act']) { case 'login_check': WF_Auth::loginCheck(); break; case 'resetpasswd': WF_Auth::updateUserPassword(); break; case 'out': WF_Auth::loginOut(); break; case 'in': break; default: exit(WF_Session::get('login_error')); } } // $uhash = $_SESSION['wf_uhash'] = rand(1000, 9999); $error = wf_gpc('wf_error', 'S'); ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="renderer" content="webkit"> <title>站长附件上传下载管理平台 - Power By AdminSheng.com</title> <style type="text/css"> html { } body { color:#fff; font-size:14px; padding:0; overflow:hidden; margin:0; width:100%; height:100%; min-height:400px; background:#2784bd url(static/images/login/bg_line.gif) repeat-x left top; } #body { background:url(static/images/login/bg.jpg) no-repeat center top; }