Jump to content
MakeWebGames

Recommended Posts

Posted

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 :)?

Posted

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

Posted

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

Guest Anonymous
Posted

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.

Posted

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 =(

Posted

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!

Posted

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

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