The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
code help
Ok I managed to get alot of this ported hack working, but when I go into my admincp->users->my admin account->Add Linked Accounts to (user)
I then enter the userid to link to, a list of all accounts show up, that doesn't bother me, I click on (Link) which then is supposed to link the 2 accounts together but instead it does nothing, its supposed to give a message stating the accounts were linked. Any ideas what could be wrong? I am providing the code that I had to use and the qas.php file. If you wish to look over it and provide better feedback, please do. It suggested I check that 'u' is being converted to 'userid' but I have no clue what I'm looking for when it comes to that. global.php add in code: HTML Code:
# Quick Account Switch v1.2 unset($account_master); // empty markup for good measure if ($bbuserinfo['userid']) // verify we are logged on { if ($bbuserinfo['qas']) // slave or master account defined? { $qas = unserialize($bbuserinfo['qas']); foreach ($qas as $qas_acct => $qas_acct_value) { if ('m'==$qas_acct_value['type']) // we are a master account to this slave account { $account_master .= "<tr><td class=\"vbmenu_option\"><a href=\"login.php?do=switch&id=$qas_acct_value[userid]\">" . base64_decode($qas_acct_value['username']) ."</a></td></tr>"; } else // we are a slave account to this master account { $qasmast=fetch_userinfo($qas_acct_value['userid'], 0); // get master account's QAS details // add master account at the top of the list $account_master .= "<tr><td class=\"vbmenu_option\"><a href=\"login.php?do=switch&id=$qasmast[userid]\">$qasmast[username]</a></td></tr>"; // add all slaves except myself $qas2 = unserialize($qasmast['qas']); foreach ($qas2 as $qas_acct2 => $qas_acct_value2) { if ($qas_acct_value2['userid'] != $bbuserinfo['userid']) // if I'm not this slave { $account_master .= "<tr><td class=\"vbmenu_option\"><a href=\"login.php?do=switch&id=$qas_acct_value2[userid]\">" . base64_decode($qas_acct_value2['username']) . "</a></td></tr>"; } } } } } } # /Quick Account Switch v1.2 HTML Code:
// ##### start do switch # Quick Account Switch v1.2 ##### if ($_REQUEST['do'] == 'switch') { globalize($_REQUEST, array('url' => STR, 'userid' => INT)); $allow_switch = false; if (($bbuserinfo['userid']) && $_REQUEST['id']) { $id_from = $bbuserinfo['userid']; $id_to = $_REQUEST['id']; if ($bbuserinfo['qas']) // slave or master account defined? { $qas = unserialize($bbuserinfo['qas']); foreach ($qas as $qas_acct => $qas_acct_value) { if ('m'==$qas_acct_value['type']) // we are a master account to this slave account { if ($id_to == $qas_acct_value['userid']) $allow_switch = true; } else // we are a slave account to this master account { if ($id_to == $qas_acct_value['userid']) { // are we switching to the master account? $allow_switch = true; } else { // check the slaves $qasmast=fetch_userinfo($qas_acct_value['userid'], 0); // get master account's QAS details // allow switching to all but myself, since that's futile $qas2 = unserialize($qasmast['qas']); foreach ($qas2 as $qas_acct2 => $qas_acct_value2) { if ($qas_acct_value2['userid'] != $bbuserinfo['userid']) // if I'm not this slave { if ($id_to == $qas_acct_value2['userid']) $allow_switch = true; } } } } } } } if ($logintype === 'cplogin' OR $logintype === 'modcplogin') $allow_switch = false; if ($allow_switch == false) { eval(print_standard_error('logout_missing_userid')); } else { // 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; } if ($key != 'sessionhash') vbsetcookie($key, '', 1); } } if ($bbuserinfo['userid'] != 0 AND $bbuserinfo['userid'] != -1) { $DB_site->query(" UPDATE " . TABLE_PREFIX . "user SET lastactivity = " . (TIMENOW - $vboptions['cookietimeout']) . ", lastvisit = " . TIMENOW . " WHERE userid = $bbuserinfo[userid] "); // make sure any other of this user's sessions are deleted (in case they ended up with more than one) $DB_site->query("DELETE FROM " . TABLE_PREFIX . "session WHERE userid = $bbuserinfo[userid]"); } // clear current sessionhash $DB_site->query("DELETE FROM " . TABLE_PREFIX . "session WHERE sessionhash = '" . addslashes($session['dbsessionhash']) . "'"); // so much for logging out, lets login the assumed user $bbuserinfo = $DB_site->query_first("SELECT userid, usergroupid, membergroupids, username, password, salt FROM " . TABLE_PREFIX . "user WHERE userid = '" . $id_to . "'"); vbsetcookie('userid', $bbuserinfo['userid']); // *** put your license code here or it'll not work *** you can find it at the top of this file (login.php) // the format is Lxxxxxxx, where 'xxxxxxx' is a set of numbers/letters, 0-9, a-f. // replace <*** your license code ***> in the next line with this code, between the single quotes. vbsetcookie('password', md5($bbuserinfo['password'] . '<*** your license code ***>')); exec_unstrike_user($bbuserinfo['username']); $DB_site->query("DELETE FROM " . TABLE_PREFIX . "session WHERE sessionhash = '" . addslashes($session['dbsessionhash']) . "'"); $session['sessionhash'] = fetch_sessionhash(); $session['dbsessionhash'] = $session['sessionhash']; $DB_site->query(" INSERT INTO " . TABLE_PREFIX . "session (sessionhash, userid, host, idhash, lastactivity, styleid, loggedin, bypass, useragent) VALUES ('" . addslashes($session['sessionhash']) . "', " . intval($bbuserinfo['userid']) . ", '" . addslashes(SESSION_HOST) . "', '" . addslashes(SESSION_IDHASH) . "', " . TIMENOW . ", $session[styleid], 1, " . iif ($logintype === 'cplogin', 1, 0) . ", '" . addslashes(USER_AGENT) . "') "); vbsetcookie('sessionhash', $session['sessionhash'], 0); if ($nosessionhash == 1) { // if user is working through cookies, blank out the sessionhash $shash = $session['sessionhash'] = ''; $surl = $session['sessionurl'] = ''; $surlJS = $session['sessionurl_js'] = ''; } else { $shash = $session['sessionhash']; $surl = $session['sessionurl'] = 's=' . $session['sessionhash'] . '&'; $surlJS = $session['sessionurl_js'] = 's=' . $session['sessionhash'] . '&'; } if ($url == 'login.php' OR $url == "$vboptions[forumhome].php" OR strpos($url, 'do=logout') !== false) { $url = "$vboptions[forumhome].php?$surl"; } else { $url = fetch_replaced_session_url($url); } $postvars = construct_hidden_var_fields($postvars); $temp = strpos($url, '?'); if ($temp) { $formfile = substr($url, 0, $temp); } else { $formfile = $url; } eval(print_standard_redirect('redirect_login')); } } HTML Code:
// Quick Account Switch 1.2 - Start $qas_is_slave=false; print_table_header($vbphrase['qas_version']); if (!empty($user['qas'])) { $qas = unserialize($user['qas']); foreach ($qas as $qas_acct => $qas_acct_value) { if ('m'==$qas_acct_value['type']) // we are a master account to this slave account { $qas_link = "(<a href=\"user.php?$session[sessionurl]&do=edit&u=$qas_acct_value[userid]\">$vbphrase[profile]</a>)"; // parameters: u2 (slave), u (master) $qas_link .= " (<a href=\"qas.php?$session[sessionurl]&do=qasunlink&u=$user[userid]&u2=$qas_acct_value[userid]\">$vbphrase[qas_unlink]</a>)"; print_label_row($vbphrase['qas_master_to'] . ' ' . base64_decode($qas_acct_value['username']), $qas_link); } else // we are a slave account to this master account { $qas_link = "(<a href=\"user.php?$session[sessionurl]&do=edit&u=$qas_acct_value[userid]\">$vbphrase[profile]</a>)"; $qas_link .= " (<a href=\"qas.php?$session[sessionurl]&do=qasunlink&u=$qas_acct_value[userid]&u2=$user[userid]\">$vbphrase[qas_unlink]</a>)"; print_label_row($vbphrase['qas_slave_to'] . ' ' . base64_decode($qas_acct_value['username']), $qas_link); $qas_is_slave = true; } } } else { print_label_row($vbphrase['qas_no_accounts'], '', '', 'top', 'noslaves'); } if (!$qas_is_slave) { $qas_link = " <a href=\"qas.php?$session[sessionurl]&do=qaslink&u=$user[userid]\">$vbphrase[qas_add_to] $user[username]</a>"; print_description_row($qas_link); } print_table_break('', $INNERTABLEWIDTH); // Quick Account Switch 1.2 - End Cheers and thanks Myth |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|