本文整理匯總了PHP中session::exist方法的典型用法代碼示例。如果您正苦於以下問題:PHP session::exist方法的具體用法?PHP session::exist怎麽用?PHP session::exist使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類session
的用法示例。
在下文中一共展示了session::exist方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: check
public static function check($token)
{
$tokenName = TOKEN_NAME;
if (session::exist($tokenName) && $token === session::get($tokenName)) {
session::delete($tokenName);
return TRUE;
}
return FALSE;
}
示例2: loginAuth
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();
}
}
}
示例3: __construct
function __construct()
{
session::init();
$this->breadcrumb = new breadcrumb();
$this->view = new view();
$this->_userProfileImages = IMAGES_PATH . "user-default.png";
if (session::exist(AGENT_SESSION_NAME) and session::exist(AGENT_LOGIN_SESSION)) {
$agent_id = session::get(AGENT_SESSION_NAME);
$userData = new user();
// USERDATA
$this->_userData = $userData->getUserData('agent_id', $agent_id);
$user = $this->_userData;
// USER ACC. TYPE
$userAccType = user::getAccType($user['acc_type']);
$this->_userAccType = $userAccType['label'];
// PROFILE IMAGE
$profileImageExist = user::checkExist("user_images", "agent_id = '{$agent_id}' AND profile = '1'");
if ($profileImageExist) {
$image = user::getUserImages($agent_id, TRUE);
$this->_userProfileImages = IMAGES_PATH . "users/" . $image['filename'];
}
// AVAILABLE COMMISSION
$this->_availableCommission = user::getAvailableComm($agent_id);
// BADGE
$countAccPaymentBadge = user::countBadge("user_payment", "status = '0'");
$this->_accPaymentBadge = $countAccPaymentBadge > 0 ? $countAccPaymentBadge : "";
$countWithdrawalBadge = user::countBadge("user_withdrawal", "status = '0' OR status = '1'");
$this->_withdrawalBadge = $countWithdrawalBadge > 0 ? $countWithdrawalBadge : "";
// $countMessageBadge = user::countBadge("user_messages", "agent_id = '$agent_id' AND status = '0'");
// $this->_messageBadge = ($countMessageBadge > 0) ? $countMessageBadge : "";
}
$this->view->_userData = $this->_userData;
$this->view->_userAccType = $this->_userAccType;
$this->view->_userProfileImages = $this->_userProfileImages;
$this->view->_availableCommission = $this->_availableCommission;
// BADGE
$this->view->_accPaymentBadge = $this->_accPaymentBadge;
$this->view->_withdrawalBadge = $this->_withdrawalBadge;
// $this->view->_messageBadge = $this->_messageBadge;
}