I think you have an error in the following line for the index.php modification:
PHP Code:
$topref = $DB_site->query_first("SELECT COUNT(*) AS referrals, user.username, user.userid FROM user AS users LEFT JOIN user ON (users.referrerid = user.userid) WHERE users.referrerid <> 0 AND user.userid NOT IN ($norefer1) GROUP BY users.referrerid ORDER BY referrals DESC LIMIT 1");
I get a mySQL error there. Looking at the code I think that the variable $norefer1 isn't defined.