Commit 3840205c by SouthernCross Gaming Committed by Rowedahelicon

# 1.3 -- 5/30/2017

-Added map tiers to the main menu
-Added pagination to map and profiles page to reduce load times
-Adjusted the theme settings to appear nicer
-Fixed a few mistakes (PHP errors and incorrect data being shown)
-Added temporary support for Marcowmaderia's fork of CKSurf which features stage records
-Added a fix_database.php file that will fix a charset issue with the cksurf database (Optional but delete when you're done with it)

**Note**

I need a copy of a database which features stage record data as I do not run my own server. If you would like to help out, please get in touch with me at my email, theoneandonly@rowedahelicon.com
In addition, in order to enable the Macro addition, add this line into your config.php file.

$use_marco_cksurf = '1';

Once I get some more data, I'll iron out any mistakes with stage records in a future update!

Signed-off-by: Rowedahelicon <matthewr01@gmail.com>
parent 96c21635
This source diff could not be displayed because it is too large. You can view the blob instead.
<?php
if($secure==1){
$conn = new mysqli($db_server, $db_user, $db_passwd, $db_name);
$conn = @new mysqli($db_server, $db_user, $db_passwd, $db_name);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$database_call = $db_prefix."playerrank";
$database_call_2 = $db_prefix."maptier";
$sql = "SELECT * FROM $database_call ORDER BY points DESC LIMIT 10";
$result = $conn->query($sql);
......@@ -80,7 +81,8 @@ $result = $conn->query($sql);
<th>Player name</th>
<th>Runtime</th>
<th>Map</th>
<th>Date</tH>
<th>Date</th>
<th>Map Tier</th>
</tr>
</thead>
<tbody>
......@@ -93,8 +95,11 @@ $result = $conn->query($sql);
$dt = new DateTime("now", new DateTimeZone($local_timezone));
$dt->setTimestamp($timestamp);
$timestamp = $dt->format('M j, Y, g:i a T');
echo "<tr><td><a href='?view=profile&id=".$row["steamid"]."'>".$row["name"]."</a></td><td><i class=\"fa fa-clock-o\" aria-hidden=\"true\"></i> ".processFloat($row["runtime"])."</td><td><a href='?view=map&name=".$row["map"]."'>".$row["map"]."</a></td><td>".$timestamp."</td></tr>";
$current_map = $row["map"];
$result_tier = $conn->query("SELECT tier FROM $database_call_2 WHERE mapname='$current_map' limit 1");
$value = mysqli_fetch_object($result_tier);
$this_map_tier = $value->tier;
echo "<tr><td><a href='?view=profile&id=".$row["steamid"]."'>".$row["name"]."</a></td><td><i class=\"fa fa-clock-o\" aria-hidden=\"true\"></i> ".processFloat($row["runtime"])."</td><td><a href='?view=map&name=".$row["map"]."'>".$row["map"]."</a></td><td>".$timestamp."</td><td>".$this_map_tier."</td></tr>";
}
}
......
......@@ -7,19 +7,65 @@ if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$database_call = $db_prefix."playerrank";
$mapname = mysqli_real_escape_string($conn, htmlspecialchars($_GET["name"], ENT_QUOTES));
$database_call = $db_prefix."playertimes";
if ($result = $conn->query("SELECT * FROM $database_call WHERE mapname='$mapname'")) { $run_cnt = $result->num_rows; $result->close(); }
$database_call = $db_prefix."maptier";
if ($result = $conn->query("SELECT * FROM $database_call WHERE mapname='$mapname' LIMIT 1")) { $row = $result->fetch_object(); $map_tier = $row->tier; $result->close(); }
$database_call = $db_prefix."playertimes";
$result = $conn->query("SELECT * FROM $database_call WHERE mapname = '$mapname'");
$row_cnt = ceil($result->num_rows / 30);
$page_start = ($_GET["p"] ? mysqli_real_escape_string($conn, htmlspecialchars($_GET["p"], ENT_QUOTES)) : '0');
$sql = "SELECT * FROM $database_call WHERE mapname = '$mapname' ORDER BY runtimepro ASC";
if($page_start >=1){ $page_start = $page_start - 1; }
if($page_start <0){ $page_start = 0; }
$page_start = $page_start * 30;
$sql = "SELECT * FROM $database_call WHERE mapname = '$mapname' ORDER BY runtimepro ASC LIMIT $page_start,30";
$result = $conn->query($sql);
?>
<h2>Map stats : <?php echo $mapname; ?></h2>
<h2><?php echo $mapname; ?></h2>
<b>Number of completed runs: <?php echo $run_cnt; ?></b><br/>
<b>Map tier: <?php echo $map_tier; ?></b>
<h2>Record times</h2>
<?php
if($use_marco_cksurf == '1'){
echo"<div class=\"btn-group\" role=\"group\" aria-label=\"...\">
<button type=\"button\" class=\"btn btn-primary\">Records</button>
<a class=\"btn btn-default\" href=\"?view=records&name=$mapname&p=1\">Stage Records</a>
</div>";
}
?>
<nav aria-label="Page navigation">
<ul class="pagination">
<li>
<a href="<?php echo "?view=map&name=$mapname&p=1"; ?>" aria-label="Previous">
<span aria-hidden="true">&laquo;</span>
</a>
</li>
<?php
$x = 1;
while($x<=$row_cnt){
echo "<li><a href=\"?view=map&name=$mapname&p=$x\">$x</a></li>";
$x++;
}
?>
<li>
<a href="<?php echo "?view=map&name=$mapname&p=$row_cnt"; ?>" aria-label="Next">
<span aria-hidden="true">&raquo;</span>
</a>
</li>
</ul>
</nav>
<table class="table table-striped table-hover ">
<thead>
......@@ -48,4 +94,27 @@ $result = $conn->query($sql);
?>
</tbody>
</table>
<nav aria-label="Page navigation">
<ul class="pagination">
<li>
<a href="<?php echo "?view=map&name=$mapname&p=1"; ?>" aria-label="Previous">
<span aria-hidden="true">&laquo;</span>
</a>
</li>
<?php
$x = 1;
while($x<=$row_cnt){
echo "<li><a href=\"?view=map&name=$mapname&p=$x\">$x</a></li>";
$x++;
}
?>
<li>
<a href="<?php echo "?view=map&name=$mapname&p=$row_cnt"; ?>" aria-label="Next">
<span aria-hidden="true">&raquo;</span>
</a>
</li>
</ul>
</nav>
<?php $conn->close(); } ?>
\ No newline at end of file
......@@ -8,6 +8,7 @@ if ($conn->connect_error) {
}
$database_call = $db_prefix."playertimes";
$database_call_2 = $db_prefix."maptier";
$sql = "SELECT tbl.* FROM $database_call tbl INNER JOIN( SELECT mapname,MIN(runtimepro) MinPoint From $database_call Group By mapname)tbl1 On tbl1.mapname=tbl.mapname Where tbl1.Minpoint=tbl.runtimepro";
$result = $conn->query($sql);
......@@ -17,6 +18,7 @@ $result = $conn->query($sql);
<thead>
<tr>
<th>Map name</th>
<th>Map tier</th>
<th>Best time</th>
<th>Best time player</th>
</tr>
......@@ -27,7 +29,11 @@ $result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo "<tr><td><a href='?view=map&name=".$row["mapname"]."'>".$row["mapname"]."</a></td><td><i class=\"fa fa-clock-o\" aria-hidden=\"true\"></i> ".processFloat($row["runtimepro"])."</td><td><a href='?view=profile&id=".$row["steamid"]."'>".$row["name"]."</a></td></tr>";
$current_map = $row["mapname"];
$result_tier = $conn->query("SELECT tier FROM $database_call_2 WHERE mapname='$current_map' limit 1");
$value = mysqli_fetch_object($result_tier);
$this_map_tier = $value->tier;
echo "<tr><td><a href='?view=map&name=".$row["mapname"]."'>".$row["mapname"]."</a></td><td>$this_map_tier</td><td><i class=\"fa fa-clock-o\" aria-hidden=\"true\"></i> ".processFloat($row["runtimepro"])."</td><td><a href='?view=profile&id=".$row["steamid"]."'>".$row["name"]."</a></td></tr>";
}
}
......
......@@ -50,18 +50,27 @@ foreach ($map_array as $value){
}
}
$sql = "SELECT * FROM $database_call WHERE steamid = '$steamid'";
//Pagination
$database_call = $db_prefix."playertimes";
$result = $conn->query("SELECT * FROM $database_call WHERE steamid = '$steamid'");
$row_cnt = ceil($result->num_rows / 30);
$page_start = ($_GET["p"] ? mysqli_real_escape_string($conn, htmlspecialchars($_GET["p"], ENT_QUOTES)) : '0');
if($page_start >=1){ $page_start = $page_start - 1; }
if($page_start <0){ $page_start = 0; }
$page_start = $page_start * 30;
$sql = "SELECT * FROM $database_call WHERE steamid = '$steamid' LIMIT $page_start,30";
$result_save = $conn->query($sql);
while($row = $result_save->fetch_assoc()) {
$map_times .= "<tr><td><a href='?view=map&name=".$row["mapname"]."'>".$row["mapname"]."</a></td><td>".$record_times[$row["mapname"]]."</td><td><i class=\"fa fa-clock-o\" aria-hidden=\"true\"></i> ".processFloat($row["runtimepro"])."</td></tr>";
}
$database_call = $db_prefix."playerrank";
$sql = "SELECT * FROM $database_call WHERE steamid = '$steamid'";
$result = $conn->query($sql);
......@@ -89,6 +98,28 @@ if ($result->num_rows > 0) {
<h2>Map stats</h2>
<nav aria-label="Page navigation">
<ul class="pagination">
<li>
<a href="<?php echo "?view=profile&id=$steamid&p=1"; ?>" aria-label="Previous">
<span aria-hidden="true">&laquo;</span>
</a>
</li>
<?php
$x = 1;
while($x<=$row_cnt){
echo "<li><a href=\"?view=profile&id=$steamid&p=$x\">$x</a></li>";
$x++;
}
?>
<li>
<a href="<?php echo "?view=profile&id=$steamid&p=$row_cnt"; ?>" aria-label="Next">
<span aria-hidden="true">&raquo;</span>
</a>
</li>
</ul>
</nav>
<table class="table table-striped table-hover ">
<thead>
<tr>
......@@ -101,4 +132,26 @@ if ($result->num_rows > 0) {
<?php echo $map_times; ?>
</tbody>
</table>
<nav aria-label="Page navigation">
<ul class="pagination">
<li>
<a href="<?php echo "?view=profile&id=$steamid&p=1"; ?>" aria-label="Previous">
<span aria-hidden="true">&laquo;</span>
</a>
</li>
<?php
$x = 1;
while($x<=$row_cnt){
echo "<li><a href=\"?view=profile&id=$steamid&p=$x\">$x</a></li>";
$x++;
}
?>
<li>
<a href="<?php echo "?view=profile&id=$steamid&p=$row_cnt"; ?>" aria-label="Next">
<span aria-hidden="true">&raquo;</span>
</a>
</li>
</ul>
</nav>
<?php $conn->close(); } ?>
\ No newline at end of file
<?php
if($secure==1){
$error = 0;
$error_array = array();
$conn = new mysqli($db_server, $db_user, $db_passwd, $db_name);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$mapname = mysqli_real_escape_string($conn, htmlspecialchars($_GET["name"], ENT_QUOTES));
if(empty($mapname)){ $error++; array_push($error_array,"You didn't specify a map name!"); }
$database_call = $db_prefix."playertimes";
if ($result = $conn->query("SELECT * FROM $database_call WHERE mapname='$mapname'")) { $run_cnt = $result->num_rows; $result->close(); }
$database_call = $db_prefix."maptier";
if ($result = $conn->query("SELECT * FROM $database_call WHERE mapname='$mapname' LIMIT 1")) { $row = $result->fetch_object(); $map_tier = $row->tier; $result->close(); }
$database_call = $db_prefix."checkpoints";
$result = $conn->query("SELECT * FROM $database_call WHERE mapname = '$mapname'");
$row_cnt = ceil($result->num_rows / 30);
$page_start = ($_GET["p"] ? mysqli_real_escape_string($conn, htmlspecialchars($_GET["p"], ENT_QUOTES)) : '0');
if($page_start >=1){ $page_start = $page_start - 1; }
if($page_start <0){ $page_start = 0; }
$page_start = $page_start * 30;
$sql = "SELECT * FROM $database_call WHERE mapname = '$mapname' LIMIT $page_start,30";
$result = $conn->query($sql);
if($error>=1){
echo"<div class='alert alert-warning' role='alert'><h2>The following errors have occured...</h2><br/><br/>";
foreach($error_array as $error_det){ echo $error_det."<br/>"; }
echo"</div>";
}else{
?>
<h2><?php echo $mapname; ?></h2>
<b>Number of completed runs: <?php echo $run_cnt; ?></b><br/>
<b>Map tier: <?php echo $map_tier; ?></b>
<h2>Record times</h2>
<?php
if($use_marco_cksurf == '1'){
echo"<div class=\"btn-group\" role=\"group\" aria-label=\"...\">
<a class=\"btn btn-default\" href=\"?view=map&name=$mapname&p=1\">Records</a>
<button type=\"button\" class=\"btn btn-primary\">Stage Records</button>
</div>";
}
$database_call = $db_prefix."stages";
$query = "select a.* from $database_call a WHERE ( select count(*) from $database_call as b where a.stage = b.stage and a.id >= b.id) <= 5 AND map = '$mapname'";
if (!$conn->query($query)) {
printf("Errormessage: %s\n", $conn->error);
}else{
$result = $conn->query($query);
}
?>
<h2>Stage stats : <?php echo $mapname; ?></h2>
<table class="table table-striped table-hover ">
<thead>
<tr>
<th>Player name</th>
<th>Map</th>
<th>Stage</th>
<th>Runtime</th>
<th>Start speed</th>
</tr>
</thead>
<tbody>
<?php
if ($result->num_rows > 0) {
// output data of each row
$x=1;
while($row = $result->fetch_assoc()) {
echo "<tr><td><a href='?view=profile&id=".$row["steamid"]."'>".$row["steamid"]."</a></td><td>".$row["map"]."</td><td>".$row["stage"]."</td><td></i> ".processFloat($row["runtime"])."</td><td>".processFloat($row["startspeed"])."</td></tr>";
}
}
?>
</tbody>
</table>
<?php $conn->close(); } } ?>
\ No newline at end of file
# 1.3 -- 5/30/2017
-Added map tiers to the main menu
-Added pagination to map and profiles page to reduce load times
-Adjusted the theme settings to appear nicer
-Fixed a few mistakes (PHP errors and incorrect data being shown)
-Added temporary support for Marcowmaderia's fork of CKSurf which features stage records
-Added a fix_database.php file that will fix a charset issue with the cksurf database (Optional but delete when you're done with it)
**Note**
I need a copy of a database which features stage record data as I do not run my own server. If you would like to help out, please get in touch with me at my email, theoneandonly@rowedahelicon.com
In addition, in order to enable the Macro addition, add this line into your config.php file.
$use_marco_cksurf = '1';
Once I get some more data, I'll iron out any mistakes with stage records in a future update!
\ No newline at end of file
......@@ -4,21 +4,22 @@ if($secure==1){
######## GENERAL INFORMATION ########
$stat_name = 'CK Stats'; # Stats page name
$group_name = ''; # Name of your steam group (Optional)
$group_url = ''; # URL to your Steam group or Website
$local_timezone = 'EST'; # Set your local timezone here
$group_name = 'Southern Cross Gaming'; # Name of your steam group (Optional)
$group_url = 'http://steamcommunity.com/groups/southerncrossgaming'; # URL to your Steam group or Website
$local_timezone = 'EST'; #Set your local timezone here
$conf_language = 'eng'; # Only supports English right now
$conf_record_stats = '1'; # How do you want profile stats to be displayed? 0 = No records, 1 = all in one, 2 = Record stats are displayed different from map stats
######### DATABASE INFORMATION ########
$db_type = 'mysql';
$db_server = 'localhost';
-$db_name = ''; # Database name
-$db_user = ''; # Database username
-$db_passwd = ''; # Database password
-$db_prefix = 'ck_'; # The prefix you chose for your CKSurf Install, default is ck_
######### DATABASE INFORMATION ########
$db_type = 'mysql';
$db_server = 'localhost';
$db_name = 'cksurf';
$db_user = 'cksurf';
$db_passwd = 'BeTMjMMw6hUH8zpb';
$db_prefix = 'ck_'; //Default ck_
}else{
header("location:http://google.com");
}
......
<?
<?php
$secure=1;
......
......@@ -4,6 +4,8 @@
Website: http://www.rowedahelicon.com
From: Connecticut, United States
Note: Please contact me if you have any questions / issues
Normalize.css -- github.com/necolas/normalize.css
/* THANKS */
......@@ -22,6 +24,7 @@
[ZTS] Samatazz - For suggestions
blackhawk74 - For suggestions
Kryptanyte - For suggestions
/* SITE */
Doctype:HTML5
......
......@@ -24,71 +24,77 @@ function processFloat($seconds) {
<body>
<div class="container">
<h1><?php echo $stat_name; ?></h1>
<h1><?php echo $stat_name; ?></h1>
<nav class="navbar navbar-default">
<div class="container-fluid">
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li><a href="?view=home"><i class="fa fa-home" aria-hidden="true"></i> Home</a></li>
<li><a href="?view=maps"><i class="fa fa-map-marker" aria-hidden="true"></i> Maps</a></li>
</ul>
<form class="navbar-form navbar-left" action="?view=search" method="post">
<div class="form-group">
<input name="search" class="form-control" placeholder="Search Players" type="text">
</div>
<button type="submit" class="btn btn-default">Submit</button>
</form>
<ul class="nav navbar-nav navbar-right">
<li><a href="<?php echo $group_url; ?>"><?php echo $group_name; ?></a></li>
</ul>
</div>
</div>
</nav>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li><a href="?view=home"><i class="fa fa-home" aria-hidden="true"></i> Home</a></li>
<li><a href="?view=maps"><i class="fa fa-map-marker" aria-hidden="true"></i> Maps</a></li>
</ul>
<form class="navbar-form navbar-left" action="?view=search" method="post">
<div class="form-group">
<input name="search" class="form-control" placeholder="Search Players" type="text">
</div>
<button type="submit" class="btn btn-default">Submit</button>
</form>
<ul class="nav navbar-nav navbar-right">
<li><a href="<?php echo $group_url; ?>"><?php echo $group_name; ?></a></li>
</ul>
</div>
</div>
</nav>
<?php
<?php
switch($page_topic){
case "map":
include("assets/pages/view_map.php");
break;
case "maps":
include("assets/pages/view_maps.php");
break;
case "profile":
switch($conf_record_stats){
case"0":
include("assets/pages/view_profile_0.php");
break;
case"1":
include("assets/pages/view_profile.php");
break;
case"2":
include("assets/pages/view_profile_2.php");
break;
default:
include("assets/pages/view_profile.php");
}
break;
case "recent":
include("assets/pages/view_recent.php");
break;
case "search":
include("assets/pages/search.php");
break;
default:
include("assets/pages/default.php");
}
switch($page_topic){
case "map":
include("assets/pages/view_map.php");
break;
case "maps":
include("assets/pages/view_maps.php");
break;
case "records": //--coming soon!
include("assets/pages/view_records.php");
break;
case "profile":
switch($conf_record_stats){
case"0":
include("assets/pages/view_profile_0.php");
break;
case"1":
include("assets/pages/view_profile.php");
break;
case"2":
include("assets/pages/view_profile_2.php");
break;
default:
include("assets/pages/view_profile.php");
}
break;
case "recent":
include("assets/pages/view_recent.php");
break;
case "search":
include("assets/pages/search.php");
break;
/*case "tiers":
include("assets/pages/view_tiers.php");
break;*/ //Coming soon
default:
include("assets/pages/default.php");
}
?>
?>
<footer>
Assembled by <a href="http://rowedahelicon.com/">Rowedahelicon</a> , CS:GO CkSurf built by <a href="https://forums.alliedmods.net/showthread.php?t=264498">Jonitaikaponi</a> <span style="font-size:8pt;">(V.1.2.)</span> <a href="humans.txt"><img src="assets/images/humanstxt-transparent-color.png" alt="Humans.txt image" /></a>
</footer>
<footer>
Assembled by <a href="https://gitlab.com/Rowedahelicon/CkSurfStatsPage">Rowedahelicon</a> <span style="font-size:8pt;">(V.1.3.)</span>, CS:GO CkSurf built by <a href="https://forums.alliedmods.net/showthread.php?t=264498">Jonitaikaponi</a><?php if($use_marco_cksurf == '1'){ echo" & <a href='https://github.com/marcowmadeira/ckSurf'>Marcowmadeira</a>"; } ?> <a href="humans.txt"><img src="assets/images/humanstxt-transparent-color.png" alt="Humans.txt image" /></a>
</footer>
</div>
</body>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment