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


PHP Cookie::unsetValue方法代码示例

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


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

示例1: setLoggedUser

 /**
  * Set logged_user value
  *
  * @access public
  * @param User $value
  * @param boolean $remember Remember this user for 2 weeks (configurable)
  * @param DateTimeValue $set_last_activity_time Set last activity time. This property is turned off in case of feed 
  *   login for instance
  * @return null
  * @throws DBQueryError
  */
 function setLoggedUser(User $user, $remember = false, $set_last_activity_time = true)
 {
     if ($set_last_activity_time) {
         $user->setLastActivity(DateTimeValueLib::now());
         $user->save();
     }
     // if
     $expiration = $remember ? REMEMBER_LOGIN_LIFETIME : SESSION_LIFETIME;
     Cookie::setValue('id' . TOKEN_COOKIE_NAME, $user->getId(), $expiration);
     Cookie::setValue(TOKEN_COOKIE_NAME, $user->getTwistedToken(), $expiration);
     if ($remember) {
         Cookie::setValue('remember' . TOKEN_COOKIE_NAME, 1, $expiration);
     } else {
         Cookie::unsetValue('remember' . TOKEN_COOKIE_NAME);
     }
     // if
     $this->logged_user = $user;
 }
开发者ID:swenson,项目名称:projectpier,代码行数:29,代码来源:CompanyWebsite.class.php

示例2: setLoggedUser

 /**
  * Set logged_user value
  *
  * @access public
  * @param Contact $value
  * @param boolean $remember Remember this user for 2 weeks (configurable)
  * @param DateTimeValue $set_last_activity_time Set last activity time. This property is turned off in case of feed
  *   login for instance
  * @return null
  * @throws DBQueryError
  */
 function setLoggedUser(Contact $user, $remember = false, $set_last_activity_time = true, $set_cookies = true)
 {
     if ($set_last_activity_time) {
         $last_activity_mod_timestamp = array_var($_SESSION, 'last_activity_mod_timestamp', null);
         if (!$last_activity_mod_timestamp || $last_activity_mod_timestamp < time() - 60 * 10) {
             $sql = "UPDATE " . TABLE_PREFIX . "contacts SET last_activity = '" . DateTimeValueLib::now()->toMySQL() . "' WHERE object_id = " . $user->getId();
             DB::execute($sql);
             $_SESSION['last_activity_mod_timestamp'] = time();
         }
     }
     if ($set_cookies) {
         $expiration = $remember ? REMEMBER_LOGIN_LIFETIME : SESSION_LIFETIME;
         Cookie::setValue('id', $user->getId(), $expiration);
         Cookie::setValue('token', $user->getTwistedToken(), $expiration);
         if ($remember) {
             Cookie::setValue('remember', 1, $expiration);
         } else {
             Cookie::unsetValue('remember');
         }
         // if
     }
     $this->logged_user = $user;
 }
开发者ID:rorteg,项目名称:fengoffice,代码行数:34,代码来源:CompanyWebsite.class.php

示例3: setLoggedUser

 /**
  * Set logged_user value
  *
  * @access public
  * @param User $value
  * @param boolean $remember Remember this user 
  * @param boolean $set_last_activity_time Turned off in case of feed login
  * @return null
  * @throws DBQueryError
  */
 function setLoggedUser(User $user, $remember = false, $set_last_activity_time = true, $set_cookies = true)
 {
     trace(__FILE__, 'setLoggedUser():begin');
     if ($set_last_activity_time) {
         $user->setLastActivity(DateTimeValueLib::now());
         trace(__FILE__, 'setLoggedUser():user->save()');
         $user->save();
     }
     // if
     if ($set_cookies) {
         $expiration = $remember ? config_option('remember_login_lifetime', 3600) : 3600;
         Cookie::setValue('id' . TOKEN_COOKIE_NAME, $user->getId(), $expiration);
         Cookie::setValue(TOKEN_COOKIE_NAME, $user->getTwistedToken(), $expiration);
         if ($remember) {
             Cookie::setValue('remember' . TOKEN_COOKIE_NAME, 1, $expiration);
         } else {
             Cookie::unsetValue('remember' . TOKEN_COOKIE_NAME);
         }
         // if
     }
     // if
     trace(__FILE__, 'setLoggedUser():end');
     $this->logged_user = $user;
 }
开发者ID:bklein01,项目名称:Project-Pier,代码行数:34,代码来源:CompanyWebsite.class.php

示例4: setLoggedUser

 /**
  * Set logged_user value
  *
  * @access public
  * @param Contact $value
  * @param boolean $remember Remember this user for 2 weeks (configurable)
  * @param DateTimeValue $set_last_activity_time Set last activity time. This property is turned off in case of feed
  *   login for instance
  * @return null
  * @throws DBQueryError
  */
 function setLoggedUser(Contact $user, $remember = false, $set_last_activity_time = true, $set_cookies = true)
 {
     if ($set_last_activity_time) {
         $last_activity_mod_timestamp = array_var($_SESSION, 'last_activity_mod_timestamp', null);
         if (!isset($_SESSION['last_activity_updating']) && (!$last_activity_mod_timestamp || $last_activity_mod_timestamp < time() - 60 * 10)) {
             $_SESSION['last_activity_updating'] = true;
             $now = DateTimeValueLib::now();
             if (is_null($user->getLastActivity())) {
                 $last_visit = $now;
             } else {
                 $last_visit = $user->getLastActivity();
             }
             $sql = "UPDATE " . TABLE_PREFIX . "contacts SET last_activity = '" . $now->toMySQL() . "',\r\n\t\t\t\t \t\tlast_visit = '" . ($last_visit instanceof DateTimeValue ? $last_visit->toMySQL() : EMPTY_DATETIME) . "', last_login='" . $now->toMySQL() . "'\r\n\t\t\t\t \t\tWHERE object_id = " . $user->getId();
             DB::execute($sql);
             $_SESSION['last_activity_mod_timestamp'] = time();
             unset($_SESSION['last_activity_updating']);
         }
     }
     if ($set_cookies) {
         $expiration = $remember ? REMEMBER_LOGIN_LIFETIME : SESSION_LIFETIME;
         Cookie::setValue('id', $user->getId(), $expiration);
         Cookie::setValue('token', $user->getTwistedToken(), $expiration);
         if ($remember) {
             Cookie::setValue('remember', 1, $expiration);
         } else {
             Cookie::unsetValue('remember');
         }
         // if
     }
     $this->logged_user = $user;
 }
开发者ID:abhinay100,项目名称:feng_app,代码行数:42,代码来源:CompanyWebsite.class.php

示例5: setLoggedUser

 /**
  * Set logged_user value
  *
  * @access public
  * @param User $value
  * @param boolean $remember Remember this user for 2 weeks (configurable)
  * @param DateTimeValue $set_last_activity_time Set last activity time. This property is turned off in case of feed
  *   login for instance
  * @return null
  * @throws DBQueryError
  */
 function setLoggedUser(User $user, $remember = false, $set_last_activity_time = true, $set_cookies = true)
 {
     if ($set_last_activity_time) {
         $last_activity_mod_timestamp = array_var($_SESSION, 'last_activity_mod_timestamp', null);
         if (!$last_activity_mod_timestamp || $last_activity_mod_timestamp < time() - 60 * 10) {
             $user->setLastActivity(DateTimeValueLib::now());
             // Disable updating user info
             $old_updated_on = $user->getUpdatedOn();
             $user->setUpdatedOn(DateTimeValueLib::now());
             $user->setUpdatedOn($old_updated_on);
             $user->save();
             $_SESSION['last_activity_mod_timestamp'] = time();
         }
     }
     // if
     if ($set_cookies) {
         $expiration = $remember ? REMEMBER_LOGIN_LIFETIME : SESSION_LIFETIME;
         Cookie::setValue('id', $user->getId(), $expiration);
         Cookie::setValue('token', $user->getTwistedToken(), $expiration);
         Cookie::setValue('cn', md5(array_var($_SERVER, 'REMOTE_ADDR', "")));
         if ($remember) {
             Cookie::setValue('remember', 1, $expiration);
         } else {
             Cookie::unsetValue('remember');
         }
         // if
     }
     $this->logged_user = $user;
 }
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:40,代码来源:CompanyWebsite.class.php


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