本文整理汇总了PHP中vbsetcookie函数的典型用法代码示例。如果您正苦于以下问题:PHP vbsetcookie函数的具体用法?PHP vbsetcookie怎么用?PHP vbsetcookie使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了vbsetcookie函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: verify_authentication2
function verify_authentication2($username)
{
global $vbulletin;
$username = strip_blank_ascii($username, ' ');
if ($vbulletin->userinfo = $vbulletin->db->query_first("SELECT userid, usergroupid, membergroupids, infractiongroupids, username, password, salt FROM " . TABLE_PREFIX . "user WHERE username = '" . $vbulletin->db->escape_string(htmlspecialchars_uni($username)) . "'")) {
if ($vbulletin->GPC[COOKIE_PREFIX . 'userid'] and $vbulletin->GPC[COOKIE_PREFIX . 'userid'] != $vbulletin->userinfo['userid']) {
// we have a cookie from a user and we're logging in as
// a different user and we're not going to store a new cookie,
// so let's unset the old one
vbsetcookie('userid', '', true, true, true);
vbsetcookie('password', '', true, true, true);
}
vbsetcookie('userid', $vbulletin->userinfo['userid'], true, true, true);
vbsetcookie('password', md5($vbulletin->userinfo['password'] . COOKIE_SALT), true, true, true);
$return_value = true;
($hook = vBulletinHook::fetch_hook('login_verify_success')) ? eval($hook) : false;
return $return_value;
}
$return_value = false;
($hook = vBulletinHook::fetch_hook('login_verify_failure_username')) ? eval($hook) : false;
return $return_value;
}
示例2: md5
$sql = "SELECT activationid FROM useractivation WHERE userid = '" . $userid . "'";
$data = $vbulletin->db->query_first($sql);
$activationid = $data["activationid"];
if (!empty($activationid)) {
$url = "register.php?a=act&u=" . $userid . "&i=" . $activationid;
} else {
$url = "index.php";
$token = md5(uniqid(microtime(), true));
$token_time = time();
$form = "site-account-details";
$_SESSION['site_registration'][$form . '_token'] = array('token' => $token, 'time' => $token_time);
// start new session
$vbulletin->userinfo = $vbulletin->db->query_first("SELECT userid, usergroupid, membergroupids, infractiongroupids,\n username, password, salt FROM " . TABLE_PREFIX . "user\n WHERE userid = " . $userid);
require_once DIR . '/includes/functions_login.php';
vbsetcookie('userid', $vbulletin->userinfo['userid'], true, true, true);
vbsetcookie('password', md5($vbulletin->userinfo['password'] . COOKIE_SALT), true, true, true);
if ($vbulletin->options['usestrikesystem']) {
exec_unstrike_user($vbulletin->GPC['username']);
}
process_new_login('', 1, $vbulletin->GPC['cssprefs']);
cache_permissions($vbulletin->userinfo, true);
$vbulletin->session->save();
}
}
}
} else {
$valid_entries = FALSE;
$messages['errors'][] = $message = "Please check your username and password.";
$messages['fields'][] = $error_type = "username-member";
$messages['errors'][] = $message = "";
$messages['fields'][] = $error_type = "password-member";
示例3: switch
// *********************************************************************************
// set $threadedmode (continued from global.php)
if ($vbulletin->options['allowthreadedmode'] and !$show['search_engine'] and !VB_API) {
if (!empty($vbulletin->GPC['mode'])) {
// Look for command to switch types on the query string
switch ($vbulletin->GPC['mode']) {
case 'threaded':
$threadedCookieVal = 'threaded';
break;
case 'hybrid':
$threadedCookieVal = 'hybrid';
break;
default:
$threadedCookieVal = 'linear';
}
vbsetcookie('threadedmode', $threadedCookieVal);
$vbulletin->GPC[COOKIE_PREFIX . 'threadedmode'] = $threadedCookieVal;
unset($threadedCookieVal);
}
if (!empty($vbulletin->GPC[COOKIE_PREFIX . 'threadedmode'])) {
switch ($vbulletin->GPC[COOKIE_PREFIX . 'threadedmode']) {
case 'threaded':
$threadedmode = 1;
break;
case 'hybrid':
$threadedmode = 2;
break;
default:
$threadedmode = 0;
}
} else {
示例4: if
vbsetcookie('languageid', $languageid);
}
else if ($vbulletin->GPC[COOKIE_PREFIX . 'languageid'] AND !empty($vbulletin->languagecache[$vbulletin->GPC[COOKIE_PREFIX . 'languageid']]['userselect']))
{
$languageid = $vbulletin->GPC[COOKIE_PREFIX . 'languageid'];
}
else
{
$languageid = 0;
}
// Set up user's chosen style
if ($vbulletin->GPC['styleid'])
{
$styleid =& $vbulletin->GPC['styleid'];
vbsetcookie('userstyleid', $styleid);
}
else if ($vbulletin->GPC[COOKIE_PREFIX . 'userstyleid'])
{
$styleid = $vbulletin->GPC[COOKIE_PREFIX . 'userstyleid'];
}
else
{
$styleid = 0;
}
// build the session and setup the environment
$vbulletin->session = new vB_Session($vbulletin, $sessionhash, $vbulletin->GPC[COOKIE_PREFIX . 'userid'], $vbulletin->GPC[COOKIE_PREFIX . 'password'], $styleid, $languageid);
// Hide sessionid in url if we are a search engine or if we have a cookie
$vbulletin->session->set_session_visibility($show['search_engine'] OR $vbulletin->superglobal_size['_COOKIE'] > 0);
示例5: process_logout
function process_logout()
{
global $vbulletin;
// clear all cookies beginning with COOKIE_PREFIX
$prefix_length = strlen(COOKIE_PREFIX);
foreach ($_COOKIE AS $key => $val)
{
$index = strpos($key, COOKIE_PREFIX);
if ($index == 0 AND $index !== false)
{
$key = substr($key, $prefix_length);
if (trim($key) == '')
{
continue;
}
// vbsetcookie will add the cookie prefix
vbsetcookie($key, '', 1);
}
}
if ($vbulletin->userinfo['userid'] AND $vbulletin->userinfo['userid'] != -1)
{
// init user data manager
$userdata =& datamanager_init('User', $vbulletin, ERRTYPE_SILENT);
$userdata->set_existing($vbulletin->userinfo);
$userdata->set('lastactivity', TIMENOW - $vbulletin->options['cookietimeout']);
$userdata->set('lastvisit', TIMENOW);
$userdata->save();
// make sure any other of this user's sessions are deleted (in case they ended up with more than one)
$vbulletin->db->query_write("DELETE FROM " . TABLE_PREFIX . "session WHERE userid = " . $vbulletin->userinfo['userid']);
}
$vbulletin->db->query_write("DELETE FROM " . TABLE_PREFIX . "session WHERE sessionhash = '" . $vbulletin->db->escape_string($vbulletin->session->vars['dbsessionhash']) . "'");
if ($vbulletin->session->created == true)
{
// if we just created a session on this page, there's no reason not to use it
$newsession = $vbulletin->session;
}
else
{
$newsession = new vB_Session($vbulletin, '', 0, '', $vbulletin->session->vars['styleid']);
}
$newsession->set('userid', 0);
$newsession->set('loggedin', 0);
$newsession->set_session_visibility(($vbulletin->superglobal_size['_COOKIE'] > 0));
$vbulletin->session =& $newsession;
($hook = vBulletinHook::fetch_hook('logout_process')) ? eval($hook) : false;
}
示例6: log_admin_action
log_admin_action();
}
// ########################################################################
// ######################### START MAIN SCRIPT ############################
// ########################################################################
$vbulletin->input->clean_array_gpc('r', array('redirect' => TYPE_NOHTML));
# Not sure where this comes from
if (!empty($vbulletin->GPC['redirect'])) {
define('CP_REDIRECT', $vbulletin->GPC['redirect']);
print_stop_message('redirecting_please_wait');
}
// #############################################################################
// ############################### LOG OUT OF CP ###############################
// #############################################################################
if ($_REQUEST['do'] == 'cplogout') {
vbsetcookie('cpsession', '', false, true, true);
$db->query_write("DELETE FROM " . TABLE_PREFIX . "cpsession WHERE userid = " . $vbulletin->userinfo['userid'] . " AND hash = '" . $db->escape_string($vbulletin->GPC[COOKIE_PREFIX . 'cpsession']) . "'");
if (!empty($vbulletin->session->vars['sessionurl_js'])) {
exec_header_redirect('index.php?' . $vbulletin->session->vars['sessionurl_js']);
} else {
exec_header_redirect('index.php');
}
}
if (empty($_REQUEST['do'])) {
$_REQUEST['do'] = 'frames';
}
if ($_REQUEST['do'] == 'frames') {
$vbulletin->input->clean_array_gpc('r', array('loc' => TYPE_NOHTML));
$navframe = '<frame src="index.php?' . $vbulletin->session->vars['sessionurl'] . "do=nav" . iif($cpnavjs, '&cpnavjs=1') . "\" name=\"nav\" scrolling=\"yes\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" border=\"no\" />\n";
$headframe = '<frame src="index.php?' . $vbulletin->session->vars['sessionurl'] . "do=head\" name=\"head\" scrolling=\"no\" noresize=\"noresize\" frameborder=\"0\" marginwidth=\"10\" marginheight=\"0\" border=\"no\" />\n";
$mainframe = '<frame src="' . iif(!empty($vbulletin->GPC['loc']), $vbulletin->GPC['loc'], 'index.php?' . $vbulletin->session->vars['sessionurl'] . 'do=home') . "\" name=\"main\" scrolling=\"yes\" frameborder=\"0\" marginwidth=\"10\" marginheight=\"10\" border=\"no\" />\n";
示例7: date
} else {
$current['year'] = date('Y');
$current['month'] = date('m');
$current['day'] = date('d');
if ($year < 1970 or mktime(0, 0, 0, $month, $day, $year) <= mktime(0, 0, 0, $current['month'], $current['day'], $current['year'] - 13)) {
// this user is >13
$show['coppa'] = false;
} else {
if ($vbulletin->options['usecoppa'] == 2) {
if ($vbulletin->options['checkcoppa']) {
vbsetcookie('coppaage', $month . '-' . $day . '-' . $year, 1);
}
eval(standard_error(fetch_error('under_thirteen_registration_denied')));
} else {
if ($vbulletin->options['checkcoppa']) {
vbsetcookie('coppaage', $month . '-' . $day . '-' . $year, 1);
}
$show['coppa'] = true;
}
}
}
} else {
$show['coppa'] = false;
}
($hook = vBulletinHook::fetch_hook('register_form_start')) ? eval($hook) : false;
if ($errorlist) {
$checkedoff['adminemail'] = iif($vbulletin->GPC['options']['adminemail'], 'checked="checked"');
$checkedoff['showemail'] = iif($vbulletin->GPC['options']['showemail'], 'checked="checked"');
} else {
$checkedoff['adminemail'] = iif(bitwise($vbulletin->bf_misc_regoptions['adminemail'], $vbulletin->options['defaultregoptions']), 'checked="checked"');
$checkedoff['showemail'] = iif(bitwise($vbulletin->bf_misc_regoptions['receiveemail'], $vbulletin->options['defaultregoptions']), 'checked="checked"');
示例8: ExternalAuthorization
public function ExternalAuthorization($userid)
{
$this->vbulletin->userinfo = $this->vbulletin->db->query_first_slave("SELECT userid, password, username FROM " . TABLE_PREFIX . "user WHERE userid='{$userid}'");
if ($this->vbulletin->userinfo) {
require_once DIR . '/includes/functions_login.php';
vbsetcookie('userid', $this->vbulletin->userinfo['userid'], true, true, true);
vbsetcookie('password', md5($this->vbulletin->userinfo['password'] . COOKIE_SALT), true, true, true);
exec_unstrike_user($this->vbulletin->userinfo['username']);
define('EXTERNAL_AUTH', true);
// create new session
process_new_login('', 0, '');
}
if (!empty($_SERVER['HTTP_REFERER'])) {
$url = $_SERVER['HTTP_REFERER'];
} else {
$url = $this->vbulletin->options['homeurl'];
}
if (strpos($url, "?")) {
$url .= "&vbsession=" . $this->vbulletin->session->vars['sessionhash'];
} else {
$url .= "?vbsession=" . $this->vbulletin->session->vars['sessionhash'];
}
header('Location:' . $url);
echo "Вы были перенаправлены сюда <a href='" . $url . "'>" . $url . "</a>";
exit;
}
示例9: array
$vbulletin->input->clean_array_gpc('r', array('perpage' => vB_Cleaner::TYPE_UINT));
// if cookie was set, set the perpage value to the value found in cookie only if not set in the request.
// If request perpage is not empty, the user probably set it and we need to update the cookie.
if (!empty($vbulletin->GPC[COOKIE_PREFIX . 'contentlist_perpage'])) {
if (empty($vbulletin->GPC['perpage'])) {
$vbulletin->GPC['perpage'] = $vbulletin->GPC[COOKIE_PREFIX . 'contentlist_perpage'];
}
}
if (!empty($vbulletin->GPC['perpage'])) {
$perpage = $vbulletin->GPC['perpage'];
} else {
$perpage = 25;
}
// save to cookie if the request value is different than the one saved in cookie.
if ($perpage != $vbulletin->GPC[COOKIE_PREFIX . 'contentlist_perpage'] and !@headers_sent()) {
vbsetcookie('contentlist_perpage', $perpage, true, true, true);
}
// ###################### end setting cookies #######################
print_cp_header($vbphrase['content_management']);
if (empty($_REQUEST['do'])) {
$_REQUEST['do'] = 'contentlist';
}
// articles root channelid
$articleChannelId = vB_Api::instanceInternal('node')->fetchArticleChannel();
// just a wrapper for generateCategoryList because I'm having to call the same3 lines over and over again.
function getFullCategoryList(&$channelInfoArray = array(), $tabsize = 1, $tabchar = "--", $tabspace = " ")
{
$cache = vB_Cache::instance(vB_Cache::CACHE_STD);
$cacheKey = "vBAdminCP_CMS_Categories";
$categories = $cache->read($cacheKey);
$writeCache = false;
示例10: eval
}
($hook = vBulletinHook::fetch_hook('photoplog_settings_letterbar')) ? eval($hook) : false;
eval('$photoplog[\'letter_bar\'] = "' . fetch_template('photoplog_letter_bar') . '";');
}
// ##################### INITIALIZE CATEGORY BITS #########################
if (defined('PHOTOPLOG_RANDOM') && !defined('PHOTOPLOG_HTTPD') && !$photoplog_perm_fileid && !$photoplog_perm_catid && !$photoplog_perm_commentid && !isset($_REQUEST['u']) && !isset($_REQUEST['q']) && !isset($_REQUEST['page']) && !isset($_REQUEST['v'])) {
require_once './listing.php';
}
// ##################### INITIALIZE JAVASCRIPT BIT ########################
$vbulletin->input->clean_array_gpc('c', array(COOKIE_PREFIX . 'photoplogjs' => TYPE_BOOL));
$photoplog['jsactive'] = intval($vbulletin->GPC[COOKIE_PREFIX . 'photoplogjs']);
$photoplog_cookiepath = $vbulletin->options['cookiepath'];
$photoplog_cookiedomain = $vbulletin->options['cookiedomain'];
$vbulletin->options['cookiepath'] = '/';
$vbulletin->options['cookiedomain'] = '';
vbsetcookie('photoplogjs', '0', false);
$vbulletin->options['cookiepath'] = $photoplog_cookiepath;
$vbulletin->options['cookiedomain'] = $photoplog_cookiedomain;
unset($photoplog_cookiepath, $photoplog_cookiedomain);
//##################### INITIALIZE STATISTICS BAR #########################
if (defined('PHOTOPLOG_RANDOM') && !defined('PHOTOPLOG_HTTPD') && !isset($_REQUEST['c']) && !isset($_REQUEST['n']) && !isset($_REQUEST['u']) && !isset($_REQUEST['q']) && !isset($_REQUEST['page']) && !isset($_REQUEST['v'])) {
$photoplog_numbermembers = vb_number_format($vbulletin->userstats['numbermembers']);
$photoplog_activemembers = vb_number_format($vbulletin->userstats['activemembers']);
$photoplog_showactivemembers = $vbulletin->options['activememberdays'] > 0 && $vbulletin->options['activememberoptions'] & 2 ? true : false;
$photoplog_do_sql = "WHERE catid > 0";
$photoplog_do_arr = array();
foreach ($photoplog_ds_catopts as $photoplog_ds_catid => $photoplog_ds_value) {
$photoplog_ds_catid = intval($photoplog_ds_catid);
if ($photoplog_ds_catopts[$photoplog_ds_catid]['parentid'] < 0 && $photoplog_ds_catopts[$photoplog_ds_catid]['displayorder'] != 0) {
$photoplog_child_list = array();
if (isset($photoplog_list_relatives[$photoplog_ds_catid])) {
示例11: process_logout
function process_logout()
{
global $vbulletin;
// clear all cookies beginning with COOKIE_PREFIX
$prefix_length = strlen(COOKIE_PREFIX);
foreach ($_COOKIE as $key => $val) {
$index = strpos($key, COOKIE_PREFIX);
if ($index == 0 and $index !== false) {
$key = substr($key, $prefix_length);
if (trim($key) == '') {
continue;
}
// vbsetcookie will add the cookie prefix
vbsetcookie($key, '', 1);
}
}
if ($vbulletin->userinfo['userid'] and $vbulletin->userinfo['userid'] != -1) {
// init user data manager
$userdata =& datamanager_init('User', $vbulletin, ERRTYPE_SILENT);
$userdata->set_existing($vbulletin->userinfo);
$userdata->set('lastactivity', TIMENOW - $vbulletin->options['cookietimeout']);
$userdata->set('lastvisit', TIMENOW);
$userdata->save();
// make sure any other of this user's sessions are deleted (in case they ended up with more than one)
$vbulletin->db->query_write("DELETE FROM " . TABLE_PREFIX . "session WHERE userid = " . $vbulletin->userinfo['userid']);
}
$vbulletin->db->query_write("DELETE FROM " . TABLE_PREFIX . "session WHERE sessionhash = '" . $vbulletin->db->escape_string($vbulletin->session->vars['dbsessionhash']) . "'");
// Remove accesstoken from apiclient table so that a new one will be generated
if (defined('VB_API') and VB_API === true and $vbulletin->apiclient['apiclientid']) {
$vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "apiclient SET apiaccesstoken = '', userid = 0\n\t\t\tWHERE apiclientid = " . intval($vbulletin->apiclient['apiclientid']));
$vbulletin->apiclient['apiaccesstoken'] = '';
}
if ($vbulletin->session->created == true and !VB_API) {
// if we just created a session on this page, there's no reason not to use it
$newsession = $vbulletin->session;
} else {
// API should always create a new session here to generate a new accesstoken
$newsession = new vB_Session($vbulletin, '', 0, '', $vbulletin->session->vars['styleid']);
}
$newsession->set('userid', 0);
$newsession->set('loggedin', 0);
$newsession->set_session_visibility($vbulletin->superglobal_size['_COOKIE'] > 0);
$vbulletin->session =& $newsession;
($hook = vBulletinHook::fetch_hook('logout_process')) ? eval($hook) : false;
}
示例12: read_input_context
/**
* Reads some context based on general input information
*/
public function read_input_context()
{
global $vbulletin;
$vbulletin->input->clean_array_gpc('r', array(
'referrerid' => TYPE_UINT,
'a' => TYPE_STR,
'nojs' => TYPE_BOOL
));
$vbulletin->input->clean_array_gpc('p', array(
'ajax' => TYPE_BOOL,
));
// #############################################################################
// set the referrer cookie if URI contains a referrerid
if ($vbulletin->GPC['referrerid'] AND !$vbulletin->GPC[COOKIE_PREFIX . 'referrerid'] AND !$vbulletin->userinfo['userid'] AND $vbulletin->options['usereferrer'])
{
if ($referrerid = verify_id('user', $vbulletin->GPC['referrerid'], 0))
{
vbsetcookie('referrerid', $referrerid);
}
}
}
示例13: validateFBSession
/**
* Makes sure local copy of FB session is in synch with actual FB session
*
* @return bool, fb userid if logged in, false otherwise
*/
protected function validateFBSession()
{
// grab the current access token stored locally (in cookie or db depending on login status)
if ($this->registry->userinfo['userid'] == 0) {
$curaccesstoken = $this->registry->input->clean_gpc('c', COOKIE_PREFIX . 'fbaccesstoken', TYPE_STR);
} else {
$curaccesstoken = !empty($this->registry->userinfo['fbaccesstoken']) ? $this->registry->userinfo['fbaccesstoken'] : '';
}
// if we have a new access token that is valid, re-query FB for updated info, and cache it locally
if ($curaccesstoken != $this->facebook->getAccessToken() and $this->isValidAuthToken()) {
// update the userinfo array with fresh facebook data
$this->registry->userinfo['fbaccesstoken'] = $this->facebook->getAccessToken();
//$this->registry->userinfo['fbprofilepicurl'] = $this->fb_userinfo['pic_square'];
// if user is guest, store fb session info in cookie
if ($this->registry->userinfo['userid'] == 0) {
vbsetcookie('fbaccesstoken', $this->facebook->getAccessToken());
vbsetcookie('fbprofilepicurl', $this->fb_userinfo['pic_square']);
} else {
$this->registry->db->query_write("\n\t\t\t\t\tUPDATE " . TABLE_PREFIX . "user\n\t\t\t\t\tSET\n\t\t\t\t\t\tfbaccesstoken = '" . $this->facebook->getAccessToken() . "'\n\t\t\t\t\tWHERE userid = " . $this->registry->userinfo['userid'] . "\n\t\t\t\t");
}
}
}
示例14: vbsetcookie
$mobile_browser = true;
}
}
if ($mobile_browser and preg_match('/(ipad|ipod|iphone|blackberry|android|pre\\/|palm os|palm|hiptop|avantgo|plucker|xiino|blazer|elaine)/i', strtolower($_SERVER['HTTP_USER_AGENT']))) {
$mobile_browser_advanced = true;
}
}
// Set up user's chosen style
if ($vbulletin->GPC['styleid']) {
$styleid =& $vbulletin->GPC['styleid'];
vbsetcookie('userstyleid', $styleid);
if ($styleid == -1) {
vbsetcookie('skipmobilestyle', 1);
$vbulletin->GPC[COOKIE_PREFIX . 'skipmobilestyle'] = 1;
} elseif (isset($vbulletin->options['mobilestyleid_advanced']) and $styleid == $vbulletin->options['mobilestyleid_advanced'] or isset($vbulletin->options['mobilestyleid_basic']) and $styleid == $vbulletin->options['mobilestyleid_basic']) {
vbsetcookie('skipmobilestyle', 0);
$vbulletin->GPC[COOKIE_PREFIX . 'skipmobilestyle'] = 0;
}
} elseif ($mobile_browser_advanced && $vbulletin->options['mobilestyleid_advanced'] && !$vbulletin->GPC[COOKIE_PREFIX . 'skipmobilestyle']) {
$styleid = $vbulletin->options['mobilestyleid_advanced'];
} elseif ($mobile_browser && $vbulletin->options['mobilestyleid_basic'] && !$vbulletin->GPC[COOKIE_PREFIX . 'skipmobilestyle']) {
$styleid = $vbulletin->options['mobilestyleid_basic'];
} elseif ($vbulletin->GPC[COOKIE_PREFIX . 'userstyleid']) {
$styleid = $vbulletin->GPC[COOKIE_PREFIX . 'userstyleid'];
} else {
$styleid = 0;
}
$session = vB_Session::getNewSession(vB::getDbAssertor(), vB::getDatastore(), vB::getConfig(), $sessionhash, $vbulletin->GPC[COOKIE_PREFIX . 'userid'], $vbulletin->GPC[COOKIE_PREFIX . 'password'], $styleid, $languageid);
vB::setCurrentSession($session);
//needs to go after the session
// fetch url of referring page after we have access to vboptions['forumhome']
示例15: FatalError
$RedirectMethod = $Config['RedirectMethod'];
if (!in_array($RedirectMethod, array('SubmitForm', 'SendHeader'))) {
FatalError("Invalid RedirectMethod option: '{$RedirectMethod}'");
}
GetInputData('UserIdentifier', $Username);
GetInputData('LoginMessage', $LoginMessage);
$Username = strip_blank_ascii($Username, ' ');
if ($vbulletin->userinfo = $vbulletin->db->query_first("SELECT userid, usergroupid, membergroupids, username, password, salt \n\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . TABLE_PREFIX . "user \n\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE username = '" . $vbulletin->db->escape_string(htmlspecialchars_uni($Username)) . "'")) {
if ($CookieUser) {
vbsetcookie('userid', $vbulletin->userinfo['userid']);
vbsetcookie('password', md5($vbulletin->userinfo['password'] . COOKIE_SALT));
} else {
if ($vbulletin->{$_COOKIE}[COOKIE_PREFIX . 'userid'] and $_COOKIE[COOKIE_PREFIX . 'userid'] != $vbulletin->userinfo['userid']) {
// If there is cookie from other user, delete it
vbsetcookie('userid', '');
vbsetcookie('password', '');
}
}
} else {
FatalError("Erroneous or empty query result: " . "SELECT userid, usergroupid, membergroupids, username, password, salt FROM " . TABLE_PREFIX . "user WHERE username = '" . $vbulletin->db->escape_string(htmlspecialchars_uni($Username)) . "'");
}
// Create new session
$vbulletin->db->query_write("DELETE FROM " . TABLE_PREFIX . "session \n\t\t\t\t\t\t\t WHERE sessionhash = '" . $vbulletin->db->escape_string($vbulletin->session->vars['dbsessionhash']) . "'");
if ($vbulletin->session->created == true and $vbulletin->session->vars['userid'] == 0) {
$newsession =& $vbulletin->session;
} else {
$newsession =& new vB_Session($vbulletin, '', $vbulletin->userinfo['userid'], '', $vbulletin->session->vars['styleid']);
}
$newsession->set('userid', $vbulletin->userinfo['userid']);
$newsession->set('loggedin', 1);
$newsession->set('bypass', 0);