How to install
- You need a webserver, which supports PHP and MySQL
- Copy and paste the code from below into the file: stats.php
- Edit the settings and set your MySQL settings
- Upload the page on your webserver
Code
<?PHP
/* SETTINGS */
/*________________________________________________________________________________________________________________*/
$_db_host = "localhost"; /* MYSQL host */
$_db_username = "root"; /* MYSQL username */
$_db_password = "123"; /* MYSQL password */
$_db_database = "bw"; /* Mysql database */
$_db_table = "bw_stats"; /* Database table */
$sort = "wins"; /* Default sort (wins, games, kills, deaths, beds) */
/*________________________________________________________________________________________________________________*/
/* DO NOT EDIT */
if(@$_GET['order']){
$order = @$_GET['order'];
}else{
$order = @$_GET['order'] = $sort;
}
if($order!="wins" && $order!="games" && $order!="kills" && $order!="deaths" && $order!="beds")
$order=$sort;
$_link = mysql_connect($_db_host, $_db_username, $_db_password);
mysql_select_db($_db_database, $_link);
$_sql = "SELECT * FROM `$_db_table` ORDER BY `$order` DESC";
$_resultat = mysql_query($_sql, $_link);
?>
<html>
<head>
<link rel="stylesheet" href="https://bootswatch.com/readable/bootstrap.css" media="screen">
<link rel="stylesheet" href="https://bootswatch.com/assets/css/bootswatch.min.css">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
<title>Bedwars Statistiken</title>
</head>
<body>
<div class="container well" style="background: white;">
<table class="table table-striped">
<thead>
<tr>
<th>Player</th>
<th><a href="?order=wins">Wins <?PHP if(@$_GET['order'] == 'wins'){ echo "<i class=\"fa fa-arrow-up\"></i>"; }?></a></th>
<th><a href="?order=games">Played Games <?PHP if(@$_GET['order'] == 'games'){ echo "<i class=\"fa fa-arrow-up\"></i>"; }?></a></th>
<th><a href="?order=kills">Kills <?PHP if(@$_GET['order'] == 'kills'){ echo "<i class=\"fa fa-arrow-up\"></i>"; }?></a></th>
<th><a href="?order=deaths">Deaths <?PHP if(@$_GET['order'] == 'deaths'){ echo "<i class=\"fa fa-arrow-up\"></i>"; }?></a></th>
<th>K/D</th>
<th><a href="?order=beds">Beds <?PHP if(@$_GET['order'] == 'beds'){ echo "<i class=\"fa fa-arrow-up\"></i>"; }?></a></th>
</tr>
</thead>
<tbody>
<?PHP while ($row = @mysql_fetch_array( $_resultat, MYSQL_ASSOC)) {?>
<tr>
<td><img src="http://cravatar.eu/helmhead/<?php echo $row['PName']; ?>/35.png"> <?php echo $row['PName']; ?></td>
<td><?php echo $row['Wins']; ?></td>
<td><?php echo $row['Games']; ?></td>
<td><?php echo $row['Kills']; ?></td>
<td><?php echo $row['Deaths']; ?></td>
<td><?php if($row['Deaths']==0) echo $row['Kills']; else echo round($row['Kills'] / $row['Deaths'],2); ?></td>
<td><?php echo $row['Beds']; ?></td>
</tr>
<?PHP } ?>
</tbody>
</table>
</div>
</body>
</head>
Posts Quoted:
Reply
Clear All Quotes
how to setup webstats