У меня в приложении используется такой вход
Код: Выделить всё
//----------------------------------------------------------------------------------------- function isLoggedIn() { return $this->userid; } //----------------------------------------------------------------------------------------- function login($login, $password) { $this->userid = null; if($login && $password) { $encode_type = $this->constArr['encode_type']; $pass = $password; switch( $encode_type ) { case 'md5' : $pass = md5($password); break; default : $pass = $password; break; } //Try to find user using provided login if(($rs = $this->loginStmt->process($login)) && ($rec = $rs->next())) { if($rec[$this->constArr['password']] == $pass) { $this->userid = $rec[$this->constArr['id']]; } } else { //If not - autocreate user with such login and password if($this->autocreateUsers) { //$roles = ($password == $GLOBALS['fc_config']['adminPassword'])?ROLE_ADMIN:($GLOBALS['fc_config']['liveSupportMode']?ROLE_CUSTOMER:ROLE_USER); $ins = $this->addUserStmt->process($login, $pass); if( $ins != null && $ins == 0 ) { //we not know if id field is autoincrement $this->userid = login($login, $password); } elseif($ins != null) { $this->userid = $ins; } } } } return $this->userid; } //----------------------------------------------------------------------------------------- function logout() { if($this->constArr['logoff'] == 'true') $this->user = null; } //-----------------------------------------------------------------------------------------
Помогите!