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


PHP integrate::set_cookie方法代码示例

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


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

示例1: substr

 /**
  *  设置论坛cookie
  *
  * @access  public
  * @param
  *
  * @return void
  */
 function set_cookie($username = "")
 {
     parent::set_cookie($username);
     $cookie_name = substr(md5($this->db_sitehash), 0, 5) . '_winduser';
     if (empty($username)) {
         $time = time() - 3600;
         setcookie($cookie_name, '', $time, $this->cookie_path, $this->cookie_domain);
     } else {
         $sql = "SELECT " . $this->field_id . " AS user_id, " . $this->field_pass . " As password," . $this->field_safecv . " AS safecv" . " FROM " . $this->table($this->user_table) . " WHERE " . $this->field_name . "='{$username}'";
         $row = $this->db->getRow($sql);
         $cookie_name = substr(md5($this->db_sitehash), 0, 5) . '_winduser';
         $salt = md5($_SERVER["HTTP_USER_AGENT"] . $row['password'] . $this->db_hash);
         $auto_login_key = $this->code_string($row['user_id'] . "\t" . $salt . "\t" . $row['safecv'], 'ENCODE');
         setcookie($cookie_name, $auto_login_key, time() + 3600 * 24 * 30, $this->cookie_path, $this->cookie_domain);
     }
 }
开发者ID:duynhan07,项目名称:ecshop-vietnam,代码行数:24,代码来源:phpwind6.php

示例2: time

 /**
  *  设置论坛cookie
  *
  * @access  public
  * @param
  *
  * @return void
  */
 function set_cookie($username = "")
 {
     parent::set_cookie($username);
     if (empty($username)) {
         $time = time() - 3600;
         setcookie('bbuserid', '', $time, $this->cookie_path, $this->cookie_domain);
         setcookie('bbpassword', '', $time, $this->cookie_path, $this->cookie_domain);
     } else {
         if ($this->charset != 'UTF8') {
             $username = ecs_iconv('UTF8', $this->charset, $username);
         }
         $sql = "SELECT " . $this->field_id . " AS user_id, " . $this->field_pass . " As password " . " FROM " . $this->table($this->user_table) . " WHERE " . $this->field_name . "='{$username}'";
         $row = $this->db->getRow($sql);
         setcookie('bbuserid', $row['user_id'], time() + 3600 * 24 * 30, $this->cookie_path, $this->cookie_domain);
         setcookie('bbpassword', md5($row['password'] . $this->cookie_salt), time() + 3600 * 24 * 30, $this->cookie_path, $this->cookie_domain);
     }
 }
开发者ID:a494008974,项目名称:bzbshop,代码行数:25,代码来源:vbb.php

示例3: time

 /**
  *  设置论坛cookie
  *
  * @access  public
  * @param
  *
  * @return void
  */
 function set_cookie($username = "")
 {
     parent::set_cookie($username);
     $cookie_name = 'winduser';
     if (empty($username)) {
         $time = time() - 3600;
         setcookie($cookie_name, '', $time, $this->cookie_path, $this->cookie_domain);
     } else {
         /*
                     if ($this->charset != 'UTF8')
                     {
                         $username = ecs_iconv('UTF8', $this->charset, $username);
                     }*/
         $sql = "SELECT " . $this->field_id . " AS user_id, " . $this->field_pass . " As password " . " FROM " . $this->table($this->user_table) . " WHERE " . $this->field_name . "='{$username}'";
         $row = $this->db->getRow($sql);
         $cookie_name = 'winduser';
         $salt = md5($_SERVER["HTTP_USER_AGENT"] . $row['password'] . $this->db_hash);
         //$auto_login_key = $this->code_string($row['user_id'] . "\t" . $salt, 'ENCODE');
         $auto_login_key = $row['user_id'] . "\t" . $salt;
         setcookie($cookie_name, $auto_login_key, time() + 3600 * 24 * 30, $this->cookie_path, $this->cookie_domain);
     }
 }
开发者ID:a494008974,项目名称:bzbshop,代码行数:30,代码来源:phpwind.php

示例4: time

 /**
  *  设置论坛cookie
  *
  * @access  public
  * @param
  *
  * @return void
  */
 function set_cookie($username = "")
 {
     parent::set_cookie($username);
     if (empty($username)) {
         $time = time() - 3600;
         setcookie($this->cookie_prefix . '_data', '', $time, $this->cookie_path, $this->cookie_domain);
         setcookie($this->cookie_prefix . '_sid', '', $time, $this->cookie_path, $this->cookie_domain);
     } else {
         if ($this->charset != 'UTF8') {
             $username = ecs_iconv('UTF8', $this->charset, $username);
         }
         $sql = "SELECT " . $this->field_id . " AS user_id, " . $this->field_name . " AS user_name, " . $this->field_email . " AS email " . " FROM " . $this->table($this->user_table) . " WHERE " . $this->field_name . " = '{$username}'";
         $row = $this->db->getRow($sql);
         $auto_login_key = md5($this->dss_rand() . $this->dss_rand());
         /* 向整合对象的数据表里写入cookie值 */
         $this->db->query("INSERT INTO " . $this->table('sessions_keys') . " (key_id, user_id, last_login) " . "VALUES ('" . $auto_login_key . "', '{$row['user_id']}', '" . time() . "')");
         $client_ip = !empty($HTTP_SERVER_VARS['REMOTE_ADDR']) ? $HTTP_SERVER_VARS['REMOTE_ADDR'] : (!empty($HTTP_ENV_VARS['REMOTE_ADDR']) ? $HTTP_ENV_VARS['REMOTE_ADDR'] : getenv('REMOTE_ADDR'));
         $sql = "INSERT INTO " . $this->table('sessions') . " (session_id, session_user_id, session_start, session_time, session_ip, session_logged_in, session_admin) VALUES('{$auto_login_key}', '" . $row[$this->field_id] . "','" . time() . "','" . time() . "','" . $this->encode_ip($client_ip) . "',1, 0)";
         $this->db->query($sql);
         $sessiondata = array('autologinid' => $auto_login_key, 'userid' => $row['user_id']);
         setcookie($this->cookie_prefix . '_data', serialize($sessiondata), time() + 31536000, $this->cookie_path, $this->cookie_domain);
         setcookie($this->cookie_prefix . '_sid', $auto_login_key, time() + 31536000, $this->cookie_path, $this->cookie_domain);
     }
 }
开发者ID:jiusanzhou,项目名称:ecapi,代码行数:32,代码来源:phpbb.php

示例5: time

 /**
  *  设置论坛cookie
  *
  * @access  public
  * @param
  *
  * @return void
  */
 function set_cookie($username = "")
 {
     parent::set_cookie($username);
     if (empty($username)) {
         $time = time() - 3600;
         setcookie($this->cookie_prefix . 'sid', '', $time, $this->cookie_path, $this->cookie_domain);
         setcookie($this->cookie_prefix . 'auth', '', $time, $this->cookie_path, $this->cookie_domain);
     } else {
         if ($this->charset != 'UTF8') {
             $username = ecs_iconv('UTF8', $this->charset, $username);
         }
         $sql = "SELECT " . $this->field_id . " AS user_id, secques AS salt, " . $this->field_pass . " As password " . " FROM " . $this->table($this->user_table) . " WHERE " . $this->field_name . "='{$username}'";
         $row = $this->db->getRow($sql);
         setcookie($this->prefix . 'sid', '', time() - 3600, $this->cookie_path, $this->cookie_domain);
         setcookie($this->prefix . 'auth', $this->authcode($row['password'] . "\t" . $row['salt'] . "\t" . $row['user_id'], 'ENCODE'), time() + 3600 * 24 * 30, $this->cookie_path, $this->cookie_domain);
     }
 }
开发者ID:a494008974,项目名称:bzbshop,代码行数:25,代码来源:discuz.php

示例6: time

 /**
  *  设置论坛cookie
  *
  * @access  public
  * @param
  *
  * @return void
  */
 function set_cookie($username = "")
 {
     parent::set_cookie($username);
     if (empty($username)) {
         $time = time() - 3600;
         setcookie($this->cookie_prefix . 'userid', '', $time, $this->cookie_path, $this->cookie_domain);
         setcookie($this->cookie_prefix . 'username', '', $time, $this->cookie_path, $this->cookie_domain);
         setcookie($this->cookie_prefix . 'password', '', $time, $this->cookie_path, $this->cookie_domain);
         setcookie($this->cookie_prefix . 'userhidden', '', $time, $this->cookie_path, $this->cookie_domain);
         setcookie($this->cookie_prefix . 'onlinecachetime', '', $time, $this->cookie_path, $this->cookie_domain);
     } else {
         if ($this->charset != 'UTF8') {
             $username = ecs_iconv('UTF8', $this->charset, $username);
         }
         $sql = "SELECT " . $this->field_id . " AS user_id, truepassword, userhidden " . " FROM " . $this->table($this->user_table) . " WHERE " . $this->field_name . "='{$username}'";
         $row = $this->db->getRow($sql);
         setcookie($this->cookie_prefix . 'userid', $row['user_id'], time() + 3600 * 24 * 30, $this->cookie_path, $this->cookie_domain);
         setcookie($this->cookie_prefix . 'username', $username, time() + 3600 * 24 * 30, $this->cookie_path, $this->cookie_domain);
         setcookie($this->cookie_prefix . 'password', $row['truepassword'], time() + 3600 * 24 * 30, $this->cookie_path, $this->cookie_domain);
         setcookie($this->cookie_prefix . 'userhidden', $row['userhidden'], time() + 3600 * 24 * 30, $this->cookie_path, $this->cookie_domain);
     }
 }
开发者ID:firsteam,项目名称:falcons,代码行数:30,代码来源:dvbbs.php

示例7: time

 /**
  *  设置论坛cookie
  *
  * @access  public
  * @param
  *
  * @return void
  */
 function set_cookie($username = "")
 {
     parent::set_cookie($username);
     if (empty($username)) {
         $time = time() - 3600;
         setcookie('session_id', '', $time, $this->cookie_path, $this->cookie_domain);
         setcookie('member_id', '', $time, $this->cookie_path, $this->cookie_domain);
         setcookie('pass_hash', '', $time, $this->cookie_path, $this->cookie_domain);
     } else {
         $time = time() + 3600 * 24 * 30;
         if ($this->charset != 'UTF8') {
             $username = ecs_iconv('UTF8', $this->charset, $username);
         }
         $sql = "SELECT " . $this->field_id . " AS user_id, member_login_key " . " FROM " . $this->table($this->user_table) . " WHERE " . $this->field_name . "='{$username}'";
         $row = $this->db->getRow($sql);
         if ($row) {
             setcookie('member_id', $row['user_id'], $time, $this->cookie_path, $this->cookie_domain);
             setcookie('pass_hash', $row['member_login_key'], $time, $this->cookie_path, $this->cookie_domain);
         }
     }
 }
开发者ID:will0306,项目名称:bianli100,代码行数:29,代码来源:ipb.php


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