Hey,
Ik onderhoud een tijdje een site van een maat van mij, alleen nu wil ie updates en ja nu stuit ik op een irritant probleem.
Hij wil dat alleen de levende leden worden getoond, dus niet meer de doden.
Zelf heb ik al wel wat geprobeerd maar steeds mislukt het...
members.php
PHP
<?php
error_reporting(E_ALL);
include("config.php");
if(! check_login()) {
header('Location: login.php');
exit;
}
?>
<html>
<head>
<title>Valkori</title>
<link rel="stylesheet" type="text/css" href="style.php">
</head>
<body><?php
if(isset($_GET['o']))
{
$order = $_GET['o'];
}
else
{
$order = "DESC";
}
if(isset($_GET['s']))
{
$sort = $_GET['s'];
}
else
{
$sort = "xp";
}
$begin= ($_GET['p'] >= 0) ? $_GET['p']*20 : 0;
$q = $_GET['q'];
$_GET['q'] = "*".$q."*";
$_GET['q'] = preg_replace('/\*/','%',$_GET['q']);
$where = array();
$where[] = "`status`='levend'";
if($_GET['online'] =="ja")
{
$where[] = "UNIX_TIMESTAMP(NOW())-UNIX_TIMESTAMP(`online`) < 300";
}
if (!empty($_GET['q']))
{
$where[] = "`login` LIKE '".$_GET['q']."'";
}
$where = count($where) ? ' WHERE ' . implode(' AND ', $where) : '';
$us = mysql_query("SELECT level,login,xp,status,UNIX_TIMESTAMP(`online`) AS `online` FROM `users` ".$where." ORDER BY ".$sort." ".$order." LIMIT ".$begin.",20");
$total = mysql_num_rows($us);
$x = 0;
$page = $_GET['p'];
print " <table width=100% align=center class=thinline cellspacing=0 cellpadding=1>
<td align=center colspan=2 class=subtitle><b>Leden</b></td>
</tr>
<tr>
<table width=100% align=center border='0' cellspacing='0' cellpadding='0'>
<tr>
<tr><td class=subTitle width=20%><b>Naam</b> <a href=?p=$page&q=$q&status=$status&online=$online&s=login&o=ASC><font face=Wingdings>â</font></a> <a href=?p=$page&status=$status&online=$online&q=$q&s=login&o=DESC><font face=Wingdings>á</font></a></td>
<td class=subTitle><b>Rang</b> <a href=?p=$page&s=xp&q=$q&status=$status&online=$online&o=DESC><font face=Wingdings>â</font></a> <a href=?p=$page&status=$status&q=$q&online=$online&s=xp&o=ASC><font face=Wingdings>á</font></a></td>
<td class=subTitle><b>Status</b> <a href=?p=$page&q=$q&status=$status&online=$online&s=status&o=ASC><font face=Wingdings>â</font></a> <a href=?p=$page&status=$status&q=$q&online=$online&s=status&o=DESC><font face=Wingdings>á</font></a></td>
<td class=subTitle><b>Online</b> <a href=?p=$page&q=$q&status=$status&online=$online&s=online&o=ASC><font face=Wingdings>â</font></a> <a href=?p=$page&status=$status&q=$q&online=$online&s=online&o=DESC>á</a></td></tr><tr></tr><tr></tr><tr>";
for($j=$begin+1; $usr = mysql_fetch_object($us); $j++)
{
if ($usr->xp < 10) { $rang = $rang1; }
elseif ($usr->xp < 20 && $data->geslacht == 'Man') { $rang = $rang2; }
elseif ($usr->xp < 20 && $data->geslacht == 'Vrouw') { $rang = $rang2f; }
elseif ($usr->xp < 50) { $rang = $rang3; }
elseif ($usr->xp < 150) { $rang = $rang4; }
elseif ($usr->xp < 500) { $rang = $rang5; }
elseif ($usr->xp < 1000) { $rang = $rang6; }
elseif ($usr->xp < 2000) { $rang = $rang7; }
elseif ($usr->xp < 3000) { $rang = $rang8; }
elseif ($usr->xp < 4500) { $rang = $rang9; }
elseif ($usr->xp < 6000) { $rang = $rang10; }
elseif ($usr->xp < 8000 && $data->geslacht == 'Man') { $rang = $rang11; }
elseif ($usr->xp < 8000 && $data->geslacht == 'Vrouw') { $rang = $rang11f; }
$statu = ($usr->status == 'levend') ? "<b><font color=009900>Levend</font></b>" : "dood";
$on = (($usr->online + 300) > time()) ? "<b>Ja</b>" : "Nee";
if(in_array($usr->level, array(1003, 1002, 1000)))
{
echo "<tr><tr><tr><td class=mainTxt><a href=user.php?x=$usr->login><span style=color: red;>$usr->login</span></a></td><td class=mainTxt>$rang</td><td class=mainTxt>$statu</td><td class=mainTxt>$on</td></tr>";
}
else
{
echo "<tr><tr><tr><td class=mainTxt><a href=user.php?x=$usr->login>$usr->login</a></td><td class=mainTxt>$rang</td><td class=mainTxt>$statu</td><td class=mainTxt>$on</td></tr>";
}
}
$where = array();
$where[] = "`status`='levend'";
if($_GET['online'] =="ja")
{
$where[] = "UNIX_TIMESTAMP(NOW())-UNIX_TIMESTAMP(`online`) < 300";
}
if (!empty($_GET['q']))
{
$where[] = "`login` LIKE '".$_GET['q']."'";
}
$where = count($where) ? ' WHERE ' . implode(' AND ', $where) : '';
$us = mysql_query("SELECT id FROM `users`" . $where);
print "<table width=100% align=center class=thinline cellspacing=0 cellpadding=1>
<td align=center colspan=2 class=subtitle><b>Zoeken</b></td>
</tr>
<tr>
<table width=100% align=center border='0' cellspacing='0' cellpadding='0'>
<tr>
<td class=mainTxt><form method=get>
Zoek een speler.<br>
<br><input type=text name=q value=".$_REQUEST['q']."> <input type=submit value=Zoek!>
</form></td></tr>";
print " <tr><td align=\"center\">";
if(mysql_num_rows($us) <= 20)
{
print "< 1 ></td></tr></table>\n";
}
else
{
if($begin/20 == 0)
{
print "<< ";
}
else
{
print "<a href=\"?s=$sort&status=$status&q=$q&online=$online&o=$order&p=". ($begin/20-1) ."\"><<</a> ";
}
for($i=0; $i<mysql_num_rows($us)/20; $i++) {
print "<a href=\"?s=$sort&status=$status&q=$q&online=$online&o=$order&p=$i\">". ($i+1) ."</a> ";
}
if($begin+20 >= mysql_num_rows($us))
{
print ">> ";
}
else
{
print "<a href=\"?s=$sort&status=$status&q=$q&online=$online&o=$order&p=". ($begin/20+1) ."\">>></a>";
}
}
?>
</body>
</html>
<?php
mysql_close();
?>
Toon Meer
Alvast bedankt voor de hulp!
Mvg,
Dein