public function index() { $user = user::active(); user::logout(); log::info("user", t("User %name logged out", array("name" => $user->name)), html::anchor("user/{$user->id}", $user->name)); if ($this->input->get("continue")) { url::redirect($this->input->get("continue")); } }
public function action_logout() { if (user::logout()) { notes::info('You have been logged out. See ya!'); user::redirect(''); } else { notes::error('An error occured and you could not be logged in.'); user::redirect(''); } }
public function logoutAction() { user::logout(false); if (system::isAjax()) { system::json(array('error' => 0)); } else { if (!empty($_POST['back_url'])) { system::redirect($_POST['back_url'], true); } else { system::redirect('/'); } } }
public function index() { access::verify_csrf(); $user = user::active(); user::logout(); log::info("user", t("User %name logged out", array("name" => p::clean($user->name))), html::anchor("user/{$user->id}", p::clean($user->name))); if ($this->input->get("continue")) { $item = url::get_item_from_uri($this->input->get("continue")); if (access::can("view", $item)) { url::redirect($this->input->get("continue")); } else { url::redirect(""); } } }
public function index() { //access::verify_csrf(); $user = user::active(); user::logout(); log::info("user", t("User %name logged out", array("name" => p::clean($user->name))), html::anchor("user/{$user->id}", p::clean($user->name))); if ($continue_url = $this->input->get("continue")) { $item = url::get_item_from_uri($continue_url); if (access::can("view", $item)) { // Don't use url::redirect() because it'll call url::site() and munge the continue url. header("Location: {$continue_url}"); } else { url::redirect("albums/1"); } } }
function login($login, $password) { user::logout(); if (!($record = user::_get_identity_record($login, $password))) { return false; } user::_set_session_attribute('is_logged_in', true); user::_set_session_attribute('id', $record['id']); user::_set_session_attribute('node_id', $record['node_id']); user::_set_session_attribute('login', $login); user::_set_session_attribute('email', $record['email']); user::_set_session_attribute('name', $record['name']); user::_set_session_attribute('lastname', $record['lastname']); user::_set_session_attribute('password', $record['password']); user::_set_session_groups(); return true; }
public static function loginAuth($from) { //check token remember me //check session $db = new database(DBTYPE, DBHOST, DBNAME, DBUSER, DBPASS); if (cookie::exists(TOKEN_NAME)) { $token = cookie::get(TOKEN_NAME); $checkExist = user::checkExist("users_session", "token = '{$token}'"); if ($checkExist) { $sessionData = $db->select("users_session", "*", "token = '{$token}'", "fetch"); $agent_id = $sessionData['agent_id']; user::login($agent_id); $userData = $db->select("user_accounts", "*", "agent_id = '{$agent_id}'", "fetch"); if ($from == 'login') { self::accountCheck($userData); redirect::to("dashboard"); } else { self::accountCheck($userData); } } else { user::logout(); } } elseif (session::exist(AGENT_LOGIN_SESSION) && session::exist(AGENT_SESSION_NAME)) { $agent_id = session::get(AGENT_SESSION_NAME); $check_agentExist = user::checkExist("user_accounts", "agent_id = '{$agent_id}'"); $userData = $db->select("user_accounts", "*", "agent_id = '{$agent_id}'", "fetch"); if (!$check_agentExist) { user::logout(); } user::login($agent_id); if ($from == 'login') { self::accountCheck($userData); redirect::to("dashboard"); } else { self::accountCheck($userData); } } else { if ($from != 'login') { user::logout(); } } }
function ___onTarget() { if ($_REQUEST['action'] == 'register') { $GLOBALS['core']->event('register'); //validation if (empty($_REQUEST['username'])) { $GLOBALS['err']->add("Name can't be blank.", array('username', 'register')); } if (user::exists($_REQUEST['username'])) { $GLOBALS['err']->add("Name already exists. choose another.", array('username', 'register')); } if (empty($_REQUEST['password1'])) { $GLOBALS['err']->add("Password can't be blank.", array('password1', 'register')); } elseif ($_REQUEST['password1'] != $_REQUEST['password2']) { $GLOBALS['err']->add("Passwords don't match.", array('password2', 'register')); } elseif ($_REQUEST['password1'] == $_REQUEST['password2'] && $GLOBALS['err']->none()) { //logout first, just in case if (user::whoAmI() == 'temp') { user::logout(); } if (user::register($_REQUEST['username'], $_REQUEST['password1'])) { session_regenerate_id(); //sort of prevent session-hijacking $_REQUEST['password'] = $_REQUEST['password1']; $_REQUEST['action'] = 'login'; $GLOBALS['state'] = 'successful registration'; $GLOBALS['core']->event('registrationSuccess'); } else { $GLOBALS['err']->add("Unable to register for some reason. Please let us know about it.", 'registration'); $GLOBALS['core']->event('registrationFailure'); } } } if ($_REQUEST['action'] == 'login') { $GLOBALS['core']->event('login'); if (empty($_REQUEST['username'])) { $GLOBALS['err']->add("You left out the name.", array('username', 'login')); } if (empty($_REQUEST['password'])) { $GLOBALS['err']->add("You left out the password.", array('password', 'login')); } if (!empty($_REQUEST['username']) && !empty($_REQUEST['password'])) { if (!user::login($_REQUEST['username'], $_REQUEST['password'])) { $GLOBALS['err']->add("Wrong.", 'login'); } else { $loginSuccess = true; session_regenerate_id(); //prevent session hijacking. } } $GLOBALS['core']->event($loginSuccess ? 'loginSuccess' : 'loginFailure'); } if ($_REQUEST['action'] == 'logout') { $GLOBALS['core']->event('logout'); session_regenerate_id(true); //kill old session. user::logout(); header("Location: /"); exit; } if (!user::loggedIn()) { //login as temp user //user::loginTemp(); } }
public function logout() { user::logout(); }
function onLogoutBtn($info) { $u = new user(""); $u->logout(); $this->balance = 0; $this->_bookframe("frmMain"); }
<?php //Для класса User из предыдущего занятия создать методы login(), logout(), которые просто выводят на экран соответствующее сообщение. Создать экземпляр класса, вызвать созданные методы. class user { public $login; public $password; public $email; public $rating = 0; public function login() { echo "Login is " . $this->login . "<br>"; } public function logout($something) { echo "Something about logout - " . $something; } } $Max = new user(); $Max->login = "******"; $Max->login(); $Max->logout("blablabla");
function _clean_up() { parent::_clean_up(); purge_cache(); user::logout(); }
public function API_logout() { user::logout(); iPHP::code(1, 0, $this->forward, 'json'); }
function tearDown() { $this->_clean_up(); debug_mock::tally(); user::logout(); }
ob_start(); //get unique id $up_id = uniqid(); ?> <?php include_once 'config.inc.php'; session_start(); include_once 'classes/Users.class.php'; $usr = new user(); $usr->check_login(); $usr->check_if_logged(); if (isset($_GET['l'])) { unset($_GET['l']); $usr->logout(); } ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link rel="stylesheet" type="text/css" href="styles/style_admin.css" /> <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" /> <!-- <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" /> --> <title>kerwa.pl</title> </head> <body>
<?php include "php/user.php"; $login = new user(); $login->logout(); header("location: index.php");
public function defAction() { // Устанавливаем статус системы "в режиме администрирования". system::$isAdmin = true; page::$macros = 0; // Попытка авторизации if (!empty($_POST['enter'])) { if (!user::auth($_POST['login'], $_POST['passw'])) { $this->showAuthForm(1); } else { header("Location: " . $_SERVER["HTTP_REFERER"]); } } // Если пользователь не админ, показываем форму авторизации if (!user::isAdmin()) { $this->showAuthForm(); } // Определяем текущий домен domains::curDomain(); // Выход из системы if (system::issetUrl(0) && system::url(0) == 'logout') { user::logout(); } if (system::url(0) == 'showhide') { $_SESSION['SH_FIELDS'] = system::url(1) == 0 ? 'hide' : 'show'; system::stop(); } // Обработка запросов от поля ObjectLinks ui::checkObjectLinks(); system::$defTemplate = MODUL_DIR . '/mpanel/template/default.tpl'; // Определяем модуль if (!system::issetUrl(0)) { system::setUrl(0, user::getDefModul()); } // Если есть ссылка на обработчик формы if (!empty($_POST['right'])) { system::setUrl(1, system::POST('right', isVarName)); } // Определяем право if (system::issetUrl(1)) { // Проверяем существует ли указанное право if (user::issetRight(system::url(1))) { $currRight = system::url(1); } else { if (user::issetRight(str_replace('_proc', '', system::url(1)))) { $currRight = system::url(1); } } } else { // Пытаемся найти право по умолчанию $def_right = user::getDefaultRight(system::url(0)); if ($def_right) { $currRight = $def_right; system::setUrl(1, $def_right); } } $this->getMenu(); page::assign('current_url', system::getCurrentUrl()); page::assign('admin_url', system::au()); if (!empty($currRight)) { // Определяем имя и метод контролера $pos = strpos($currRight, '_'); if ($pos) { $class_name = '__' . substr($currRight, 0, $pos); $action_name = substr($currRight, $pos + 1, strlen($currRight) - $pos); } else { $class_name = '__' . $currRight; $action_name = 'defAction'; } $mod_name = MODUL_DIR . '/' . system::url(0) . '/' . $class_name . '.php'; // Пытаемся подгрузить модуль if (file_exists($mod_name)) { include $mod_name; if (file_exists(MODUL_DIR . '/' . system::url(0) . '/lang-ru.php')) { include MODUL_DIR . '/' . system::url(0) . '/lang-ru.php'; } ui::setHeader(lang::right($currRight)); if (class_exists($class_name)) { eval('$c = new ' . $class_name . '();'); if (ui::$stop) { $content = '.'; } else { if (method_exists($c, $action_name)) { $content = call_user_func(array($c, $action_name)); } } } } if (empty($content)) { $msg = lang::get('TEXT_PROC_NOTFOUND2') . '<br />' . system::getCurrentUrl() . '<br /><br /> ' . lang::get('TEXT_PROC_NOTFOUND3') . '<br />' . $mod_name . '<br /><br /> ' . lang::get('TEXT_PROC_NOTFOUND4'); system::log(lang::get('TEXT_PROC_NOTFOUND') . ' ' . system::getCurrentUrl()); ui::MessageBox(lang::get('TEXT_PROC_NOTFOUND'), $msg); system::redirect('/'); } } else { system::log(lang::get('TEXT_ERROR_RIGHT_LOG') . system::getCurrentUrl()); ui::MessageBox(lang::get('TEXT_ERROR_RIGHT'), lang::get('TEXT_ERROR_RIGHT2')); system::redirect('/'); } //Производим сжатие страницы if (reg::getKey('/config/gzip')) { $PREFER_DEFLATE = false; $FORCE_COMPRESSION = false; $AE = isset($_SERVER['HTTP_ACCEPT_ENCODING']) ? $_SERVER['HTTP_ACCEPT_ENCODING'] : $_SERVER['HTTP_TE']; $support_gzip = strpos($AE, 'gzip') !== FALSE || $FORCE_COMPRESSION; $support_deflate = strpos($AE, 'deflate') !== FALSE || $FORCE_COMPRESSION; if ($support_gzip && $support_deflate) { $support_deflate = $PREFER_DEFLATE; } if ($support_deflate) { header("Content-Encoding: deflate"); ob_start("compress_output_deflate"); } else { if ($support_gzip) { header("Content-Encoding: gzip"); ob_start("compress_output_gzip"); } else { ob_start(); } } } return ui::getMainHTML($content); }
<?php session_start(); require_once "../../models/user/index.php"; $user = new user(); require_once "../connection/connect.php"; $cnct = new cnct_class(); $cnx = $cnct->cnct(); $data['id'] = $_SESSION['control_p_login_id']; $data['cnx'] = $cnx; if ($user->logout($data)) { if (session_destroy()) { header('Location:../../index/index.php'); } else { header('Location:../../index/index.php?note=Please Try Again'); } } else { header('Location:../../index/index.php?note=Please Try Again'); }
} else { //verify if (user::changePassword($_SESSION['username'], $_POST['password_old'], $_POST['password_new'])) { echo "Password changed successfully. <br/>"; misc::redirect('?pg=ucp', 1); } else { echo "Invalid old password specified.<br/>"; misc::back(); } } } else { core::$ucp->showChangepwForm(); } break; case 'logout': if (user::logout()) { echo "Successfully logged out. Redirecting.<br/>"; misc::redirect('?pg=news', 1); } else { echo "Failed to logout.<br/>"; } break; case 'refferals': if ($core->aConfig['allowRefferals'] == 0) { echo "This module is currently disabled."; return; } $hQuery = mssql_query("select invitedUserJID,time,bonusAdded from srcms_refferals where reffererJID='" . user::accountJIDbyUsername($_SESSION['username']) . "'"); $nCount = core::$sql->numRows("select * from srcms_refferals where reffererJID='" . user::accountJIDbyUsername($_SESSION['username']) . "'"); echo "You can reffer [<b>" . $core->aConfig['maxRefAccIP'] . "</b>] accounts with same ip address [limit].<br/><br/>"; if ($nCount == 0) {
<?php session_start(); require_once $_SERVER['DOCUMENT_ROOT'] . "/common/class/user.class.php"; $userObj = new user(); $userObj->logout(); header("Location: " . "http://" . $_SERVER['HTTP_HOST'] . "/index.php");
<?php require_once "../apps/User.php"; $u = new user(); $u->logout(); header("Location: login.php");
function logout() { return user::logout(); }
public function action_logout() { user::logout(); }
function logout() { $agent_id = session::get(AGENT_SESSION_NAME); user::logout($agent_id); }
<?php $template = 'user_edit.html'; if ($_view == 'logout') { user::logout(); $template = 'index.html'; } elseif ($_view == 'user_register') { $template = 'user_register.html'; } elseif ($_view == 'edit') { $template = 'user_edit.html'; } elseif ($_view == 'password_edit') { $template = 'user_edit_password.html'; } elseif ($_view == 'activate_email') { user::activate_email($_GET['key']); $_notice = array('title' => '邮箱激活成功', 'content' => '现在可以设置一个抓取计划或者复制别人的抓取计划', 'button' => '点击这里开始', 'url' => '/'); $template = 'notice.html'; } elseif ($_view == 'weibo_login') { include 'saetv2.ex.class.php'; $sae_oauth = new SaeTOAuthV2(WB_AKEY, WB_SKEY); $login_url = $sae_oauth->getAuthorizeURL(WB_CALLBACK_URL); header("Location:{$login_url}"); exit; } elseif ($_view == 'qq_login') { include INCLUDES_PATH . 'qqapi/qqConnectAPI.php'; $qc = new QC(); $qc->qq_login(); exit; } if (isset($_POST['email']) || isset($_POST['password'])) { if (isset($_POST['email'])) { if (!$_POST['email_notify']) {
$msg = $user->register($_POST['username'], $_POST['email'], $_POST['password'], $_POST['password2']); break; case 'login': $msg = $user->login($_POST['username'], $_POST['password']); break; } } else { if ('register' == $action) { die("You are already registered"); } switch ($action) { default: $msg = returnError("Action not found: {$action}"); break; case 'logout': $msg = $user->logout(); break; case 'viewUserList': if ($user->isAdmin()) { $include = 'admin/userList'; } else { $msg = returnError("Access denied"); } break; case 'activateUser': if ($user->isAdmin()) { $msg = $user->activateUser($_GET['user']); $include = 'admin/userList'; } else { $msg = returnError("Access denied"); }
function action($_arg) { //------------------------------------------------------------------------------ // extrace action from coordinate system while ($entry = each($_arg)) { $argArray = explode("_", $entry[key]); if (count($argArray) > 1) { $indexString = $argArray[0]; $valueString = $argArray[1]; $_arg[$indexString] = $valueString; if (isset($argArray[2])) { $_arg['_ID'] = $argArray[2]; } } } //echoalert($_arg); //echoalert($_SESSION); //------------------------------------------------------------------------------ // parse reset value if ($_arg[reset]) { $_arg = array(); session::destroy(searchshow); session::destroy(show); session::destroy(search); session::destroy(searchtype); session::destroy(searchcom); session::destroy(searchorder); session::destroy(searchString); session::destroy(searchexact); session::destroy(searchstart); session::destroy(searchowner); session::destroy(searchentrytype); session::destroy(searchstatus); } //------------------------------------------------------------------------------ // parse action parameter switch ($_arg[action]) { //------------------------------------------------------------------------------ // login / out case login: // login user user::login($_arg[user], $_arg[password]); // restore program status if new session restore_status(); // reset linking session::destroy("linkaction"); session::destroy("link"); break; case logout: // logout user user::logout(); break; case changedo: // change password if ($password = $_GET[password]) { database::query("UPDATE user SET password='******' WHERE ID='" . session::get("user") . "'"); echojavascript("Passwort erfolgreich geändert"); } break; //------------------------------------------------------------------------------ // inherit entrytype to children //------------------------------------------------------------------------------ // inherit entrytype to children case inherit: $childArray = thesaurus::get_child($_arg[id]); foreach ($childArray as $entry) { database::query("UPDATE entry SET entrytype={$_arg['entrytype']} WHERE ID={$entry}"); } break; //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ case update: if ($_arg[orderdefault]) { session::set(orderdefault, $_arg[id]); } elseif (isset($_arg[orderdefault])) { session::destroy(orderdefault); } break; //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ case edit: session::set("edit", TRUE); session::set("show", $_arg[id]); session::destroy("searchshow"); break; case noedit: session::destroy("edit"); break; //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ case open: session::open($_arg[id]); break; case close: session::close($_arg[id]); break; case closeall: session::close_all(); break; //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ case deleteid: end_link(); hide(); database::delete($_arg[id]); break; //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ case suchen: if (!$_arg[searchString] and ($_arg[searchowner] or $_arg[searchtype] or $_arg[searchstatus])) { $_arg[searchString] = "%"; } if ($_arg[searchString]) { session::set("searchshow", true); } // show search result session::set("search", $_arg[searchString]); session::set("searchcom", $_arg[searchcom]); session::set("searchorder", $_arg[searchorder]); session::set("searchentrytype", $_arg[searchentrytype]); session::set("searchstatus", $_arg[searchstatus]); if ($_arg[searchowner]) { session::set("searchowner", $_arg[searchowner]); } else { session::destroy("searchowner"); } switch ($_arg[searchtype]) { case 0: session::destroy("searchexact"); session::destroy("searchstart"); break; case 1: session::destroy("searchexact"); session::set("searchstart", TRUE); break; case 2: session::destroy("searchstart"); session::set("searchexact", TRUE); break; } break; case hidesearch: session::destroy(searchshow); break; //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ case show: session::destroy("searchshow"); $_arg[linkaction] = ""; if ($_arg[id] == NULL) { break; } elseif ($_arg[id] > 0) { session::set("show", $_arg[id]); break; } else { session::delete("show"); break; } break; //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ case swap: if ($_arg[id]) { thesaurus::swap_link($_arg[id], $_arg[_ID]); } break; case change: if ($_arg[id]) { // thesaurus::change_link($_arg); } break; case add: // add new descriptor session::destroy("show"); session::destroy("searchshow"); // session::set("",1); break; // clean database // clean database case correct: thesaurus::validate(true); echoalert("Datenbank bereinigt"); break; //------------------------------------------------------------------------------ // open hyrarchy down to selected entry //------------------------------------------------------------------------------ // open hyrarchy down to selected entry case showhyrarchy: if ($_arg[id]) { $hyrarchyArray = thesaurus::get_hyrarchy($_arg[id]); // don't open selected entry // array_pop($hyrarchyArray); foreach ($hyrarchyArray as $entry) { // echo $entry . " "; echo session::open($entry); } session::set("hyrarchy", TRUE); // hide search window session::destroy("searchshow"); // if nothing selected for display, show ID if (!session::get(show)) { session::set("show", $_arg[id]); } break; } //------------------------------------------------------------------------------ // debug on/off //------------------------------------------------------------------------------ // debug on/off case debugon: system::setval(debug, TRUE); break; case debugoff: system::setval(debug, FALSE); // legend on/off // legend on/off case legendon: session::set("legend", TRUE); break; case legendoff: session::destroy("legend"); break; // display / hide non descriptors // display / hide non descriptors case toggleND: if (session::get("descriptor")) { session::destroy("descriptor"); } else { session::set("descriptor", TRUE); } break; // display / hide orders // display / hide orders case toggleVI: if (session::get("visible")) { session::destroy("visible"); } else { session::set("visible", TRUE); } break; // toggle tooltips on/off // toggle tooltips on/off case off: session::set("tooltips", TRUE); break; case on: session::destroy("tooltips"); break; // toggle hyrarchy // toggle hyrarchy case hyrarchyon: session::set("hyrarchy", TRUE); break; case hyrarchyoff: session::set("hyrarchy", FALSE); break; } //------------------------------------------------------------------------------ // parse linkaction parameter switch ($_arg[linkaction]) { // link case link: session::set("link", $_arg[id]); session::set("linkaction", $_arg[linkaction]); session::set("linktype", $_arg[linktype]); break; // execute linking // execute linking case linkdo: switch (session::get('linkaction')) { case link: database::parent_insert(session::get("link"), $_arg[id], session::get("linktype")); session::set("show", session::get("link")); // set display to linked objects // with BS set linked descriptor to "no descriptor" if (session::get("linktype") == 2) { database::set_desc($_arg[id], 0); } // session::destroy("link"); // end linking break; case change: database::link_change(session::get('linkparent'), session::get('link'), $_arg['id']); // parent,oldlink,newlink break; } break; case linkend: end_link(); break; // unlink // unlink case unlink: if ($_arg[id]) { database::parent_delete(session::get("show"), $_arg[id]); } break; // change OB // change OB case change: if ($_arg[id]) { session::set("link", $_arg[id]); session::set("linkaction", $_arg[linkaction]); session::set("linkparent", $_arg[_ID]); session::set("linktype", $_arg[linktype]); } break; } // TEMP SETTINGS // if not link rights, set descriptor and visible to true if (!right::link()) { session::set(descriptor, FALSE); } //if (!right::link()) session::set(visible,TRUE); // save program status save_status($_SESSION); }
function test_logout() { user::login('vasa', '1'); user::logout(); $this->assertFalse(user::is_logged_in()); }
<?php require_once '/opt/lampp/htdocs/MySpace/src/init.php'; $user = new user(); $user->logout(); redirect::to('login.php');
$json .= $user->login('Stupid', 'test'); //Fail var_dump($user); $user = ''; $user = new user(); $json .= $user->login('First User', 'test'); echo "<em>First User Session</em>"; var_dump($_SESSION); echo "<em>First User Admin Test</em>"; var_dump($user->isAdmin()); //True //Pass var_dump($user); $user = ''; $user = new user(); $json .= $user->logout(); session_start(); //Pass var_dump($user); $user = ''; $user = new user(); $json .= $user->login('foo', 'test'); echo "<em>Login failure session</em>"; var_dump($_SESSION); echo "<em>Login failure admin check</em>"; var_dump($user->isAdmin()); //False //Fail var_dump($user); $user = ''; $user = new user();