当前位置: 首页>>代码示例>>PHP>>正文


PHP Cookie::expire方法代码示例

本文整理汇总了PHP中Cookie::expire方法的典型用法代码示例。如果您正苦于以下问题:PHP Cookie::expire方法的具体用法?PHP Cookie::expire怎么用?PHP Cookie::expire使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Cookie的用法示例。


在下文中一共展示了Cookie::expire方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: isLoggedIn

 /**
  * This function determines whether an there is a currently logged in
  * Author for Symphony by using the `$Cookie`'s username
  * and password. If an Author is found, they will be logged in, otherwise
  * the `$Cookie` will be destroyed.
  *
  * @see core.Cookie#expire()
  */
 public function isLoggedIn()
 {
     // Ensures that we're in the real world.. Also reduces three queries from database
     // We must return true otherwise exceptions are not shown
     if (is_null(self::$_instance)) {
         return true;
     }
     if ($this->Author) {
         return true;
     } else {
         $username = self::Database()->cleanValue($this->Cookie->get('username'));
         $password = self::Database()->cleanValue($this->Cookie->get('pass'));
         if (strlen(trim($username)) > 0 && strlen(trim($password)) > 0) {
             $author = AuthorManager::fetch('id', 'ASC', 1, null, sprintf("\n\t\t\t\t\t\t\t`username` = '%s'\n\t\t\t\t\t\t", $username));
             if (!empty($author) && Cryptography::compare($password, current($author)->get('password'), true)) {
                 $this->Author = current($author);
                 self::Database()->update(array('last_seen' => DateTimeObj::get('Y-m-d H:i:s')), 'tbl_authors', sprintf(" `id` = %d", $this->Author->get('id')));
                 // Only set custom author language in the backend
                 if (class_exists('Administration')) {
                     Lang::set($this->Author->get('language'));
                 }
                 return true;
             }
         }
         $this->Cookie->expire();
         return false;
     }
 }
开发者ID:readona,项目名称:symphonyno5,代码行数:36,代码来源:class.symphony.php

示例2: isLoggedIn

 /**
  * This function determines whether an there is a currently logged in
  * Author for Symphony by using the `$Cookie`'s username
  * and password. If an Author is found, they will be logged in, otherwise
  * the `$Cookie` will be destroyed.
  *
  * @see core.Cookie#expire()
  */
 public function isLoggedIn()
 {
     // Ensures that we're in the real world.. Also reduces three queries from database
     // We must return true otherwise exceptions are not shown
     if (is_null(self::$_instance)) {
         return true;
     }
     if ($this->Author) {
         return true;
     } else {
         $username = self::$Database->cleanValue($this->Cookie->get('username'));
         $password = self::$Database->cleanValue($this->Cookie->get('pass'));
         if (strlen(trim($username)) > 0 && strlen(trim($password)) > 0) {
             $id = self::$Database->fetchVar('id', 0, "SELECT `id` FROM `tbl_authors` WHERE `username` = '{$username}' AND `password` = '{$password}' LIMIT 1");
             if ($id) {
                 self::$Database->update(array('last_seen' => DateTimeObj::get('Y-m-d H:i:s')), 'tbl_authors', " `id` = '{$id}'");
                 $this->Author = AuthorManager::fetchByID($id);
                 Lang::set($this->Author->get('language'));
                 return true;
             }
         }
         $this->Cookie->expire();
         return false;
     }
 }
开发者ID:scottkf,项目名称:keepflippin--on-symphony,代码行数:33,代码来源:class.symphony.php

示例3: login

 public function login($token, $remember = false, $cookiePath = '/')
 {
     $this->token = $token;
     Session::set(self::SESSION_NAME, $token);
     if ($remember) {
         Cookie::set(self::COOKIE_NAME, $token, Cookie::expire('365', 'd'), $cookiePath);
     }
     return true;
 }
开发者ID:salomalo,项目名称:php-oxygen,代码行数:9,代码来源:driver.class.php

示例4: logout

 /**
  * This function will destroy the currently logged in `$Author`
  * session, essentially logging them out.
  *
  * @see core.Cookie#expire()
  */
 public static function logout()
 {
     self::$Cookie->expire();
 }
开发者ID:jurajkapsz,项目名称:symphony-2,代码行数:10,代码来源:class.symphony.php

示例5: __expireCookie

 private function __expireCookie()
 {
     session_destroy();
     $Cookie = new Cookie(__SYM_COOKIE_PREFIX_ . 'front-end-authentication', 24 * 60 * 60, __SYM_COOKIE_PATH__);
     $Cookie->expire();
 }
开发者ID:neilalbrock,项目名称:frontend_authentication,代码行数:6,代码来源:extension.driver.php

示例6: frontendPageResolved

 public function frontendPageResolved($context)
 {
     if (isset($_REQUEST['github-oauth-action']) && isset($_REQUEST['github-oauth-action']) == 'logout') {
         $cookie = new Cookie('github');
         $cookie->expire();
         if (isset($_REQUEST['redirect'])) {
             redirect($_REQUEST['redirect']);
         }
         redirect(URL);
     }
 }
开发者ID:remie,项目名称:GitHubOAuth,代码行数:11,代码来源:extension.driver.php


注:本文中的Cookie::expire方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。