當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。