Jump to content
MakeWebGames

Problem with Hall of Fame in version 2.03


Mystical

Recommended Posts

I have been looking at this thing for days trying to figure out why when you click on Crystals it says 0 even though I have 1230? I would appreciate a helping hand. Thanks in advance. This is the code. Tried to add code tags but it does not work.....

 

<?php
	include_once "globals.php";
$filters = array(
	'nodon' => 'AND donatordays=0',
	'don' => 'AND donatordays > 0',
	'all' => ''
);
$hofheads = array(
	'level',
	'money',
	'crystals',
	'respect',
	'total',
	'strength',
	'agility',
	'guard',
	'labour',
	'iq'
);
	$_GET['action'] = (in_array($_GET['action'],$hofheads))?$_GET['action']:'level';
	$filter = (isset($filters[$_GET['filter']]))?$_GET['filter']:'all';
	$myf = $filters[$filter];
$hofqone = array(
	'level',
	'money',
	'crystals'
);
  if ( in_array($_GET['action'], $hofqone) ) {
$q = $db->query("SELECT u.`userid`, `laston`, `gender`, `donatordays`, `username`, `level`, `money`, g.`gangPREF` FROM users u LEFT JOIN gangs g ON g.gangID=u.gang WHERE u.user_level != 0 $myf ORDER BY {$_GET['action']} DESC,userid ASC LIMIT 20");
  }
$hofqtwo = array(
	'total',
	'strength',
	'agility',
	'guard',
	'labour',
	'iq'
);
             if ( in_array($_GET['action'], $hofqtwo) ) {
    if ( $_GET['action'] == 'total' ) {
	$us = '(us.`strength`+us.`agility`+us.`guard`+us.`labour`+us.`IQ`)';
    } else {
	$us = 'us.`'.$_GET['action'].'`';
    }
$q = $db->query("SELECT u.`userid`, `laston`, `gender`, `donatordays`, `level`, `money`, `crystals`, `username`, g.`gangPREF`, us.`strength`, `agility`, `guard`, `labour`, `IQ` 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} DESC,u.userid ASC LIMIT 20");
             }
    if ( $_GET['action'] != 'respect' ) {
	$non_don = (($filter == 'nodon')?'<b>':'').'<a href="halloffame.php?action='.$_GET['action'].'&filter=nodon">Non-Donators</a>'.(($filter == 'nodon')?'</b>':'');
	$is_don = (($filter == 'don')?'<b>':'').'<a href="halloffame.php?action='.$_GET['action'].'&filter=don">Donators</a>'.(($filter == 'don')?'</b>':'');
	$all_us = (($filter == 'all')?'<b>':'').'<a href="halloffame.php?action='.$_GET['action'].'&filter=all">All Users</a>'.(($filter == 'all')?'</b>':'');
    }
  echo "
<h3>Hall Of Fame</h3>
".(( $_GET['action'] != 'respect' )?'<hr />Filter: ['.$non_don.' | '.$is_don.' | '.$all_us.']<hr />':'')."

<table width='60%' cellpadding='1' cellspacing='1' class='table'>
	<tr>
<td><a href='halloffame.php?action=level&filter={$filter}'>LEVEL</a></td>
<td><a href='halloffame.php?action=money&filter={$filter}'>MONEY</a></td>
<td><a href='halloffame.php?action=crystals&filter={$filter}'>CRYSTALS</a></td>
<td><a href='halloffame.php?action=respect&filter={$filter}'>RESPECT</a></td>
<td><a href='halloffame.php?action=total&filter={$filter}'>TOTAL STATS</a></td>
	</tr>
	<tr>
<td><a href='halloffame.php?action=strength&filter={$filter}'>STRENGTH</a></td>
<td><a href='halloffame.php?action=agility&filter={$filter}'>AGILITY</a></td>
<td><a href='halloffame.php?action=guard&filter={$filter}'>GUARD</a></td>
<td><a href='halloffame.php?action=labour&filter={$filter}'>LABOUR</a></td>
<td><a href='halloffame.php?action=iq&filter={$filter}'>IQ</a></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;
  echo "
Showing the 20 users with the highest levels
<br />
<table width='60%' cellspacing='1' class='table'>
	<tr style='background:gray'>
<th>Pos</th>
<th>User</th>
<th>Level</th>
	</tr>
  ";

	$p = 0;
         while ( $r = $db->fetch_row($q) ) {
	$p++;
	$bold_hof = ($r['userid'] == $userid)?' style="font-weight: bold;"':'';
  echo '
	<tr '.$bold_hof.'>
<td>'.$p.'</td>
<td>'.$r['gangPREF'].' '.$r['username'].' ['.$r['userid'].']</td>
<td>'.$r['level'].'</td>
	</tr>
  ';
         }
  echo '</table>';
}
function hof_money() {
global $db,$ir,$c,$userid, $myf;
  echo "
Showing the 20 users with the highest amount of money
<br />
<table width='60%' cellspacing='1' class='table'>
	<tr style='background:gray'>
<th>Pos</th>
<th>User</th>
<th>Money</th>
	</tr>
  ";

	$p = 0;
         while ( $r = $db->fetch_row($q) ) {
	$p++;
	$bold_hof = ($r['userid'] == $userid)?' style="font-weight: bold;"':'';
  echo '
	<tr '.$bold_hof.'>
<td>'.$p.'</td>
<td>'.$r['gangPREF'].' '.$r['username'].' ['.$r['userid'].']</td>
<td>'.money_formatter($r['money'],'$').'</td>
	</tr>
  ';
}
  echo '</table>';
}
function hof_crystals() {
global $db,$ir,$c,$userid,$myf;
  echo "
Showing the 20 users with the highest amount of crystals
<br />
<table width='60%' cellspacing='1' class='table'>
	<tr style='background:gray'>
<th>Pos</th>
<th>User</th>
<th>Crystals</th>
	</tr>
  ";

	$p = 0;
         while ( $r = $db->fetch_row($q) ) {
	$p++;
	$bold_hof = ($r['userid'] == $userid)?' style="font-weight: bold;"':'';
  echo '
	<tr '.$bold_hof.'>
<td>'.$p.'</td>
<td>'.$r['gangPREF'].' '.$r['username'].' ['.$r['userid'].']</td>
<td>'.money_formatter($r['crystals'],'').'</td>
	</tr>
  ';
         }
  echo '</table>';
}

function hof_respect() {
global $db,$ir,$c,$userid;
  echo "
Showing the 20 gangs with the highest amount of respect
<br />
<table width='60%' cellspacing='1' class='table'>
	<tr style='background:gray'>
<th>Pos</th>
<th>Gang</th>
<th>Respect</th>
	</tr>
  ";
$q = $db->query("SELECT `gangID`,`gangNAME`,`gangRESPECT` FROM `gangs` ORDER BY `gangRESPECT` DESC,`gangID` ASC LIMIT 20");
	$p = 0;
         while ( $r = $db->fetch_row($q) ) {
	$p++;
	$bold_hof = ($r['gangID'] == $ir['gang'])?' style="font-weight: bold;"':'';
  echo '
	<tr '.$bold_hof.'>
<td>'.$p.'</td>
<td>'.$r['gangNAME'].' ['.$r['gangID'].']</td>
<td>'.money_formatter($r['gangRESPECT'],'').'</td>
	</tr>
  ';
         }
  echo '</table>';
}

function hof_total() {
global $db,$ir,$c,$userid, $myf;
  echo "
Showing the 20 users with the highest total stats
<br />
<table width='60%' cellspacing='1' class='table'>
	<tr style='background:gray'>
<th>Pos</th>
<th>User</th>
	</tr>
  ";

	$p = 0;
         while ( $r = $db->fetch_row($q) ) {
	$p++;
	$bold_hof = ($r['userid'] == $userid)?' style="font-weight: bold;"':'';
  echo '
	<tr '.$bold_hof.'>
<td>'.$p.'</td>
<td>'.$r['gangPREF'].' '.$r['username'].' ['.$r['userid'].']</td>
	</tr>
  ';
          }
  echo '</table>';
}
function hof_strength() {
global $db,$ir,$c,$userid, $myf;
  echo "
Showing the 20 users with the highest strength
<br />
<table width='60%' cellspacing='1' class='table'>
	<tr style='background:gray'>
<th>Pos</th>
<th>User</th>
	</tr>
  ";

	$p = 0;
         while ( $r = $db->fetch_row($q) ) {
	$p++;
	$bold_hof = ($r['userid'] == $userid)?' style="font-weight: bold;"':'';
  echo '
	<tr '.$bold_hof.'>
<td>'.$p.'</td>
<td>'.$r['gangPREF'].' '.$r['username'].' ['.$r['userid'].']</td>
	</tr>
  ';
         }
  echo '</table>';
}
function hof_agility() {
global $db,$ir,$c,$userid, $myf;
  echo "
Showing the 20 users with the highest agility
<br />
<table width='60%' cellspacing='1' class='table'>
	<tr style='background:gray'>
<th>Pos</th>
<th>User</th>
	</tr>
  ";

	$p = 0;
         while ( $r = $db->fetch_row($q) ) {
	$p++;
	$bold_hof = ($r['userid'] == $userid)?' style="font-weight: bold;"':'';
  echo '
	<tr '.$bold_hof.'>
<td>'.$p.'</td>
<td>'.$r['gangPREF'].' '.$r['username'].' ['.$r['userid'].']</td>
	</tr>
  ';
         }
  echo '</table>';
}
function hof_guard() {
global $db,$ir,$c,$userid, $myf;
  echo "
Showing the 20 users with the highest guard
<br />
<table width='60%' cellspacing='1' class='table'>
	<tr style='background:gray'>
<th>Pos</th>
<th>User</th>
	</tr>
  ";

	$p = 0;
         while ( $r = $db->fetch_row($q) ) {
	$p++;
	$bold_hof = ($r['userid'] == $userid)?' style="font-weight: bold;"':'';
  echo '
	<tr '.$bold_hof.'>
<td>'.$p.'</td>
<td>'.$r['gangPREF'].' '.$r['username'].' ['.$r['userid'].']</td>
	</tr>
  ';
         }
  echo '</table>';
}
function hof_labour() {
global $db,$ir,$c,$userid, $myf;
  echo "
Showing the 20 users with the highest labour
<br />
<table width='60%' cellspacing='1' class='table'>
	<tr style='background:gray'>
<th>Pos</th>
<th>User</th>
	</tr>
  ";

	$p = 0;
         while ( $r = $db->fetch_row($q) ) {
	$p++;
	$bold_hof = ($r['userid'] == $userid)?' style="font-weight: bold;"':'';
  echo '
	<tr '.$bold_hof.'>
<td>'.$p.'</td>
<td>'.$r['gangPREF'].' '.$r['username'].' ['.$r['userid'].']</td>
	</tr>
  ';
         }
  echo '</table>';
}
function hof_iq() {
global $db,$ir,$c,$userid, $myf;
  echo "
Showing the 20 users with the highest IQ
<br />
<table width='60%' cellspacing='1' class='table'>
	<tr style='background:gray'>
<th>Pos</th>
<th>User</th>
	</tr>
  ";

	$p = 0;
         while ( $r = $db->fetch_row($q) ) {
	$p++;
	$bold_hof = ($r['userid'] == $userid)?' style="font-weight: bold;"':'';
  echo '
	<tr '.$bold_hof.'>
<td>'.$p.'</td>
<td>'.$r['gangPREF'].' '.$r['username'].' ['.$r['userid'].']</td>
	</tr>
  ';
         }
  echo '</table>';
}
$h->endpage();
?> 
Edited by Dominion
Code tags...
Link to comment
Share on other sites

if ( in_array($_GET['action'], $hofqone) ) {

$q = $db->query("SELECT u.`userid`, `laston`, `gender`, `donatordays`, `username`, `level`, `money`, g.`gangPREF` FROM users u LEFT JOIN gangs g ON g.gangID=u.gang WHERE u.user_level != 0 $myf ORDER BY {$_GET['action']} DESC,userid ASC LIMIT 20");

}

Not quite sure actually, but isn't crystals missing here?

Link to comment
Share on other sites

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