_docOpts = $docOpts; parent::Auth($DBObj); } function login($user) { require_once('class/Session.php'); $user['password'] = md5($user['password']); $user = $this->DBObj->DBLogin($user); if ($user) { Session::setData($this->ses_arr_name, $this->ses_arr_name, $user); require_once('class/HTTP.php'); $url = $this->getLogin2(); if ($url == '') { $url = BASE_URL . '/' . str_replace('/login', '', CURR_PAGE); } skHTTP::redirect($url); return true; } else { return array('login' => 'Bad login or password'); } } function getLoginForm(&$Doc) { if ($this->isFocusLogin){ $Doc->addItemProp('initFuncs', "function(){ document.getElementsByName('login')[0].focus(); }"); } require_once 'class/Form/Form.class.php'; $form = new Form($Doc, 'sssssssssss'); $form->addFormRule(array(&$this, 'login')); $form->setTitle(''); require_once('class/Session.php'); $login = Form::createElement('text', 'login', 'Username', array('class' => 'inp_login', 'value' => Session::getData(CURR_PAGE, 'login') ) ); $form->addElement($login); $form->setCancelType(FORM_CBT_RESET); $password =& Form::createElement('password', 'password', 'Password', array('class' => 'inp_login')); $form->style_pref = 'login_'; $form->addElement($password); $password->setValue(''); $action = Form::createElement('hidden', 'action', 'login'); $form->addElement($action); $form->cancelTitle = 'Reset'; $form->submitTitle = 'Login'; $els = Form::createElement('link', 'link', null, BASE_URL.'/forgot.html', 'forgot your password?'); $form->addElement($els); return $form; } function getLogin2() { $login = BASE_URL.'/login'; $ref = $_SERVER['HTTP_REFERER']; $goto_to = $ref; $goto_to = strpos($goto_to, $login) === false ? $goto_to : BASE_URL."/"; $goto_to = strpos($goto_to, 'check_email.html') === false ? $goto_to : BASE_URL."/"; return $goto_to; } function getData($key = null) { require_once('class/Session.php'); $arr = Session::getData($this->ses_arr_name, $this->ses_arr_name); if ($arr) { $arr = $this->DBObj->DBLogin($arr); } else { $arr = array(); } if ($key != null && array_key_exists($key, $arr)) { return $arr[$key]; } return $arr; } } ?>