Beste cpers,
Bij mijn ledenlijst zit een bug.
Als iemand op een aantal power komt van:
9.223.381.903.771.219.968 power,
gaat hij terug naar de laatste plaats.
Ik vraag me af hoe ik dit moet oplossen.
Hier het script
PHP
<?php
/**
*
* @category System
* @package Criminals game
* @author Nick Petyt <[email protected]>
* @copyright 2010
* @version 1.0
* @name leden-lijst.php
*/
if ( !@include("./inc/config.inc.php") )
{
trigger_error('Kan niet verbinden met Configuratie: Contacteer een admin / Please contact a admin!');
}
logincheck(); //TODO: Kijkt of gebruiker wel is ingelogd.
mysql_query("UPDATE `[users]` SET `online`=NOW(),`pagina`='Leden Lijst' WHERE `login`='".$data->login."'");
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Criminal Investigative</title>
<link href="../css-v1.css" rel="stylesheet" type="text/css" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="description" content="" />
<meta name="copyright" http-equiv="copyright" content="Nick Petyt (Straatbaas.nl)" />
<meta name="keywords" content="'','','','','','','',''" />
<script type="text/javascript">
function createRequestObject()
{
var req;
if(window.XMLHttpRequest)
{
req = new XMLHttpRequest();
}
else
if(window.ActiveXObject)
{
req = new ActiveXObject("Microsoft.XMLHTTP");
}
else
{
alert('Problem creating the XMLHttpRequest object');
}
return req;
}
var http = createRequestObject();
function getPhp()
{
http.open('post','leden-lijst.php',true);
http.onreadystatechange = getPhpResponse;
http.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
http.send(null);
}
function getPhpResponse()
{
if(http.readyState == 1)
{
document.getElementById('resultatenDiv').innerHTML = 'loading';
}
else
if(http.readyState == 4 && http.status == 200)
{
document.getElementById('resultatenDiv').innerHTML = http.responseText;
}
}
setTimeout(function () {
getPhp();
},20000);
</script>
</head>
<body>
<table width="100%" align="Center" cellspacing="1" cellpadding="1">
<tbody>
<tr>
<td width="5%" class="subTitle"> </td>
<td width="5%" class="subTitle"> </td>
<td width="25%" class="subTitle">Gebruiker</td>
<td width="20%" class="subTitle">Clan</td>
<td width="20%" class="subTitle">Contant</td>
<td width="25%" class="subTitle">Power</td>
<td width="25%" class="subTitle">Attack</td>
</tr>
<?php
if ($_GET['p'] >= 1)
{
$start = ($_GET['p'] - 1) * 25;
}
else
{
$start = 0;
}
$Query = mysql_query("SELECT `id`,`login`,UNIX_TIMESTAMP(`signup`) AS `signup`,`attack`,`defence`,`gebeldmvip`,`hulpadmin`,`cash`,`superdagen`,`level`,`clan`,`vipdagen` FROM `[users]` ORDER BY (`attack`+`defence`) DESC,`login` ASC LIMIT $start,25");
if(mysql_num_rows($Query) == '0')
{
die('<tr><td class="maintxt" colspan="6"><font color="#FF0000"><i>Er zijn leden beschikbaar in deze lijst !</i></font></td></tr>');
}
for($id = $start +1; $info = mysql_fetch_assoc($Query); $id++)
{
//TODO: Eerste 3 krijgen kleuren Beker.
if($id == '1')
{
$i = "<img src='images/layout/trophy.png' alt='".$id."'>";
}
else
if($id == '2')
{
$i = "<img src='images/layout/trophy-silver.png' alt='".$id."'>";
}
else
if($id == '3')
{
$i = "<img src='images/layout/trophy-bronze.png' alt='".$id."'>";
}
else
{
$i = number_format($id,0,",",".");
}
$power = number_format(round(($info['attack'] + $info['defence'])),0,",",".");
$geld = number_format(round($info['cash']),0,",",".");
$clan = (empty($info['clan'])) ? "<b>Geen</b>" : " <a href='clan/clanprofiel.php?x=".$info['clan']."'>".$info['clan']."</a>";
echo('
<tr>
<td class="mainTxt" width="5%" align="center">'.$i.'</td>
<td class="mainTxt" width="5%" align="center">'.online($info['id']).'</td>
<td class="mainTxt" width="25%"><a href="profile.php?x='.$info['login'].'">'.check_user($info['id']).'</a> '.check_mega($info['id']).'</td>
<td class="mainTxt" width="25%">'.$clan.'</td>
<td class="mainTxt" width="20%">€ '.$geld.',-</td>
<td class="mainTxt" width="25%">'.$power.'</td>
<td class="mainTxt" width="25%"><a href="attack.php?x='.$info['login'].'">Attack</td>
</tr>
');
}
//TODO: Paginas Berekenen
$Users = mysql_query("SELECT `id` FROM `[users]`");
$Paginas = ceil(mysql_num_rows($Users) / 25);
if(empty($_GET['p']))
{
$_GET['p'] = 1;
}
echo('<tr><td class="maintxt2" colspan="7"><b><i>Status:</i></b> <font color="red"><b>Administrator</b></font> -
<font color="orange"><b>Moderator</b></font> - <font color="purple"><b>Mede Scripter</b></font> -
<font color="yellow"><b>Vip Lid</b></font> -
<font color="blue"><b>Super Member</b></font> -
<b>Mega Member</b> <img src="images/layout/star-small.png" />
</td></tr>');
echo('<tr><td class="maintxt" colspan="7"> <b><i>Navigatie:</i></b>');
for ($i=1;$i<=$Paginas;$i++)
{
if ($_GET['p'] == $i)
{
echo ' <font color="lime"><b>' . $i . '</b></font>';
}
else
{
echo ' <a href="?p=' . $i . '">' . $i . '</a>';
}
}
echo('</td></tr>');
?>
</tbody>
</table>
</body>
</html>
Toon Meer
Hoopelijk kunnen jullie me heirbij helpen.
Met vriendelijke groeten,
Kevin