Jump to content
MakeWebGames

Looking for a Referal Mod ...


Markwick

Recommended Posts

I would like a Mod that is a referals mod where all users are able to go to see how many people have been refered and by which player. Id also like to be able to reset this somehow as id like referal competitions at some point in time. Please help me.

Link to comment
Share on other sites

Re: Looking for a Referal Mod ...

This is the one i made, i made it for hall of fame so you can change it a little if u want,

 

function hof_referals()
{
global $db,$ir,$c,$userid, $myf;
print "Showing the 6 users with the highest number of referals

<table width=75% cellspacing=1 class='table'><tr style='background:gray'> <th>User ID</th> <th>Number of referals</th> </tr>";
$p=0;
$ar=$db->query("SELECT COUNT('refREFED') AS total,refREFER FROM referals GROUP BY refREFER ORDER BY COUNT('referred') DESC LIMIT 10");
while($s = $db->fetch_row($ar))
{
			echo '<tr style="background:brown">';
                       echo '<td>'.$s['refREFER'].'</td>';
		echo '<td>'.$s['total'].'</td>';
		echo  '</tr>';
		}
print "</table>";
Link to comment
Share on other sites

Re: Looking for a Referal Mod ...

iv added that lil code and put the code case "referals":

hof_referals();

break;

init at the top and it still isnt working i get this error

 

Parse error: syntax error, unexpected $end in /home/******/public_html/halloffame.php on line 223

Link to comment
Share on other sites

Re: Looking for a Referal Mod ...

nice idea about this tolk but the one i added of urs dont work so i edited it and now it works on my game here is the edited version

first of off find

 

case "iq":
hof_iq();
break;

 

then under it add

 

case "referal":
hof_referals();
break;

 

then find

 

function hof_iq()
{
global $db,$ir,$c,$userid, $myf;
print "Showing the 20 users with the highest IQ

<table width=75% cellspacing=1 class='table'><tr style='background:gray'> <th>Pos</th> <th>User</th> </tr>";
$q=$db->query("SELECT u.*,g.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid LEFT JOIN gangs g ON g.gangID=u.gang WHERE u.user_level != 0 $myf ORDER BY us.IQ DESC,u.userid ASC LIMIT 20");
$p=0;
while($r=$db->fetch_row($q))
{
$p++;
if($r['userid'] == $ir['userid']) { $t="[b]";$et="[/b]"; } else { $t="";$et=""; }
print "<tr> <td>$t$p$et</td> <td>$t{$r['gangPREF']} {$r['username']} [{$r['userid']}]$et</td> </tr>";
}
print "</table>";
}

 

under it add

 

function hof_referals()
{
global $db,$ir,$c,$userid, $myf;
print "Showing the 6 users with the highest number of referals

<table width=75% cellspacing=1 class='table'><tr style='background:gray'> <th>User ID</th> <th>Number of referals</th> </tr>";
$p=0;
$ar=$db->query("SELECT COUNT('refREFED') AS total,refREFER FROM referals GROUP BY refREFER ORDER BY COUNT('referred') DESC LIMIT 10");
while($s = $db->fetch_row($ar))
{
           echo '<tr style="background:brown">';
                       echo '<td>'.$s['refREFER'].'</td>';
        echo '<td>'.$s['total'].'</td>';
        echo  '</tr>';
        }

 

also to add the link at the top of the page do the following

find

<td>[url='halloffame.php?action=crystals&filter={$filter}']CRYSTALS[/url]</td>

 

directly after it add

<td>[url='halloffame.php?action=referal&filter={$filter}']REFERALS[/url]</td>

 

this is the working version its a good idea tolk not taking credit for it jsut wanting to help out by addin gthe verion i managed to get working because you forgot to add the case files and the link

hope everyone liks the working version as its a good mod ill send a screenshot of it too so u can see the working version

halloffamereferalscreen.png

By Paul_Donna_Luke

Link to comment
Share on other sites

Re: Looking for a Referal Mod ...

Showing the 6 users with the highest number of referals

QUERY ERROR: Invalid use of group function

Query was SELECT COUNT('refREFED') AS total,refREFER FROM referals GROUP BY refREFER ORDER BY COUNT('referred') DESC LIMIT 10

Link to comment
Share on other sites

Re: Looking for a Referal Mod ...

 

Showing the 6 users with the highest number of referals

QUERY ERROR: Invalid use of group function

Query was SELECT COUNT('refREFED') AS total,refREFER FROM referals GROUP BY refREFER ORDER BY COUNT('referred') DESC LIMIT 10

If that's mine then it might not work because I got it off my computer not my FTP and that one may not work. Try Neji's it deffinately works

Link to comment
Share on other sites

  • 1 month later...

Re: Looking for a Referal Mod ...

 

<?php
include 'globals.php';
$ql = sprintf(
"SELECT u.userid, u.username, u.laston,  r.refTIME " .
"FROM users u " .
"LEFT JOIN referals r ON (u.userid = r.refREFED) " .
"WHERE (r.refREFER = %u)", $ir['userid']);
$ql = $db->query($ql);
$st=$db->num_rows($ql);
print "<h3>You have referred $st people.</h3>";

if($r['laston'] >= time()-15*60) { $on="<font color=green>[b]Online[/b]</font>"; } else { $on="<font color=red>[b]Offline[/b]</font>"; }

print "<h3>Referred Users</h3>

  <table border='0' cellspacing='0' cellpadding='0' width='100%' class='table'>
     <tr height='18'>
        <th>User</th>
        <th>Time refered</th>
        <th>Last Online</th>
        <th>Contact</th>
        <th>Status</th>
     </tr>";
while($r=$db->fetch_row($ql))
{
print "<tr>
        <td> [url='viewuser.php?u={$r[']{$r['username']}[/url] [{$r['userid']}]</td>
        <td>{$r['refTIME']}</td>
        <td>".date('F j, Y, g:i:s a',$r['laston'])."</td>
        <td>[url='mailbox.php?action=compose&ID={$r[']Contact[/url]</td>
        <td>$on</td>
     </tr>";
}
?>

 

Should work fine..

Link to comment
Share on other sites

  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...