Re: v2 hall of shame
As im new to coding, im not that good at converting so i had a go at converting this. please correct me if i am wrong as i could learn by my mistakes.
Hall Of Shame V1:
<?php
session_start();
require "global_func.php";
if($_SESSION['loggedin']==0) { header("Location: login.php");exit; }
$userid=$_SESSION['userid'];
require "header.php";
$h = new headers;
$h->startheaders();
include "mysql.php";
global $c;
$is=mysql_query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid",$c) or die(mysql_error());
$ir=mysql_fetch_array($is);
check_level();
$fm=money_formatter($ir['money']);
$cm=money_formatter($ir['crystals'],'');
$lv=date('F j, Y, g:i a',$ir['laston']);
$h->userdata($ir,$lv,$fm,$cm);
$h->menuarea();
$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 Shame</h3><hr />
Filter: [$bt1[url='hos.php?action={$_GET[']Non-Donators[/url]$bet1 | $bt2[url='hos.php?action={$_GET[']Donators[/url]$bet2 | $bt3[url='hos.php?action={$_GET[']All Users[/url]$bet3]<hr />
<table width=75% cellspacing=1 class='table'> <tr> <td>[url='hos.php?action=level&filter={$filter}']LEVEL[/url]</td> <td>[url='hos.php?action=money&filter={$filter}']MONEY[/url]</td> <td>[url='hos.php?action=respect&filter={$filter}']RESPECT[/url]</td> <td>[url='hos.php?action=crystals&filter={$filter}']CRYSTALS[/url]</td> <td>[url='hos.php?action=total&filter={$filter}']TOTAL STATS[/url]</td> </tr>
<tr> <td>[url='hos.php?action=strength&filter={$filter}']STRENGTH[/url]</td> <td>[url='hos.php?action=agility&filter={$filter}']AGILITY[/url]</td> <td>[url='hos.php?action=guard&filter={$filter}']GUARD[/url]</td> <td>[url='hos.php?action=labour&filter={$filter}']LABOUR[/url]</td> <td>[url='hos.php?action=iq&filter={$filter}']IQ[/url]</td> </tr> </table>";
switch($_GET['action'])
{
case "level":
hof_level();
break;
case "money":
hof_money();
break;
case "credits":
hof_credits();
break;
case "respect":
hof_respect();
break;
case "total":
hof_total();
break;
case "strength":
hof_strength();
break;
case "speed":
hof_speed();
break;
case "defence":
hof_defence();
break;
case "dexterity":
hof_dexterity();
break;
case "work":
hof_work();
break;
}
function hof_level()
{
global $ir,$db,$userid,$h;
print "Showing the 20 users with the Lowest levels
<table width=75%><tr style='background:black'> <th>Pos</th> <th>User</th> <th>Level</th> </tr>";
$q=mysql_query("SELECT u.*,g.* FROM users u LEFT JOIN gangs g ON g.gangID=u.gang WHERE u.user_level != 0 ORDER BY level ASC,userid ASC LIMIT 20");
$p=0;
while($r=mysql_fetch_row($q))
{
$p++;
if($r['userid'] == $userid) { $t="[b]";$et="[/b]"; } else { $t="";$et=""; }
print "<tr> <td>$t$p$et</td> <td>{$r['username']} [{$r['userid']}]$et</td> <td>$t{$r['level']}$et</td> </tr>";
}
print "</table>";
}
function hof_money()
{
global $ir,$db,$userid,$h;
print "Showing the 10 users with the LOWEST amount of money
<table width=75%><tr style='background:black'> <th>Pos</th> <th>User</th> <th>Money</th> </tr>";
$q=mysql_query("SELECT u.*,g.* FROM users u LEFT JOIN gangs g ON g.gangID=u.gang WHERE u.user_level != 0 ORDER BY money ASC,userid ASC LIMIT 20");
$p=0;
while($r=mysql_fetch_row($q))
{
$p++;
if($r['userid'] == $userid) { $t="[b]";$et="[/b]"; } else { $t="";$et=""; }
print "<tr> <td>$t$p$et</td> <td>{$r['username']} [{$r['userid']}]$et</td> <td>$t\$".money_formatter($r['money'],'')."$et</td> </tr>";
}
print "</table>";
}
function hof_credits()
{
global $ir,$db,$userid,$h;
print "Showing the 20 users with the LOWEST amount of credits
<table width=75%><tr style='background:black'> <th>Pos</th> <th>User</th> <th>credits</th> </tr>";
$q=mysql_query("SELECT u.*,g.* FROM users u LEFT JOIN gangs g ON g.gangID=u.gang WHERE u.user_level != 0 ORDER BY credits ASC,userid ASC LIMIT 50");
$p=0;
while($r=mysql_fetch_row($q))
{
$p++;
if($r['userid'] == $userid) { $t="[b]";$et="[/b]"; } else { $t="";$et=""; }
print "<tr> <td>$t$p$et</td> <td>{$r['username']} [{$r['userid']}]$et</td> <td>$t".money_formatter($r['credits'],'')."$et</td> </tr>";
}
print "</table>";
}
function hof_respect()
{
global $ir,$db,$userid,$h;
print "Showing the 20 Forces with the LOWEST amount of respect
<table width=75%><tr style='background:black'> <th>Position</th> <th>Force</th> <th>Respect</th> </tr>";
$q=mysql_query("SELECT * FROM gangs ORDER BY gangRESPECT ASC,gangID ASC LIMIT 50");
$p=0;
while($r=mysql_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 $ir,$db,$userid,$h;
print "Showing the 20 users with the LOWEST total stats
<table width=75%><tr style='background:black'> <th>Pos</th> <th>User</th> </tr>";
$q=mysql_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 ORDER BY (us.strength+us.agility+us.guard+us.labour+us.IQ) ASC,u.userid ASC LIMIT 20");
$p=0;
while($r=mysql_fetch_row($q))
{
$p++;
if($r['userid'] == $ir['userid']) { $t="[b]";$et="[/b]"; } else { $t="";$et=""; }
print "<tr> <td>$t$p$et</td> <td>{$r['username']} [{$r['userid']}]$et</td> </tr>";
}
print "</table>";
}
function hof_strength()
{
global $ir,$db,$userid,$h;
print "Showing the 20 users with the LOWEST strength
<table width=75%><tr style='background:black'> <th>Pos</th> <th>User</th> </tr>";
$q=mysql_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 ORDER BY us.strength ASC,u.userid ASC LIMIT 50");
$p=0;
while($r=mysql_fetch_row($q))
{
$p++;
if($r['userid'] == $ir['userid']) { $t="[b]";$et="[/b]"; } else { $t="";$et=""; }
print "<tr> <td>$t$p$et</td> <td>{$r['username']} [{$r['userid']}]$et</td> </tr>";
}
print "</table>";
}
function hof_speed()
{
global $ir,$db,$userid,$h;
print "Showing the 20 users with the LOWEST speed
<table width=75%><tr style='background:black'> <th>Pos</th> <th>User</th> </tr>";
$q=mysql_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 ORDER BY us.agility ASC,u.userid ASC LIMIT 20");
$p=0;
while($r=mysql_fetch_row($q))
{
$p++;
if($r['userid'] == $ir['userid']) { $t="[b]";$et="[/b]"; } else { $t="";$et=""; }
print "<tr> <td>$t$p$et</td> <td>{$r['username']} [{$r['userid']}]$et</td> </tr>";
}
print "</table>";
}
function hof_defence()
{
global $ir,$db,$userid,$h;
print "Showing the 20 users with the LOWEST defence
<table width=75%><tr style='background:black'> <th>Pos</th> <th>User</th> </tr>";
$q=mysql_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 ORDER BY us.guard ASC,u.userid ASC LIMIT 20");
$p=0;
while($r=mysql_fetch_row($q))
{
$p++;
if($r['userid'] == $ir['userid']) { $t="[b]";$et="[/b]"; } else { $t="";$et=""; }
print "<tr> <td>$t$p$et</td> <td>{$r['username']} [{$r['userid']}]$et</td> </tr>";
}
print "</table>";
}
function hof_dexterity()
{
global $ir,$db,$userid,$h;
print "Showing the 20 users with the LOWEST dexterity
<table width=75%><tr style='background:black'> <th>Pos</th> <th>User</th> </tr>";
$q=mysql_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 ORDER BY us.labour ASC,u.userid ASC LIMIT 20");
$p=0;
while($r=mysql_fetch_row($q))
{
$p++;
if($r['userid'] == $ir['userid']) { $t="[b]";$et="[/b]"; } else { $t="";$et=""; }
print "<tr> <td>$t$p$et</td> <td>{$r['username']} [{$r['userid']}]$et</td> </tr>";
}
print "</table>";
}
function hof_work()
{
global $ir,$db,$userid,$h;
print "Showing the 20 users with the LOWEST iq
<table width=75%><tr style='background:black'> <th>Pos</th> <th>User</th> </tr>";
$q=mysql_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 ORDER BY us.IQ ASC,u.userid ASC LIMIT 20");
$p=0;
while($r=mysql_fetch_row($q))
{
$p++;
if($r['userid'] == $ir['userid']) { $t="[b]";$et="[/b]"; } else { $t="";$et=""; }
print "<tr> <td>$t$p$et</td> <td>{$r['username']} [{$r['userid']}]$et</td> </tr>";
}
print "</table>";
}
$h->endpage();
?>
Oops missed out a bit, should be fixed now :lol: