Installation:
0. Download the attached zip file and extract it.
1. Create a new file named referrerlist.php and in it put the content of referrerlist.txt in it. Config $shownorefs.
2. Create a new template named reflist and put the content of reflist.txt in it.
3. Create a new template named reflistbit and put the content of reflistbit.txt in it.
4. Add an index to the field referredid in the table user.
5. Add a link to referrerlist.php?s=$session[sessionhash] anywhere you want.
Good luck, and feedback is welcomed!
Show Your Support
This modification may not be copied, reproduced or published elsewhere without author's permission.
I think I just found a bug in vb. Notice that my vbcode for php is correct (i think)
yet when you use 3 php's the /php code doesn't seem to work....and it indents and puts funny colors.
// TopReferrer List Hack ############################################
// Hacked by: FireFly with help from dwh,unixman,Freddie,Bane
// Config #######################################################
$max=100; //This number decides how many users to display
$userx=0; //Users to exclude from topreferrer Seperate with , (0 for none)
$userl=0; //Users to exclude from topreferrer list Seperate with , (0 for none)
// Get Top List ###################################################
$referrers = $DB_site->query("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 ($userl)
GROUP BY users.referrerid
ORDER BY referrals DESC
LIMIT $max");
while ($referrer=$DB_site->fetch_array($referrers)) {
$referreds = $DB_site->query("SELECT username,userid FROM user WHERE referrerid = '$referrer[userid]'");
$referrerlist = "<SELECT NAME='newLoc' onChange='jumpPage(this.form.newLoc)' style='font-size: 7pt; background-color: #dfdfdf; font-family: Arial, Tahoma;' maxlength='25'><OPTION VALUE='#'>------------Select------------</OPTION>";
while ($referred = $DB_site->fetch_array($referreds)){
if ($referrerlist) {
$referrerlist.="<OPTION VALUE='member.php?s=$session[sessionhash]&action=getinfo&userid=$referred[userid]'>$referred[username]</OPTION>";
}
}
$referrerlist.="</select>";
eval("\$reflistbits .= "".gettemplate("referrer_listbit")."";");
$referrerlist="";
}
// Get Topreferrer #################################################
if ($usereferrer) {
$ref = $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 ($userx)
GROUP BY users.referrerid
ORDER BY referrals DESC
LIMIT 1");
Do you have phpMyAdmin? Or have any other way to do an sql command? It may be an issue with the data in the database. If you can do an sql call run this query:
PHP Code:
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 (0)
GROUP BY users.referrerid
ORDER BY referrals DESC
LIMIT 100
I wouldn't be surprised if you get some weird result, but either way, post results here and we'll take it from there.
BTW, I really like your site design. You have a good eye for design.
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 (0)
GROUP BY users.referrerid
ORDER BY referrals DESC