Jump to content
MakeWebGames

Recommended Posts

Posted

On my game

on hall of frame i have users names that have a double name on it like this

User

1 ~D<>D~ wdragonl [2]

2 DoG Mc_Duff [43]

3 >|< Eternal [36]

4 DoG Gaddo [51]

5 DoG Gaddo [51]

6 {R.K.O} JoshPimm [113]

7 {R.K.O} JoshPimm [113]

8 <DD> hally [9]

9 <DD> hally [9]

10 CrankyBitch [4]

11 *D*E* DragonSoldier [47]

12 ~D<>D~ dagon188 [16]

13 SexyMe [32]

14 SexyMe [32]

15 James Burns [3]

16 dixie darlin [25]

17 dixie darlin [25]

18 jamboy1 [27]

19 jamboy1 [27]

20 ICE-KING [40]

 

how to gt rid of doubles the code is

<?php

include "globals.php";

$filters=array(

'nodon' => 'AND donatordays=0',

'don' => 'AND donatordays > 0',

'all' => '');

$filter=(isset($filters[$_GET['filter']])) ? $_GET['filter'] : 'all';

$myf=$filters[$filter];

$bt1=($filter=="nodon") ? "" : "";

$bet1=($filter=="nodon") ? "" : "";

$bt2=($filter=="don") ? "" : "";

$bet2=($filter=="don") ? "" : "";

$bt3=($filter=="all") ? "" : "";

$bet3=($filter=="all") ? "" : "";

print "<h3>Hall Of Fame</h3><hr />

Filter: [$bt1Non-Donators$bet1 | $bt2Donators$bet2 | $bt3All Users$bet3]<hr />

<table width=75% cellspacing=1 class='table'> <tr> <td>LEVEL</td> <td>MONEY</td> <td>RESPECT</td> <td>CRYSTALS</td> <td>TOTAL STATS</td> </tr>

<tr> <td>STRENGTH</td> <td>AGILITY</td> <td>GUARD</td> <td>LABOUR</td> <td>IQ</td> </tr> </table>";

switch($_GET['action'])

{

case "level":

hof_level();

break;

case "money":

hof_money();

break;

case "crystals":

hof_crystals();

break;

case "respect":

hof_respect();

break;

case "total":

hof_total();

break;

case "strength":

hof_strength();

break;

case "agility":

hof_agility();

break;

case "guard":

hof_guard();

break;

case "labour":

hof_labour();

break;

case "iq":

hof_iq();

break;

}

function hof_level()

{

global $db,$ir,$c,$userid, $myf;

print "Showing the 20 users with the highest levels

<table width=75% cellspacing=1 class='table'><tr style='background:gray'> <th>Pos</th> <th>User</th> <th>Level</th> </tr>";

$q=$db->query("SELECT u.*,g.* FROM users u LEFT JOIN gangs g ON g.gangID=u.gang WHERE u.user_level != 0 $myf ORDER BY level DESC,userid ASC LIMIT 20");

$p=0;

while($r=$db->fetch_row($q))

{

$p++;

if($r['userid'] == $userid) { $t="";$et=""; } else { $t="";$et=""; }

print "<tr> <td>$t$p$et</td> <td>$t{$r['gangPREF']} {$r['username']} [{$r['userid']}]$et</td> <td>$t{$r['level']}$et</td> </tr>";

}

print "</table>";

}

function hof_money()

{

global $db,$ir,$c,$userid, $myf;

print "Showing the 20 users with the highest amount of money

<table width=75% cellspacing=1 class='table'><tr style='background:gray'> <th>Pos</th> <th>User</th> <th>Money</th> </tr>";

$q=$db->query("SELECT u.*,g.* FROM users u LEFT JOIN gangs g ON g.gangID=u.gang WHERE u.user_level != 0 $myf ORDER BY money DESC,userid ASC LIMIT 20");

$p=0;

while($r=$db->fetch_row($q))

{

$p++;

if($r['userid'] == $userid) { $t="";$et=""; } else { $t="";$et=""; }

print "<tr> <td>$t$p$et</td> <td>$t{$r['gangPREF']} {$r['username']} [{$r['userid']}]$et</td> <td>$t\$".money_formatter($r['money'],'')."$et</td> </tr>";

}

print "</table>";

}

function hof_crystals()

{

global $db,$ir,$c,$userid, $myf;

print "Showing the 20 users with the highest amount of crystals

<table width=75% cellspacing=1 class='table'><tr style='background:gray'> <th>Pos</th> <th>User</th> <th>Crystals</th> </tr>";

$q=$db->query("SELECT u.*,g.* FROM users u LEFT JOIN gangs g ON g.gangID=u.gang WHERE u.user_level != 0 $myf ORDER BY crystals DESC,userid ASC LIMIT 20");

$p=0;

while($r=$db->fetch_row($q))

{

$p++;

if($r['userid'] == $userid) { $t="";$et=""; } else { $t="";$et=""; }

print "<tr> <td>$t$p$et</td> <td>$t{$r['gangPREF']} {$r['username']} [{$r['userid']}]$et</td> <td>$t".money_formatter($r['crystals'],'')."$et</td> </tr>";

}

print "</table>";

}

function hof_respect()

{

global $db,$ir,$c,$userid;

print "Showing the 20 gangs with the highest amount of respect

<table width=75% cellspacing=1 class='table'><tr style='background:gray'> <th>Pos</th> <th>Gang</th> <th>Respect</th> </tr>";

$q=$db->query("SELECT * FROM gangs ORDER BY gangRESPECT DESC,gangID ASC LIMIT 20");

$p=0;

while($r=$db->fetch_row($q))

{

$p++;

if($r['gangID'] == $ir['gang']) { $t="";$et=""; } else { $t="";$et=""; }

print "<tr> <td>$t$p$et</td> <td>$t{$r['gangNAME']} [{$r['gangID']}]$et</td> <td>$t".money_formatter($r['gangRESPECT'],'')."$et</td> </tr>";

}

print "</table>";

}

function hof_total()

{

global $db,$ir,$c,$userid, $myf;

print "Showing the 20 users with the highest total stats

<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.strength+us.agility+us.guard+us.labour+us.IQ) DESC,u.userid ASC LIMIT 20");

$p=0;

while($r=$db->fetch_row($q))

{

$p++;

if($r['userid'] == $ir['userid']) { $t="";$et=""; } else { $t="";$et=""; }

print "<tr> <td>$t$p$et</td> <td>$t{$r['gangPREF']} {$r['username']} [{$r['userid']}]$et</td> </tr>";

}

print "</table>";

}

function hof_strength()

{

global $db,$ir,$c,$userid, $myf;

print "Showing the 20 users with the highest strength

<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.strength DESC,u.userid ASC LIMIT 20");

$p=0;

while($r=$db->fetch_row($q))

{

$p++;

if($r['userid'] == $ir['userid']) { $t="";$et=""; } else { $t="";$et=""; }

print "<tr> <td>$t$p$et</td> <td>$t{$r['gangPREF']} {$r['username']} [{$r['userid']}]$et</td> </tr>";

}

print "</table>";

}

function hof_agility()

{

global $db,$ir,$c,$userid, $myf;

print "Showing the 20 users with the highest agility

<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.agility DESC,u.userid ASC LIMIT 20");

$p=0;

while($r=$db->fetch_row($q))

{

$p++;

if($r['userid'] == $ir['userid']) { $t="";$et=""; } else { $t="";$et=""; }

print "<tr> <td>$t$p$et</td> <td>$t{$r['gangPREF']} {$r['username']} [{$r['userid']}]$et</td> </tr>";

}

print "</table>";

}

function hof_guard()

{

global $db,$ir,$c,$userid, $myf;

print "Showing the 20 users with the highest guard

<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.guard DESC,u.userid ASC LIMIT 20");

$p=0;

while($r=$db->fetch_row($q))

{

$p++;

if($r['userid'] == $ir['userid']) { $t="";$et=""; } else { $t="";$et=""; }

print "<tr> <td>$t$p$et</td> <td>$t{$r['gangPREF']} {$r['username']} [{$r['userid']}]$et</td> </tr>";

}

print "</table>";

}

function hof_labour()

{

global $db,$ir,$c,$userid, $myf;

print "Showing the 20 users with the highest labour

<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.labour DESC,u.userid ASC LIMIT 20");

$p=0;

while($r=$db->fetch_row($q))

{

$p++;

if($r['userid'] == $ir['userid']) { $t="";$et=""; } else { $t="";$et=""; }

print "<tr> <td>$t$p$et</td> <td>$t{$r['gangPREF']} {$r['username']} [{$r['userid']}]$et</td> </tr>";

}

print "</table>";

}

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="";$et=""; } else { $t="";$et=""; }

print "<tr> <td>$t$p$et</td> <td>$t{$r['gangPREF']} {$r['username']} [{$r['userid']}]$et</td> </tr>";

}

print "</table>";

}

$h->endpage();

?>

Posted

Re: Problem

 

<?php
include "globals.php";
$filters=array(
'nodon' => 'AND donatordays=0',
'don' => 'AND donatordays > 0',
'all' => '');
$filter=(isset($filters[$_GET['filter']])) ? $_GET['filter'] : 'all';
$myf=$filters[$filter];
$bt1=($filter=="nodon") ? "[b]" : "";
$bet1=($filter=="nodon") ? "[/b]" : "";
$bt2=($filter=="don") ? "[b]" : "";
$bet2=($filter=="don") ? "[/b]" : "";
$bt3=($filter=="all") ? "[b]" : "";
$bet3=($filter=="all") ? "[/b]" : "";
print "<h3>Hall Of Fame</h3><hr />
Filter: [$bt1[url='halloffame.php?action={$_GET[']Non-Donators[/url]$bet1 | $bt2[url='halloffame.php?action={$_GET[']Donators[/url]$bet2 | $bt3[url='halloffame.php?action={$_GET[']All Users[/url]$bet3]<hr />
<table width=75% cellspacing=1 class='table'> <tr> <td>[url='halloffame.php?action=level&filter={$filter}']LEVEL[/url]</td> <td>[url='halloffame.php?action=money&filter={$filter}']MONEY[/url]</td> <td>[url='halloffame.php?action=respect&filter={$filter}']RESPECT[/url]</td> <td>[url='halloffame.php?action=crystals&filter={$filter}']CRYSTALS[/url]</td> <td>[url='halloffame.php?action=total&filter={$filter}']TOTAL STATS[/url]</td> </tr>
<tr> <td>[url='halloffame.php?action=strength&filter={$filter}']STRENGTH[/url]</td> <td>[url='halloffame.php?action=agility&filter={$filter}']AGILITY[/url]</td> <td>[url='halloffame.php?action=guard&filter={$filter}']GUARD[/url]</td> <td>[url='halloffame.php?action=labour&filter={$filter}']LABOUR[/url]</td> <td>[url='halloffame.php?action=iq&filter={$filter}']IQ[/url]</td> </tr> </table>";
switch($_GET['action'])
{
case "level":
hof_level();
break;
case "money":
hof_money();
break;
case "crystals":
hof_crystals();
break;
case "respect":
hof_respect();
break;
case "total":
hof_total();
break;
case "strength":
hof_strength();
break;
case "agility":
hof_agility();
break;
case "guard":
hof_guard();
break;
case "labour":
hof_labour();
break;
case "iq":
hof_iq();
break;
}
function hof_level()
{
global $db,$ir,$c,$userid, $myf;
print "Showing the 20 users with the highest levels

<table width=75% cellspacing=1 class='table'><tr style='background:gray'> <th>Pos</th> <th>User</th> <th>Level</th> </tr>";
$q=$db->query("SELECT u.*,g.* FROM users u LEFT JOIN gangs g ON g.gangID=u.gang WHERE u.user_level != 0 $myf ORDER BY level DESC,userid ASC LIMIT 20");
$p=0;
while($r=$db->fetch_row($q))
{
$p++;
if($r['userid'] == $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> <td>$t{$r['level']}$et</td> </tr>";
}
print "</table>";
}
function hof_money()
{
global $db,$ir,$c,$userid, $myf;
print "Showing the 20 users with the highest amount of money

<table width=75% cellspacing=1 class='table'><tr style='background:gray'> <th>Pos</th> <th>User</th> <th>Money</th> </tr>";
$q=$db->query("SELECT u.*,g.* FROM users u LEFT JOIN gangs g ON g.gangID=u.gang WHERE u.user_level != 0 $myf ORDER BY money DESC,userid ASC LIMIT 20");
$p=0;
while($r=$db->fetch_row($q))
{
$p++;
if($r['userid'] == $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> <td>$t\$".money_formatter($r['money'],'')."$et</td> </tr>";
}
print "</table>";
}
function hof_crystals()
{
global $db,$ir,$c,$userid, $myf;
print "Showing the 20 users with the highest amount of crystals

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

function hof_respect()
{
global $db,$ir,$c,$userid;
print "Showing the 20 gangs with the highest amount of respect

<table width=75% cellspacing=1 class='table'><tr style='background:gray'> <th>Pos</th> <th>Gang</th> <th>Respect</th> </tr>";
$q=$db->query("SELECT * FROM gangs ORDER BY gangRESPECT DESC,gangID ASC LIMIT 20");
$p=0;
while($r=$db->fetch_row($q))
{
$p++;
if($r['gangID'] == $ir['gang']) { $t="[b]";$et="[/b]"; } else { $t="";$et=""; }
print "<tr> <td>$t$p$et</td> <td>$t{$r['gangNAME']} [{$r['gangID']}]$et</td> <td>$t".money_formatter($r['gangRESPECT'],'')."$et</td> </tr>";
}
print "</table>";
}

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

<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.strength+us.agility+us.guard+us.labour+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>";
}
function hof_strength()
{
global $db,$ir,$c,$userid, $myf;
print "Showing the 20 users with the highest strength

<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.strength 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>";
}
function hof_agility()
{
global $db,$ir,$c,$userid, $myf;
print "Showing the 20 users with the highest agility

<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.agility 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>";
}
function hof_guard()
{
global $db,$ir,$c,$userid, $myf;
print "Showing the 20 users with the highest guard

<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.guard 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>";
}
function hof_labour()
{
global $db,$ir,$c,$userid, $myf;
print "Showing the 20 users with the highest labour

<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.labour 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>";
}
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>";
}
$h->endpage();
?>

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...