mirror of
https://github.com/jcreek/Assassins-Mission-Control.git
synced 2026-07-13 02:53:44 +00:00
Cleaned up and made admin tools mobile-first
This commit is contained in:
@@ -20,18 +20,14 @@ The web app for running a semi-automated game of Assassins.
|
||||
Install Instructions
|
||||
-------------------------------------
|
||||
|
||||
1) Mission Control requires PHP and MySQL to run. Make sure you've got those installed on your web server.
|
||||
|
||||
2) In base.php you need to set your own database details.
|
||||
|
||||
3) Using the admin tools in admin.php, create the users table.
|
||||
|
||||
4) Your users can now begin to register using register.php - I'd recommend sending out a direct link using a URL shortener, although on the main page there is a link to registering just above the login box.
|
||||
1. Mission Control requires PHP and MySQL to run. Make sure you've got those installed on your web server.
|
||||
2. In base.php you need to set your own database details.
|
||||
3. Using the admin tools in admin.php, create the users table.
|
||||
4. Your users can now begin to register using register.php - I'd recommend sending out a direct link using a URL shortener, although on the main page there is a link to registering just above the login box.
|
||||
|
||||
Once all your users have registered
|
||||
-------------------------------------
|
||||
|
||||
5) At this point you do not want anyone else to register so, as I haven't thought of a way to prevent adding any more data to an SQL table, you're going to duplicate the users table to a table called usersfinal which won't get edited by the registration form, thereby preventing anyone else from signing up. To do this head over to the admin tools in admin.php and close the registration.
|
||||
|
||||
6) Once you are ready to begin the game you need to go to admin.php and assign all players their targets by starting the game.
|
||||
5. At this point you do not want anyone else to register so, as I haven't thought of a way to prevent adding any more data to an SQL table, you're going to duplicate the users table to a table called usersfinal which won't get edited by the registration form, thereby preventing anyone else from signing up. To do this head over to the admin tools in admin.php and close the registration.
|
||||
6. Once you are ready to begin the game you need to go to admin.php and assign all players their targets by starting the game.
|
||||
|
||||
|
||||
@@ -7,29 +7,20 @@
|
||||
<link rel="stylesheet" href="style.css" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="main">
|
||||
|
||||
<form method="post" action="admin-tools/create-users-table.php" name="create-users-table" id="create-users-table">
|
||||
<fieldset>
|
||||
<input type="submit" name="create-users-table" id="create-users-table" value="Create Users Table" />
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
<form method="post" action="admin-tools/close-registration.php" name="close-registration" id="close-registration">
|
||||
<fieldset>
|
||||
<input type="submit" name="close-registration" id="close-registration" value="Close Registration" />
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
<form method="post" action="admin-tools/startgame.php" name="startgame" id="startgame">
|
||||
<fieldset>
|
||||
<input type="submit" name="startgame" id="startgame" value="Start Game" />
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
<div id="main" style='width: 90%;'>
|
||||
<h1 style='text-align: center; padding-bottom: 15px;'>Mission Control Admin Tools</h1>
|
||||
<div style='float:left; border-style: dotted; padding: 2%; width: 60%;'>
|
||||
<p><a href="admin-tools/create-users-table.php">Create users table</a></p>
|
||||
|
||||
<p><a href="admin-tools/close-registration.php">Close registration</a></p>
|
||||
|
||||
<p><a href="admin-tools/startgame.php">Start the game</a></p>
|
||||
</div>
|
||||
|
||||
<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>
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
|
||||
$dbhost = "localhost"; // this will ususally be 'localhost', but can sometimes differ
|
||||
|
||||
$dbname = "assassinsdb"; // the name of the database that you are going to use for this project
|
||||
|
||||
$dbuser = "root"; // the username that you created, or were given, to access your database
|
||||
|
||||
$dbpass = "Passwords1"; // the password that you created, or were given, to access your database
|
||||
|
||||
|
||||
mysql_connect($dbhost, $dbuser, $dbpass) or die("MySQL Error: " . mysql_error());
|
||||
|
||||
mysql_select_db($dbname) or die("MySQL Error: " . mysql_error());
|
||||
|
||||
?>
|
||||
@@ -1,11 +0,0 @@
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
$dbhost = "db381141882.db.1and1.com"; // this will ususally be 'localhost', but can sometimes differ
|
||||
$dbname = "db381141882"; // the name of the database that you are going to use for this project
|
||||
$dbuser = "dbo381141882"; // the username that you created, or were given, to access your database
|
||||
$dbpass = "J15h9933"; // the password that you created, or were given, to access your database
|
||||
|
||||
mysql_connect($dbhost, $dbuser, $dbpass) or die("MySQL Error: " . mysql_error());
|
||||
mysql_select_db($dbname) or die("MySQL Error: " . mysql_error());
|
||||
?>
|
||||
@@ -1,82 +0,0 @@
|
||||
<?php include "base.php"; ?>
|
||||
<?php
|
||||
|
||||
//random number generator function
|
||||
function UniqueRandomNumbersWithinRange($min, $max, $quantity) {
|
||||
$numbers = range($min, $max);
|
||||
shuffle($numbers);
|
||||
$array = array_slice($numbers, 0, $quantity);
|
||||
return $array;
|
||||
}
|
||||
//get the number of rows in the table *THIS WORKS
|
||||
function GetNumberOfRows() {
|
||||
$result = mysql_query( "select count(UserID) as num_rows from users" );
|
||||
$row = mysql_fetch_object( $result );
|
||||
$total = $row->num_rows;
|
||||
return $total;
|
||||
}
|
||||
//call that stuff to do what I want
|
||||
$numberofrows = GetNumberOfRows(); //*THIS WORKS
|
||||
$IDarray = UniqueRandomNumbersWithinRange(1,$numberofrows,$numberofrows);
|
||||
|
||||
echo "Here begins the tempIDs output by the for loop:" ;
|
||||
echo "<br>" ;
|
||||
//print_r ($IDarray);
|
||||
for ($counter = 1; $counter <= $numberofrows; $counter += 1) { //*THIS WORKS
|
||||
$assassinID = $IDarray[$counter - 1] ; //*THIS WORKS
|
||||
if ($assassinID == $numberofrows) {
|
||||
$targetID = 1 ;
|
||||
}
|
||||
else {
|
||||
$targetID = $assassinID + 1 ;
|
||||
}
|
||||
|
||||
echo "a: " ;
|
||||
echo $assassinID ;
|
||||
echo "<br>" ;
|
||||
echo "t: " ;
|
||||
echo $targetID ;
|
||||
echo "<br>" ;
|
||||
|
||||
|
||||
//set tempID as the assassinID of the user in the row $counter
|
||||
|
||||
//set tempID+1 as the target ID of the user in the row $counter
|
||||
//mysql_query( "NSERT INTO users (AssassinID, TargetID) VALUES ($assassinID, $targetID)" );
|
||||
echo "Start AssassinSQL " ;
|
||||
//UPDATE Users SET weight = 160, desiredWeight = 145 WHERE id = 1;
|
||||
mysql_query( "UPDATE users SET AssassinID = $assassinID WHERE UserID = $counter" ) ;
|
||||
echo $counter ;
|
||||
echo "<br>" ;
|
||||
echo "Start TargetSQL " ;
|
||||
//UPDATE Users SET weight = 160, desiredWeight = 145 WHERE id = 1;
|
||||
mysql_query( "UPDATE users SET TargetID = $targetID WHERE UserID = $counter" ) ;
|
||||
echo $counter ;
|
||||
echo "<br>" ;
|
||||
|
||||
mysql_query( "UPDATE users SET Status = 'Alive' WHERE UserID = $counter" ) ;
|
||||
mysql_query( "UPDATE users SET Kills = 0 WHERE UserID = $counter" ) ;
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<!--meta content="3;index.php" http-equiv="refresh"-->
|
||||
|
||||
<!--
|
||||
UniqueRandomNumbersWithinRange(1,GetNumberOfRows(),GetNumberOfRows())
|
||||
|
||||
For each position in the array: (use i)
|
||||
userID i is assigned the contents of the array as assassinID
|
||||
targetID is set as as the contents of the array + 1
|
||||
|
||||
|
||||
Then for each position in the array apply the shuffled number at that position to the user at that position in the table as a column 'AssassinID'.
|
||||
|
||||
Then when the game begins just allocate everyone the user with the assassin number after theirs.
|
||||
|
||||
When a user successfully kills a player mark that play as dead, void their target column and change the number in the killer's target column to that which was in the deceased's target column.
|
||||
|
||||
|
||||
-->
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 104 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 404 KiB |
Reference in New Issue
Block a user