mirror of
https://github.com/jcreek/Assassins-Mission-Control.git
synced 2026-07-12 18:43:43 +00:00
Further admin tools
There’s a bug where the CSV export isn’t putting anything into the CSV
This commit is contained in:
@@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
// Download the file
|
||||||
|
|
||||||
|
$filename = "myFile.csv";
|
||||||
|
header('Content-type: application/csv');
|
||||||
|
header('Content-Disposition: attachment; filename='.$filename);
|
||||||
|
|
||||||
|
// Fetch Record from Database
|
||||||
|
|
||||||
|
$output = "";
|
||||||
|
$table = "usersfinal";
|
||||||
|
$sql = mysql_query("select * from $table");
|
||||||
|
$columns_total = mysql_num_fields($sql);
|
||||||
|
|
||||||
|
// Get The Field Name
|
||||||
|
|
||||||
|
for ($i = 0; $i < $columns_total; $i++) {
|
||||||
|
$heading = mysql_field_name($sql, $i);
|
||||||
|
$output .= '"'.$heading.'",';
|
||||||
|
}
|
||||||
|
$output .="\n";
|
||||||
|
|
||||||
|
// Get Records from the table
|
||||||
|
|
||||||
|
while ($row = mysql_fetch_array($sql)) {
|
||||||
|
for ($i = 0; $i < $columns_total; $i++) {
|
||||||
|
$output .='"'.$row["$i"].'",';
|
||||||
|
}
|
||||||
|
$output .="\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
print $output;
|
||||||
|
exit;
|
||||||
|
?>
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
<?php include "../base.php";
|
||||||
|
|
||||||
|
// This page is password protected as it resets the entire game so needs to not be done by accident.
|
||||||
|
|
||||||
|
// Define your username and password
|
||||||
|
$password = "reset-the-game";
|
||||||
|
|
||||||
|
if ($_POST['txtPassword'] != $password) {
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<h1>Confirm Assassins Game Reset</h1>
|
||||||
|
|
||||||
|
<p>First you must download a copy of the game results</p>
|
||||||
|
<p><a href="export-csv.php">Export CSV</a></p>
|
||||||
|
|
||||||
|
<form name="form" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
|
||||||
|
<p>If you are certain that you want to reset the game then enter the following password in the box below:
|
||||||
|
<br>reset-the-game</p>
|
||||||
|
|
||||||
|
<p><label for="txtpassword">Password:</label>
|
||||||
|
<br /><input type="password" title="Enter the password" name="txtPassword" /></p>
|
||||||
|
|
||||||
|
<p><input type="submit" name="Submit" value="Login" /></p>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
}
|
||||||
|
else { // here is where the actual reset code happens following login
|
||||||
|
|
||||||
|
// rename the game-begun file to game-not-started
|
||||||
|
rename("game-begun","game-not-started");
|
||||||
|
|
||||||
|
// export the contents of the usersfinal table just in case it was an accident or the results are needed again
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
<?php include "../base.php";
|
<?php include "../base.php";
|
||||||
|
|
||||||
|
//rename the game-not-started file to game-begun
|
||||||
|
rename("game-not-started","game-begun");
|
||||||
|
|
||||||
//random number generator function
|
//random number generator function
|
||||||
function UniqueRandomNumbersWithinRange($min, $max, $quantity) {
|
function UniqueRandomNumbersWithinRange($min, $max, $quantity) {
|
||||||
$numbers = range($min, $max);
|
$numbers = range($min, $max);
|
||||||
|
|||||||
@@ -20,6 +20,8 @@
|
|||||||
<div style='float:right; border-style: dotted; padding: 2%; width: 20%;'>
|
<div style='float:right; border-style: dotted; padding: 2%; width: 20%;'>
|
||||||
<p><a href="admin-tools/adminer-sql.php">Log in to the database and modify the table directly</a>
|
<p><a href="admin-tools/adminer-sql.php">Log in to the database and modify the table directly</a>
|
||||||
<br>N.B. You will need to know the database server, user, password and database name. The table to modify is 'usersfinal' once the game has started.</p>
|
<br>N.B. You will need to know the database server, user, password and database name. The table to modify is 'usersfinal' once the game has started.</p>
|
||||||
|
<p><a href="admin-tools/reset-all.php">Reset everything ready for the next game</a>
|
||||||
|
<br>If you do this you will erase the current game.</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
|
<head>
|
||||||
|
<link rel="icon" type="image/png" href="favicon.png">
|
||||||
|
</head>
|
||||||
|
|
||||||
<?php //this code creates the database connection for all pages that need it
|
<?php //this code creates the database connection for all pages that need it
|
||||||
session_start();
|
session_start();
|
||||||
|
|
||||||
|
|||||||
BIN
Binary file not shown.
|
After Width: | Height: | Size: 97 KiB |
BIN
Binary file not shown.
|
After Width: | Height: | Size: 5.4 KiB |
@@ -82,6 +82,10 @@ function GetNumberOfRows() {
|
|||||||
<li>Ninjaness Score: <b><?=$_SESSION['Ninjaness']?>/10</b></li>
|
<li>Ninjaness Score: <b><?=$_SESSION['Ninjaness']?>/10</b></li>
|
||||||
<li>You have made <b><?=$_SESSION['Kills']?> kills</b></li>
|
<li>You have made <b><?=$_SESSION['Kills']?> kills</b></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
<?php
|
||||||
|
if(file_exists("admin-tools/game-begun"))
|
||||||
|
{
|
||||||
|
?>
|
||||||
<p>
|
<p>
|
||||||
<h1>Your Target</h1>
|
<h1>Your Target</h1>
|
||||||
<ul>
|
<ul>
|
||||||
@@ -120,6 +124,9 @@ function GetNumberOfRows() {
|
|||||||
<p style="padding-top: 15px"><span> </span><input class="submit" type="submit" name="submitkill" id="submitkill" value="Submit Kill" /></p>
|
<p style="padding-top: 15px"><span> </span><input class="submit" type="submit" name="submitkill" id="submitkill" value="Submit Kill" /></p>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 213 KiB |
Reference in New Issue
Block a user