//////////////////////////// PHP SCRIPT /////////////////////////////
$host = "host"; // MySQL database hostname
$user = "user"; // SQL Username
$dbank = "amx"; // SQL Database
$pw = "pass"; // SQL Password
$title = "Player Rankings"; // Title of the page
$showamount = 300; // Amount of players displayed per page
///////////////////////////////////////////////////////////////////////////
if ($_GET['type'] == "") {
$rankstable="sqlstatstable";
} else {
$rankstable=$_GET['type'];
}
?>
<title>
<? echo $title ?>
</title>
</Head>
<Body bgcolor=000000
bgproperties="fixed"
Topmargin="0"
Leftmargin="5"
Rightmargin="5"
Marginheight="0"
Marginwidth="0"
ALINK="999999"
VLINK="999999"
LINK="999999" >
<center>
<?php
$conn = mysql_connect($host, $user, $pw) or die("no connection to database, please try again later");
mysql_select_db ($dbank) or die ("no connection to database, please try again later");
$fonttitle="<font size=4 color=FFFFFF>";
$fontnormal="<font size=3 color=FFFFFF>";
$fonttiny="<font size=2 color=FFFFFF>";
$fonttinywhite="<font size=2 color=FFFFFF>";
$rankedcolor=22222;
if ($_GET['sortorder'] == ""){ $sortorder="score";}
else{ $sortorder= $_GET['sortorder']; }
if ($_GET['page'] == ""){ $pageBegin=0; $page=0;}
else{ $pageBegin = $_GET['page']*$showamount;$page=$_GET['page'];}
//get the number of ranked entries
$result2 = mysql_query("SELECT COUNT(*) FROM ".$rankstable);
while ($record2=mysql_fetch_array($result2)){
$itemCount=$record2[0];
}
//here we go ballistic on crappy code
$totalrank="<TABLE Cellpadding=0 bgcolor=000000 cellspacing=1 BORDER=0 width=95%%>";
//get the ranking
$result3 = mysql_query("SELECT * FROM ".$rankstable." ORDER BY ".$sortorder." DESC LIMIT ".$pageBegin.", ".$showamount);
$userRankNumber=$pageBegin+1;
while ($record3=mysql_fetch_array($result3)){
$date=$record3['date'];
$year = substr($date,0,2);
$month = substr($date,2,2);
$day = substr($date,4,2);
$hour = substr($date,6,2);
$minute = substr($date,8,2);
$year = "20".$year;
$time=$hour.":".$minute." ".$day."-".$month."-".$year;
$rankeduser="<td align=left bgcolor=222222 width=30>".$fonttinywhite."".$userRankNumber. "</td>";
$rankeduser=$rankeduser."<td align=left bgcolor=222222>".$fonttinywhite."".$record3['name']."</td>";
$rankeduser=$rankeduser."<td align=right bgcolor=222222 width=50>".$fonttinywhite."".$record3['kills']."</td>";
$rankeduser=$rankeduser."<td align=right bgcolor=222222 width=50>".$fonttinywhite."".$record3['headshots']."</td>";
$rankeduser=$rankeduser."<td align=right bgcolor=222222 width=50>".$fonttinywhite."".$record3['deaths']."</td>";
$rankeduser=$rankeduser."<td align=right bgcolor=222222 width=50>".$fonttinywhite."".$record3['score']."</td>";
$rankeduser=$rankeduser."<td align=right bgcolor=222222 width=70>".$fonttinywhite."".$record3['efficiency']."%</td>";
$rankeduser=$rankeduser."<td align=right bgcolor=222222 width=70>".$fonttinywhite."".$record3['accuracy']."%</td>";
$rankeduser=$rankeduser."<td align=right bgcolor=222222 width=70>".$fonttinywhite."".$record3['accuracyHS']."%</td>";
$rankeduser=$rankeduser."<td align=right bgcolor=222222 width=120>".$fonttinywhite."".$time."</td></tr>";
$userRankNumber++;
$totalrank=$totalrank.$rankeduser;
}
$totalrank=$totalrank."</table>";
//page controlling
//if ($page > 0)$pageDown=$page-1;
//else $pageDown=$page;
//if ($page < ($itemCount/$showamount)-1) $pageUp=$page+1;
//else $pageUp=$page;
if ($page == 0) {
$pageDown = 0;
} else {
$pageDown = $page-1;
}
$pageUp = $page+1;
if ($_GET['type'] == "sqlstatstable") {
$ttext = "Current";
} elseif ($_GET['type'] == "") {
$ttext = "Current";
} elseif ($_GET['type'] == "weektable") {
$ttext = "Weekly";
} elseif ($_GET['type'] == "monthtable") {
$ttext = "Monthy";
} elseif ($_GET['type'] == "yeartable") {
$ttext = "Yearly";
} elseif ($_GET['type'] == "15daytable") {
$ttext = "Daily top 15";
} elseif ($_GET['type'] == "15weektable") {
$ttext = "Weekly top 15";
} elseif ($_GET['type'] == "15monthtable") {
$ttext = "Monthly top 15";
} elseif ($_GET['type'] == "15yeartable") {
$ttext = "Yearly top 15";
}
$navigationlink1="".$fonttiny."<< back";
$pager = $page+1;
$navigationlink2=$fonttiny.$ttext." rank by ".$sortorder." - page ".$pager;
$navigationlink3="".$fonttiny."next >>";
$navigation="<table width='95%'><tr><td align='left'>".$navigationlink1."</td><td align='center'>".$navigationlink2."</td><td align='right'>".$navigationlink3."</td></tr></table>
";
$sortbar="<TABLE Cellpadding=0 bgcolor=000000 cellspacing=0 BORDER=0 width=95%%><tr>";
$sortlinkRank="".$fonttiny."rank";
$sortlinkName="".$fonttiny."name";
$sortlinkheadshots="".$fonttiny."headshots";
$sortlinkScore="".$fonttiny."score";
$sortlinkKills="".$fonttiny."kills";
$sortlinkDeaths="".$fonttiny."deaths";
$sortlinkEff="".$fonttiny."eff.";
$sortlinkShots="".$fonttiny."acc.";
$sortlinkHS="".$fonttiny."acc. hs";
$sortlinkUpdated="".$fonttiny."updated";
$sortbar=$sortbar."<td align=left height=15>".$sortlinkRank."</td>";
$sortbar=$sortbar."<td align=right height=15 width=60>".$sortlinkKills."</td>";
$sortbar=$sortbar."<td align=right height=15 width=70>".$sortlinkheadshots."</td>";
$sortbar=$sortbar."<td align=right height=15 width=50>".$sortlinkDeaths."</td>";
$sortbar=$sortbar."<td align=right height=15 width=60>".$sortlinkScore."</td>";
$sortbar=$sortbar."<td align=right height=15 width=70>".$sortlinkEff."</td>";
$sortbar=$sortbar."<td align=right height=15 width=70>".$sortlinkShots."</td>";
$sortbar=$sortbar."<td align=right height=15 width=70>".$sortlinkHS."</td>";
$sortbar=$sortbar."<td align=right height=15 width=120>".$sortlinkUpdated."</td>";
mysql_close($conn);
$statslink = "Current";
$weeklink = "Weekly";
$monthlink = "Monthly";
$yearlink = "Yearly";
$tdaylink = "Daily top 15";
$tweeklink = "Weekly top 15";
$tmonthlink = "Monthly top 15";
$tyearlink = "Yearly top 15";
$type = "<font size='-1'>".$statslink."".$weeklink."".$monthlink."" .$yearlink."".$tdaylink."".$tweeklink."".$tmo nthlink."".$tyearlink."</font>";
$title2 = "<font color='white'><h2><u>".$title."</font></h2></u>";
if ($_GET['type'] == "statstable") {
$ftext = "Stats are updated every map change, and dumped into the weekly stats every day";
} elseif ($_GET['type'] == "") {
$ftext = "Stats are updated every map change, and dumped into the weekly stats every day";
} elseif ($_GET['type'] == "weektable") {
$ftext = "Weekly stats are updated every day, and dumped into the monthly stats every week";
} elseif ($_GET['type'] == "monthtable") {
$ftext = "Monthy stats are updated every month and dumped into the yearlyly stats every week";
} elseif ($_GET['type'] == "yeartable") {
$ftext = "Yearly stats are updated every year and dumped every year";
} elseif ($_GET['type'] == "15daytable") {
$ftext = "Daily top 15 stats are updated every map change";
} elseif ($_GET['type'] == "15weektable") {
$ftext = "Weekly top 15 stats are updated every week";
} elseif ($_GET['type'] == "15monthtable") {
$ftext = "Monthly top 15 stats are updated every month";
} elseif ($_GET['type'] == "15yeartable") {
$ftext = "Yearly top 15 stats are updated every year";
}
$footer = "
<font color='white' size='-3'>".$ftext."</font>
";
if ($userRankNumber == 1) {
$totalrank2 = "<TABLE Cellpadding=0 bgcolor=000000 cellspacing=1 BORDER=0 width=95%%><td align=left bgcolor=222222 width=30><center>".$fonttinywhite."Empty</center></td></table>";
} else {
$totalrank2 = $totalrank;
}
echo $type.$title2.$navigation.$sortbar.$totalrank 2.$footer;
?>
</center>
</font>
</body>
</html>
/////////////////////////////////////////////////////////////////////////////
Really nice
http://makro.servebeer.com/Security/pn770/cs-s.html
http://1q.sytes.net CS Server
#sincerely. . . MicroMy's Kaoz server