Sign in to follow this  
Followers 0
Masa

Simple statistic page

3 posts in this topic

I didn't found any statistic pages for exile mod so i made simple statistics page for our own server. Check here!
You need webserver and access to exile database to use this.

You can modify code as you like. :)

Save this code as YouCanChangeThisText.php

Spoiler

<html>
<head>
    <meta charset="utf-8">
    <title>Exile stats</title>
    
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
</head>

<body>
    <div class="container">
<?php
$con=mysqli_connect("localhost","username","password","dbname");  //server address, username, password, dbname
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
    //check order ascending or descending
    if (isset($_GET["order"])) {
        $sort = $_GET["order"];
        if ($_GET["order"] == "asc"){
            $sort = "desc";
            $order = "asc";
        }
        else{
            $sort = "asc";
            $order = "desc";
        }
    }
    
    //check filter
    if (isset($_GET["name"])) {
        $name = $_GET["name"];
        }
            else {
            $name = "name";
                }
$list=array('name', 'Money', 'score', 'kills', 'deaths');
if (in_array($name,$list))
{
    //variable ok
}
    else
    {
        $name = "name";
    }

$query = mysqli_query($con,"SELECT * FROM account a INNER JOIN player p ON a.uid = p.account_uid  ORDER BY a.$name $order");

?><!--//echo "<table border='1'>-->
<table class="table">
<tr>
<?php echo "<th><a href=\"?order=$sort&name=name\">Player Name</a></th>";?>
<?php echo "<th><a href=\"?order=$sort&name=Money\">Money</a></th>";?>
<?php echo "<th><a href=\"?order=$sort&name=score\">Score</a></th>";?>
<?php echo "<th><a href=\"?order=$sort&name=kills\">Kills</a></th>";?>
<?php echo "<th><a href=\"?order=$sort&name=deaths\">Deaths</a></th>";?>
</tr>
<!--//";-->
<?php

while($row = mysqli_fetch_array($query))
{
?><tr class="success"><?php
echo "<td>" . $row['name'] . "</td>";
echo "<td>" . $row['money'] . "</td>";
echo "<td>" . $row['score'] . "</td>";
echo "<td>" . $row['kills'] . "</td>";
echo "<td>" . $row['deaths'] . "</td>";
echo "</tr>";
}
echo "</table>";

mysqli_close($con);
?>
<a href="http://ddaygaming.com">©ddaygaming.com</a>
</div>
</body>
</html>

Edited by Masa
updated code: removed WHERE is_alive = 1
2 people like this

Share this post


Link to post
Share on other sites

Hey Masa nice statistics page. looks very good and simple and that's the way i like it :). We have run it on our webpage [url=https://inthegame.nl/exile-leaderboard/.]Link We made a little adjusment to fit our web style. Only we got a lttle problem with the sorting option. somethimes it's a lttle buggy and not sorting it well. Do you got the same problem??  

Edit: fixt the problem :)

 
Edited by Trillseeker82

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.