本文整理汇总了PHP中cookie::exists方法的典型用法代码示例。如果您正苦于以下问题:PHP cookie::exists方法的具体用法?PHP cookie::exists怎么用?PHP cookie::exists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cookie
的用法示例。
在下文中一共展示了cookie::exists方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getReferral
public function getReferral()
{
$chkCookie = cookie::exists(COOKIE_SPONSOR_NAME);
if ($chkCookie) {
$referral = cookie::get(COOKIE_SPONSOR_NAME);
} else {
$referral = NULL;
}
return $referral;
}
示例2: getReferer
public function getReferer()
{
$chkCookie = cookie::exists(COOKIE_SPONSOR_NAME);
if ($chkCookie) {
$refID = cookie::get(COOKIE_SPONSOR_NAME);
$validRef = $this->db->count("user_accounts", "agent_id = '{$refID}'");
if ($validRef != 0) {
$return = $refID;
} else {
cookie::delete(COOKIE_SPONSOR_NAME);
$return = FALSE;
}
return cookie::get(COOKIE_SPONSOR_NAME);
} else {
$return = FALSE;
}
return $return;
}
示例3: 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();
}
}
}
示例4: s
public function s($sponsor)
{
$userData = user::checkExist("user_accounts", "agent_id = '{$sponsor}' or username = '{$sponsor}'");
if ($userData == 1) {
$getUserData = $this->db->select("user_accounts", "agent_id, username", "agent_id = '{$sponsor}' or username = '{$sponsor}'", "fetch");
$chkCookie = cookie::exists(COOKIE_SPONSOR_NAME);
if ($chkCookie) {
$cookieName = cookie::get(COOKIE_SPONSOR_NAME);
if ($cookieName != $getUserData['agent_id']) {
cookie::delete(COOKIE_SPONSOR_NAME);
cookie::set(COOKIE_SPONSOR_NAME, $getUserData['agent_id'], COOKIE_EXPIRY);
}
} else {
cookie::set(COOKIE_SPONSOR_NAME, $getUserData['agent_id'], COOKIE_EXPIRY);
}
} else {
cookie::delete(COOKIE_SPONSOR_NAME);
}
redirect::to(BASE_PATH, TRUE);
}
示例5: logout
public static function logout()
{
session::destroy();
$tokenExist = cookie::exists(TOKEN_NAME);
if ($tokenExist) {
$token = cookie::get(TOKEN_NAME);
try {
$db = new database(DBTYPE, DBHOST, DBNAME, DBUSER, DBPASS);
$data = $db->select("users_session", "*", "token = '{$token}'", "fetch");
$agent_id = $data['agent_id'];
$db->delete("users_session", "token = '{$agent_id}'");
cookie::delete(TOKEN_NAME);
} catch (Exception $ex) {
cookie::delete(TOKEN_NAME);
}
}
redirect::to("login");
}
示例6: session_start
<?php
session_start();
$GLOBALS['config'] = array('mysql' => array('host' => '127.0.0.1', 'username' => 'root', 'password' => 'Linode@11334455', 'db' => 'Booking'), 'remember' => array('cookie_name' => 'hash', 'cookie_expiry' => 604800), 'session' => array('session_name' => 'user', 'token_name' => 'token'));
//auto include classes
spl_autoload_register(function ($class) {
require_once '../Classes/' . $class . '.php';
});
//include functions
require_once '../Functions/sanitize.php';
require_once '../vendor/autoload.php';
//$logger = new Katzgrau\KLogger\Logger('../Log',Psr\Log\LogLevel::DEBUG);
$_log = new Logger('../Log', Psr\Log\LogLevel::DEBUG);
//check whether cookie is stored and user logged in
if (cookie::exists(config::get('remember/cookie_name')) && !session::exists(config::get('session/session_name'))) {
$hash = cookie::get(config::get('remember/cookie_name'));
$hashCheck = db::getInstance();
$hashCheck->get('User_Sessions', array('Hash', '=', $hash));
if ($hashCheck->counts()) {
$user = new user($hashCheck->first()->User_Id, $_log);
$user->login();
}
}