/** * 设置论坛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); } }
/** * 设置论坛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); } }
/** * 设置论坛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); } }
/** * 设置论坛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); } }
/** * 设置论坛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); } }
/** * 设置论坛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); } }
/** * 设置论坛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); } } }