mirror of
https://github.com/shavitush/bhoptimer.git
synced 2025-12-07 10:28:26 +00:00
Re-indent code.
This commit is contained in:
parent
22291bd635
commit
da1438f379
@ -10,180 +10,180 @@ $map = isset($_GET["map"]);
|
|||||||
|
|
||||||
function removeworkshop($mapname)
|
function removeworkshop($mapname)
|
||||||
{
|
{
|
||||||
if(strpos($mapname, "workshop/") !== false)
|
if(strpos($mapname, "workshop/") !== false)
|
||||||
{
|
{
|
||||||
$pieces = explode("/", $mapname);
|
$pieces = explode("/", $mapname);
|
||||||
|
|
||||||
return $pieces[2];
|
return $pieces[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $mapname;
|
return $mapname;
|
||||||
}
|
}
|
||||||
|
|
||||||
$style = 0;
|
$style = 0;
|
||||||
|
|
||||||
if(isset($_GET["style"]))
|
if(isset($_GET["style"]))
|
||||||
{
|
{
|
||||||
$style = $_GET["style"];
|
$style = $_GET["style"];
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
table, th, td
|
table, th, td
|
||||||
{
|
{
|
||||||
border: 1px solid black;
|
border: 1px solid black;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
.name
|
.name
|
||||||
{
|
{
|
||||||
color: darkcyan;
|
color: darkcyan;
|
||||||
}
|
}
|
||||||
|
|
||||||
.time
|
.time
|
||||||
{
|
{
|
||||||
color: red;
|
color: red;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if(!$map)
|
if(!$map)
|
||||||
{
|
{
|
||||||
echo("<title>" . HOMEPAGE_TITLE . "</title>");
|
echo("<title>" . HOMEPAGE_TITLE . "</title>");
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
echo("<title>[" . ($style == 0? "NM":"SW") . " Records] " . removeworkshop($_GET["map"]) . "</title>");
|
echo("<title>[" . ($style == 0? "NM":"SW") . " Records] " . removeworkshop($_GET["map"]) . "</title>");
|
||||||
} ?>
|
} ?>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<p><a href="timer.php">Home</a></p>
|
<p><a href="timer.php">Home</a></p>
|
||||||
|
|
||||||
<p><form method="GET" acton="#">
|
<p><form method="GET" acton="#">
|
||||||
<?php
|
<?php
|
||||||
if(isset($_GET["map"]))
|
if(isset($_GET["map"]))
|
||||||
{
|
{
|
||||||
echo("<input name=\"map\" type=\"text\" value=" . $_GET["map"] . "></input>");
|
echo("<input name=\"map\" type=\"text\" value=" . $_GET["map"] . "></input>");
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
echo("<input name=\"map\" type=\"text\"></input>");
|
echo("<input name=\"map\" type=\"text\"></input>");
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<select name="style">
|
<select name="style">
|
||||||
<option value="0">Forwards</option>
|
<option value="0">Forwards</option>
|
||||||
<option value="1">Sideways</option>
|
<option value="1">Sideways</option>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<input type="submit" value="Show results"></input>
|
<input type="submit" value="Show results"></input>
|
||||||
</form></p>
|
</form></p>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if($map)
|
if($map)
|
||||||
{
|
{
|
||||||
$stmt = FALSE;
|
$stmt = FALSE;
|
||||||
|
|
||||||
if($stmt = $connection->prepare("SELECT p.id, p.map, u.auth, u.name, p.time, p.jumps FROM playertimes p JOIN users u ON p.auth = u.auth WHERE map = ? AND style = ? ORDER BY time ASC LIMIT " . RECORD_LIMIT . ";"))
|
if($stmt = $connection->prepare("SELECT p.id, p.map, u.auth, u.name, p.time, p.jumps FROM playertimes p JOIN users u ON p.auth = u.auth WHERE map = ? AND style = ? ORDER BY time ASC LIMIT " . RECORD_LIMIT . ";"))
|
||||||
{
|
{
|
||||||
$stmt->bind_param("ss", $_GET["map"], $_GET["style"]);
|
$stmt->bind_param("ss", $_GET["map"], $_GET["style"]);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
|
|
||||||
$stmt->store_result();
|
$stmt->store_result();
|
||||||
|
|
||||||
$rows = $stmt->num_rows;
|
$rows = $stmt->num_rows;
|
||||||
|
|
||||||
$stmt->bind_result($id, $map, $auth, $name, $time, $jumps);
|
$stmt->bind_result($id, $map, $auth, $name, $time, $jumps);
|
||||||
|
|
||||||
echo "<p>Number of records: " . number_format($rows) . ".</p>";
|
echo "<p>Number of records: " . number_format($rows) . ".</p>";
|
||||||
|
|
||||||
if($rows > 0)
|
if($rows > 0)
|
||||||
{
|
{
|
||||||
$first = true;
|
$first = true;
|
||||||
|
|
||||||
$rank = 1;
|
$rank = 1;
|
||||||
|
|
||||||
while($row = $stmt->fetch())
|
while($row = $stmt->fetch())
|
||||||
{
|
{
|
||||||
if($first)
|
if($first)
|
||||||
{
|
{
|
||||||
echo("<h1>[" . ($style == 0? "Forwards":"Sideways") . " Records] " . removeworkshop($_GET["map"]) . "</h1>");
|
echo("<h1>[" . ($style == 0? "Forwards":"Sideways") . " Records] " . removeworkshop($_GET["map"]) . "</h1>");
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<table>
|
<table>
|
||||||
<tr><th>Rank</th>
|
<tr><th>Rank</th>
|
||||||
<th>Record ID</th>
|
<th>Record ID</th>
|
||||||
<th>SteamID3</th>
|
<th>SteamID3</th>
|
||||||
<th>Player</th>
|
<th>Player</th>
|
||||||
<th>Time</th>
|
<th>Time</th>
|
||||||
<th>Jumps</th></tr>
|
<th>Jumps</th></tr>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<tr><td>#<?php echo($rank); ?></td>
|
<tr><td>#<?php echo($rank); ?></td>
|
||||||
<td><?php echo($id); ?></td>
|
<td><?php echo($id); ?></td>
|
||||||
<td><?php
|
<td><?php
|
||||||
$steamid = SteamID::Parse($auth, SteamID::FORMAT_STEAMID3);
|
$steamid = SteamID::Parse($auth, SteamID::FORMAT_STEAMID3);
|
||||||
echo("<a href=\"http://steamcommunity.com/profiles/" . $steamid->Format(SteamID::FORMAT_STEAMID64) . "/\">" . $auth . "</a>"); ?></td>
|
echo("<a href=\"http://steamcommunity.com/profiles/" . $steamid->Format(SteamID::FORMAT_STEAMID64) . "/\">" . $auth . "</a>"); ?></td>
|
||||||
<td class="name"><?php echo($name); ?></td>
|
<td class="name"><?php echo($name); ?></td>
|
||||||
<td class="time">
|
<td class="time">
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
echo(formattoseconds($time));
|
echo(formattoseconds($time));
|
||||||
?></td>
|
?></td>
|
||||||
<td><?php echo(number_format($jumps)); ?></td></tr>
|
<td><?php echo(number_format($jumps)); ?></td></tr>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$first = false;
|
$first = false;
|
||||||
|
|
||||||
$rank++;
|
$rank++;
|
||||||
}
|
}
|
||||||
|
|
||||||
echo("</table>");
|
echo("</table>");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
echo "<h2>No results. Press <a href=\"timer.php\">Home</a> to get the map list.</h2>";
|
echo "<h2>No results. Press <a href=\"timer.php\">Home</a> to get the map list.</h2>";
|
||||||
}
|
}
|
||||||
|
|
||||||
if($stmt != FALSE)
|
if($stmt != FALSE)
|
||||||
{
|
{
|
||||||
$stmt->close();
|
$stmt->close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$result = mysqli_query($connection, "SELECT DISTINCT map FROM mapzones ORDER BY map ASC;");
|
$result = mysqli_query($connection, "SELECT DISTINCT map FROM mapzones ORDER BY map ASC;");
|
||||||
|
|
||||||
if($result->num_rows > 0)
|
if($result->num_rows > 0)
|
||||||
{
|
{
|
||||||
echo '<h2>Click a map name in order to auto-fill the form.</h2>';
|
echo '<h2>Click a map name in order to auto-fill the form.</h2>';
|
||||||
|
|
||||||
while($row = $result->fetch_assoc())
|
while($row = $result->fetch_assoc())
|
||||||
{
|
{
|
||||||
echo "<a onclick=\"document.all.map.value = '" . $row["map"] . "'\";>" . removeworkshop($row["map"]) . "</a></br>";
|
echo "<a onclick=\"document.all.map.value = '" . $row["map"] . "'\";>" . removeworkshop($row["map"]) . "</a></br>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
echo "No results";
|
echo "No results";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
<?php $connection->close(); ?>
|
<?php $connection->close(); ?>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user