SEOCM Posted July 4, 2008 Posted July 4, 2008 My stats.php is not working and showing allot of messed up answers. I was wondering if anyone had stats.php that they could post up here so I could use it :)? Quote
Kasabian Posted July 4, 2008 Posted July 4, 2008 Re: Anyone Got A Working Stats.php? <?php include "globals.php"; $q=$db->query("SELECT userid FROM users"); $membs=$db->num_rows($q); $q=$db->query("SELECT userid FROM users WHERE bankmoney>-1"); $banks=$db->num_rows($q); $q=$db->query("SELECT userid FROM users WHERE gender='Male'"); $male=$db->num_rows($q); $q=$db->query("SELECT userid FROM users WHERE gender='Female'"); $fem=$db->num_rows($q); $total=0; $q=$db->query("SELECT money FROM users"); while($r=$db->fetch_row($q)) { $total+=$r['money']; } $avg=(int) ($total/$membs); $totalb=0; $q=$db->query("SELECT bankmoney FROM users WHERE bankmoney>-1"); while($r=$db->fetch_row($q)) { $totalb+=$r['bankmoney']; } $avgb=(int) ($totalb/$banks); $totalc=0; $q=$db->query("SELECT crystals FROM users"); while($r=$db->fetch_row($q)) { $totalc+=$r['crystals']; } $totali=0; $q=$db->query("SELECT inv_qty FROM inventory"); while($r=$db->fetch_row($q)) { $totali+=$r['inv_qty']; } $avgc=(int) ($totalc/$membs); $q=$db->query("SELECT mail_id FROM mail"); $mail=$db->num_rows($q); $q=$db->query("SELECT evID FROM events"); $events=$db->num_rows($q); print "<h3>Game Statistics</h3> You step into the Statistics Department and login to the service. You see some stats that interest you. <table width=75% cellspacing=1 class='table'> <tr> <th>Users</th><th>Money and crystals</th></tr><tr><td> There are currently $membs {$set['game_name']} players, $male males and $fem females.</td> <td> Amount of cash in circulation: \$".money_formatter($total,"").". The average player has: \$".money_formatter($avg,"").". Amount of cash in banks: \$".money_formatter($totalb,"").". Amount of players with bank accounts: $banks The average player has in their bank accounts: \$".money_formatter($avgb,"").". Amount of crystalss in circulation: ".money_formatter($totalc,"").". The average player has: ".money_formatter($avgc,"")." crystals.</td> </tr> <tr> <th>Mails/Events</th><th>Items</th></tr><tr><td> ".money_formatter($mail,"")." mails and ".money_formatter($events,"")." events have been sent.</td> <td> There are currently ".money_formatter($totali,"")." items in circulation.</td> </tr> </table>"; $h->endpage(); ?> Please use [code]...[/code] tags in future Quote
SEOCM Posted July 4, 2008 Author Posted July 4, 2008 Re: Anyone Got A Working Stats.php? Its still showing wrong =( Amount of cash in banks: $2,148,958,688. Amount of players with bank accounts: 8 The average player has in their bank accounts: $268,619,836. Thats totally wrong lmao well average player has in bank accounts is wrong -_-. Quote
Guest Anonymous Posted July 4, 2008 Posted July 4, 2008 Re: Anyone Got A Working Stats.php? Don't try that version of the stats page with anything more than around 10K users though -- You are liable to kill the DB server. Quote
SEOCM Posted July 4, 2008 Author Posted July 4, 2008 Re: Anyone Got A Working Stats.php? Looks like I might have to have my coder fix it. I still don't have a working version its saying the wrong number for avg in banks =( Quote
Kasabian Posted July 4, 2008 Posted July 4, 2008 Re: Anyone Got A Working Stats.php? its just dividing $2,148,958,688. by 8 thats your problem Quote
SEOCM Posted July 4, 2008 Author Posted July 4, 2008 Re: Anyone Got A Working Stats.php? I see banking information should be private anyways. This was the only part wrong and I just plain old took out the banking as it was only part wrong LOL! Quote
Kasabian Posted July 4, 2008 Posted July 4, 2008 Re: Anyone Got A Working Stats.php? thats just working around it :D Quote
SEOCM Posted July 4, 2008 Author Posted July 4, 2008 Re: Anyone Got A Working Stats.php? Yes working on games is fun. My coder will prob fix it for a fee when he responds. I've made allot of custom add-ons though and am doing a pretty good job at filling my game. http://run4office.com/candidates.php ;) Quote
Kasabian Posted July 4, 2008 Posted July 4, 2008 Re: Anyone Got A Working Stats.php? paste this in with your Register.php: if(strlen($_POST['password']) < 3) { die("Sorry, the Password is too short. >[url='register.php']Back[/url]"); } stops people registering with no password Quote
mdshare Posted July 7, 2008 Posted July 7, 2008 Re: Anyone Got A Working Stats.php? SEOCM post banned for 30 days due to spamming at a CE Network Site. Topic Locked Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.