1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-07-03 06:55:03 +03:00
ifhub.club/classes/actions/ActionLogin.class.php
2008-09-21 06:36:57 +00:00

83 lines
2.1 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?
/*-------------------------------------------------------
*
* LiveStreet Engine Social Networking
* Copyright © 2008 Mzhelskiy Maxim
*
*--------------------------------------------------------
*
* Official site: www.livestreet.ru
* Contact e-mail: rus.engine@gmail.com
*
* GNU General Public License, version 2:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
---------------------------------------------------------
*/
/**
* Обрабатывые авторизацию
*
*/
class ActionLogin extends Action {
/**
* Инициализация
*
*/
public function Init() {
$this->SetDefaultEvent('index');
}
/**
* Регистрируем евенты
*
*/
protected function RegisterEvent() {
$this->AddEvent('index','EventLogin');
$this->AddEvent('exit','EventExit');
}
/**
* Обрабатываем процесс залогинивания
*
*/
protected function EventLogin() {
/**
* Если нажали кнопку "Войти"
*/
if (isset($_REQUEST['submit_login'])) {
/**
* Проверяем есть ли такой юзер по логину
*/
if ($oUser=$this->User_GetUserByLogin(getRequest('login'))) {
/**
* Сверяем хеши паролей и проверяем активен ли юзер
*/
if ($oUser->getPassword()==func_encrypt(getRequest('password')) and $oUser->getActivate()) {
/**
* Авторизуем
*/
$this->User_Authorization($oUser);
/**
* Перенаправляем на страницу с которой произошла авторизация
*/
$sBackUrl=$_SERVER['HTTP_REFERER'];
if (strpos($sBackUrl,DIR_WEB_ROOT.'/login')===false) {
func_header_location($sBackUrl);
} else {
func_header_location(DIR_WEB_ROOT.'/');
}
}
}
$this->Viewer_Assign('bLoginError',true);
}
$this->Viewer_AddHtmlTitle('Вход на сайт');
}
/**
* Обрабатываем процесс разлогинивания
*
*/
protected function EventExit() {
$this->User_Logout();
$this->Viewer_Assign('bRefreshToHome',true);
}
}
?>