Jump to content
MakeWebGames

Player Statistics - FREE SCRIPT


jamiee

Recommended Posts

:::::::::::::::::: Player Statistics ::::::::::::::::::::

 

Screenshot:

Player-Statistics.jpg

Make player_stats.php add code below:

<?php require("top.php");
require("connect.php"); ?>
<form method="post">
<html>
<Head>
</Head>
<body>
<table width="350" border="0" align="center" cellspacing="2" class="table">
<tr>
 <td width="350" Class="head" colspan="4" align="left">Site Statistics</td>
 </tr>
 <tr>
<td width="35%" align="left" class="sub">Total Members:</td>
<td width="65%" align="left" class="cell"><?php

$res = "SELECT name FROM login";
$tquery = mysql_query($res) or die(mysql_error());
$total_members = mysql_num_rows($tquery);
echo number_format($total_members);
?></td>
 </tr>
 <tr>
<td align="left" class="sub">Members Dead:</td>
<td align="left" class="cell"><?php 

$res = "SELECT name FROM login WHERE sitestate='2'";
$tquery = mysql_query($res) or die(mysql_error());
$totalmembers = mysql_num_rows($tquery);
echo number_format($totalmembers);
?></td>
 </tr>
 <tr>
<td align="left" class="sub">Members Alive:</td>
<td align="left" class="cell"><?php 

$res = "SELECT name FROM login WHERE sitestate='9'";
$tquery = mysql_query($res);
$totalmembers = mysql_num_rows($tquery);

$tres = "SELECT name FROM login WHERE sitestate='0'";
$ttquery = mysql_query($tres);
$atotalmembers = mysql_num_rows($ttquery);
$ttotalmembers= $atotalmembers + $totalmembers;
echo number_format($ttotalmembers);

?></td>
 </tr>

 <tr>
<td align="left" class="sub">Swiss bank:</td>
<td align="left" class="cell"><?php 

$query = "SELECT SUM(amount) FROM swiss_bank"; 
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result);
$swiss_bank = $row['SUM(amount)'];
echo "$ ".number_format($row['SUM(amount)']).",-";

?></td>
 </tr>
 <tr>
<td width="35%" align="left" class="sub">Total Money:</td>
<td width="65%" align="left" class="cell"><?php 

$query = "SELECT SUM(money) FROM login WHERE staff='0'"; 
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result);
$cash = $row['SUM(money)'];
echo "$ ".number_format($row['SUM(money)']).",-";

?></td>
 </tr>
 <tr>
<td width="35%" align="left" class="sub">Total Gang Money:</td>
<td width="65%" align="left" class="cell"><?php 

$query = "SELECT SUM(bank) FROM gangs"; 
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result);
$gang_money = $row['SUM(bank)'];
echo "$ ".number_format($row['SUM(bank)']).",-";

?></td>
 </tr>


 <tr>
<td width="35%" align="left" class="sub">Most Members Online:</td>
<td width="65%" align="left" class="cell"><?php 

$query = "SELECT max_online FROM sitestats WHERE id='1'"; 
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result);

echo $row['max_online'];

	?></td>
 </tr>
</table>


</fieldset>

<table width="350" border="0" align="center" cellpadding="0" cellspacing="2" class="table">
 <tr>
<td colspan="4" align="left" class="head">Last 20 Kills: </td>
 </tr>
 <tr>
<td width="125" align="left" class="sub">[b]Name:[/b]</td>
<td width="125" align="left" class="sub">[b]Rank:[/b]</td>
<td width="250" align="left" class="sub">[b]Gang:[/b]</td>
 </tr>
 <? 

$result = mysql_query("SELECT * FROM kills WHERE state='1' ORDER BY id DESC LIMIT 0,20 ") or die(mysql_error());

// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {
// Print out the contents of each row into a table
?>
 <tr>
<td width="125" align="left" class="cell"><?php echo "<a href=\"view_profile.php?name=". $row['target'] ."\" onFocus=\"if(this.blur)this.blur()\">".$row['target']."</a>"; ?></td>
<td width="125" align="left" class="cell"><?php echo $rank_array[$row['rank'] - 1]; ?></td>
<td width="250" align="left" class="cell"><?php if(empty($row['gang'])){ echo "No Gang."; }else{ echo $row['gang']; }?>

<?php }// end while lop.?>
 </tr>
</table>



<table width="350" border="0" align="center" cellpadding="0" cellspacing="2" class="table">
 <tr>
<td colspan="4" align="left" class="head">Last 20 Signups: </td>
</tr>
 <tr>
<td width="125" align="left" class="sub">[b]Name:[/b]</td>
<td width="225" align="left" class="sub">[b]Signup Date:[/b]</td>
 </tr>
 <form>
 <?php

 $result = mysql_query("SELECT * FROM login ORDER BY id DESC LIMIT 0,20 ") or die(mysql_error());

  // keeps getting the next row until there are no more to get   
while($row = mysql_fetch_array( $result )) {

?>
 <tr>
<td width="125" align="left" class="cell"><?php echo"<a href=\"view_profile.php?name=". $row['name'] ."\" onFocus=\"if(this.blur)this.blur()\">".$row['name']."</a>";?></td>
<td width="225" align="left" class="cell" ><?php echo $row['signup']; ?></td>
 </tr>
 <?php 
}// while loop?>
</table>
</body>
</html>
<? require("bottom.php") ?>

 

Add the following code to top.php:

Player Statistics

 

Enjoy the free script. :)

Link to comment
Share on other sites

  • 1 year later...

how do you run this mysql code in the login table?

 

i get errors trying to run it

 

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '`staff` int(11) NOT NULL DEFAULT '0',' at line 1

Link to comment
Share on other sites

  • 11 months later...
how do you run this mysql code in the login table?

 

i get errors trying to run it

 

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '`staff` int(11) NOT NULL DEFAULT '0',' at line 1

 

you can add it in manaly or sumthing like this

 

ALTER TABLE `staff` ADD  int(11) NOT NULL DEFAULT '0'

 

never used the gl enine before so i dunno

Edited by Newbie
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...