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";
|
||||
|
||||
//rename the game-not-started file to game-begun
|
||||
rename("game-not-started","game-begun");
|
||||
|
||||
//random number generator function
|
||||
function UniqueRandomNumbersWithinRange($min, $max, $quantity) {
|
||||
$numbers = range($min, $max);
|
||||
|
||||
Reference in New Issue
Block a user