本文整理汇总了PHP中cookie::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP cookie::delete方法的具体用法?PHP cookie::delete怎么用?PHP cookie::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cookie
的用法示例。
在下文中一共展示了cookie::delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get
/**
* Fetch a cookie value, using the Input library.
*
* @param string cookie name
* @param mixed default value
* @param boolean use XSS cleaning on the value
* @return string
*/
public static function get($name = NULL, $default = NULL, $xss_clean = FALSE)
{
// Return an array of all the cookies if we don't have a name
if ($name === NULL) {
$cookies = array();
foreach ($_COOKIE as $key => $value) {
$cookies[$key] = cookie::get($key, $default, $xss_clean);
}
return $cookies;
}
if (!isset($_COOKIE[$name])) {
return $default;
}
// Get the cookie value
$cookie = $_COOKIE[$name];
// Find the position of the split between salt and contents
$split = strlen(cookie::salt($name, NULL));
if (isset($cookie[$split]) and $cookie[$split] === '~') {
// Separate the salt and the value
list($hash, $value) = explode('~', $cookie, 2);
if (cookie::salt($name, $value) === $hash) {
if ($xss_clean === TRUE and Kohana::config('core.global_xss_filtering') === FALSE) {
return Input::instance()->xss_clean($value);
}
// Cookie signature is valid
return $value;
}
// The cookie signature is invalid, delete it
cookie::delete($name);
}
return $default;
}
示例2: _before_index
public function _before_index()
{
$model = D("MisSystemRecursion");
$MisSystemCompanyDao = M("mis_system_company");
$where = array();
$where['status'] = 1;
$companylist = $MisSystemCompanyDao->where($where)->select();
$this->assign("companylist", $companylist);
//构造结构树
$param['url'] = "__URL__/index/jump/jump/parentid/#id#/id/#id#";
$param['rel'] = "MisSystemCompanyZtree";
$param['open'] = "true";
$param['isParent'] = "true";
if ($companylist) {
$companyztree = $this->getTree($companylist, $param);
}
//高亮默认选中节点
$parentid = $_REQUEST['parentid'];
if (empty($parentid)) {
$parentid = cookie::get("missystemcompanyid");
cookie::delete("missystemcompanyid");
if (empty($parentid)) {
$parentid = $companylist[0]['id'];
}
}
$this->assign('valid', $parentid);
//赋值用于boolbar
$this->assign('parentid', $parentid);
$this->assign("companyztree", $companyztree);
}
示例3: __construct
public function __construct(Request $request)
{
// Delete the authorization
cookie::delete('authorized');
// Redirect to the login page
$request->redirect(url::site($request->uri(array('controller' => NULL))));
// Do not call anything here, redirect has already halted execution.
}
示例4: logout
/**
* Log a user out and remove any auto-login cookies.
*
* @param boolean completely destroy the session
* @return boolean
*/
public function logout($destroy)
{
if (cookie::get('authautologin')) {
// Delete the autologin cookie to prevent re-login
cookie::delete('authautologin');
}
return parent::logout($destroy);
}
示例5: index
function index()
{
//判断用户是否是已经登录状态
$data = role::get_manager();
if ($data['id'] > 0) {
$data['success'] = 'true';
$data['msg'] = 1;
} else {
$data['success'] = 'false';
$data['msg'] = 1;
}
$username = $this->input->post('username');
$password = $this->input->post('password');
$secode = $this->input->post('secode');
$remember = $this->input->post('remember');
$data['success'] = 'false';
//验证登录
$manager = role::log_in($username, $password);
if (isset($manager['username'])) {
//判断普通账号的状态、权限
if (!role::is_root($manager['username'])) {
if ($manager['active'] != 1) {
ulog::login($manager['id'], 1);
$data['msg'] = Kohana::lang('o_global.account_was_locked');
}
$actions = role::manager_actions($manager['id'], TRUE);
if (count($actions) < 1) {
ulog::login($manager['id'], 2);
$data['msg'] = Kohana::lang('o_global.account_permission_enough');
}
}
//是否记录用户名
if ($remember == 1) {
cookie::set('opococ_username', $username);
} else {
cookie::delete('opococ_username');
}
//清除记录登录错误记录
//Session::instance()->delete('login_error_count');
//记入SESSION
role::set_manager_session($manager);
//记录日志
ulog::login($manager['id']);
$data['success'] = 'true';
$data['msg'] = 1;
/*if(empty($request_url))
{
remind::set(Kohana::lang('o_global.login_success'), '/index', 'success');
}
else
{
$request_url = url::base() . urldecode($request_url);
remind::set(Kohana::lang('o_global.login_success'), $request_url, 'success');
}*/
}
die(json_encode($data));
}
示例6: logout
/**
* Logout un utilisateur.
*
* @return void
*/
public function logout()
{
$this->auto_render = FALSE;
$authentic = Auth::instance();
if ($authentic->logged_in()) {
$authentic->logout(TRUE);
}
cookie::delete('urlAdminUrl');
return self::redirection(Kohana::lang('logger.disconnect'));
}
示例7: after
public function after()
{
if ($this->auto_render === TRUE and !$this->_ajax) {
$this->template->content = View::factory('template/admin')->set('content', $this->template->content)->bind('menu', $menu);
if ($this->_current_user) {
// Display these menu items as controller
$menu = array('projects', 'users', 'logout');
}
}
parent::after();
// Delete any existing message cookie
cookie::delete('message');
}
示例8: setUp
/**
* Setup the test case
* - Create MySQL users table
* - Clear any set cookies
*/
protected function setUp()
{
// Use unit test database
Kohana::config('database')->default['connection']['database'] = "unit_test";
// Import schema file
$users_schema = Kohana::find_file('queries/schemas', 'users', 'sql');
$users_sql = file_get_contents($users_schema);
try {
DB::query(Database::INSERT, $users_sql)->execute();
} catch (Database_Exception $e) {
echo $e->getMessage();
}
cookie::delete('a1_a1_autologin');
}
示例9: 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;
}
示例10: 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);
}
示例11: get
/**
* Gets the value of a signed cookie. Unsigned cookies will not be returned.
*
* @param string cookie name
* @param mixed default value to return
* @return string
*/
public static function get($key, $default = NULL)
{
if (!isset($_COOKIE[$key])) {
// The cookie does not exist
return $default;
}
// Get the cookie value
$cookie = $_COOKIE[$key];
// Find the position of the split between salt and contents
$split = strlen(cookie::salt($key, NULL));
if (isset($cookie[$split]) and $cookie[$split] === '~') {
// Separate the salt and the value
list($hash, $value) = explode('~', $cookie, 2);
if (cookie::salt($key, $value) === $hash) {
// Cookie signature is valid
return $value;
}
// The cookie signature is invalid, delete it
cookie::delete($key);
}
return $default;
}
示例12: logout
public function logout($destroy)
{
// Delete the autologin cookie if it exists
cookie::get('authautologin') and cookie::delete('authautologin');
if ($destroy === TRUE) {
// Destroy the session completely
Session::instance()->destroy();
} else {
// Remove the user object from the session
unset($_SESSION['auth_user']);
// Regenerate session_id
$this->session->regenerate();
}
// Double check
return !isset($_SESSION['auth_user']);
}
示例13: logout
/**
* Log a owner out and remove any auto-login cookies.
*
* @param boolean completely destroy the session
* @return boolean
*/
public function logout($destroy)
{
if ($token = cookie::get('authautologin')) {
// Delete the autologin cookie to prevent re-login
cookie::delete('authautologin');
// Clear the autologin token from the database
$token = ORM::factory('owner_token', $token);
if ($token->loaded) {
$token->delete();
}
}
return parent::logout($destroy);
}
示例14: logout
public function logout($destroy = FALSE, $logout_all = FALSE)
{
if ($token = cookie::get('authautologin')) {
echo 999;
// Delete the autologin cookie to prevent re-login
cookie::delete('authautologin');
// Clear the autologin token from the database
$token = Sprig::factory('token', array('token' => $token))->load();
if ($token->loaded() and $logout_all) {
Sprig::factory('token', array('user_id' => $token->user->id))->delete();
} elseif ($token->loaded()) {
$token->delete();
}
}
return parent::logout($destroy);
}
示例15: logout
/**
* 登出
*/
public function logout()
{
cookie::delete(COOKIE_KEY);
redirect('./');
}