Okay, you got some excess queries and code here...
There is no reason behind veryfind referrer's id, because it is already verified by vBulletin... All you need to do is this:
After
PHP Code:
if (!$testreferrerid = $DB_site->query_first("SELECT userid FROM " . TABLE_PREFIX . "user WHERE username = '" . addslashes(htmlspecialchars_uni($_POST['referrername'])) . "'"))
{
eval('$errors[130] = "' . fetch_phrase('badreferrer', PHRASETYPEID_ERROR) . '";');
}
Add
PHP Code:
else
{
$DB_site->query("
UPDATE " . TABLE_PREFIX . "usertextfield
SET buddylist = TRIM(CONCAT(buddylist, ' ', '$testreferrerid[userid]'))
WHERE username = '" . addslashes(htmlspecialchars_uni($_POST['referrername'])) . "'
");
}
And this
PHP Code:
if ($referrer)
{
// Put it in the database.
$DB_site->query("
UPDATE " . TABLE_PREFIX . "usertextfield
SET buddylist = '" . addslashes($testreferrerid[userid]) . "'
WHERE userid = $userid
");
}
Should be replaced by
PHP Code:
if ($referrer)
{
// Put it in the database.
$DB_site->query("
UPDATE " . TABLE_PREFIX . "usertextfield
SET buddylist = '$testreferrerid[userid]'
WHERE userid = '$userid';
");
}
Oops, looks like I have rewritten your hack. Oh well.. :P