diff --git a/public/add.php b/public/add.php
index 77d8e5e..34f11cc 100644
--- a/public/add.php
+++ b/public/add.php
@@ -4,11 +4,11 @@ include('db_connect.php');
include('functions.php');
if($_POST) {
- $order = getHighestOrderNum() + 1;
+ $order = getHighestOrderNum($conn) + 1;
for($i = 0; $i < $_POST['num']; $i++) {
if($_POST['first-' . $i] != "") {
if(!$_POST['staff-' . $i]) $_POST['staff-' . $i] = 0;
- mysql_query('INSERT INTO spooners (first, last, order_num, staff) VALUES ("' . mysql_real_escape_string($_POST['first-' . $i]) . '", "' . mysql_real_escape_string($_POST['last-' . $i]) . '", ' . $order . ', ' . mysql_real_escape_string($_POST['staff-' . $i]) . ')') or die(mysql_error());
+ mysqli_query($conn, 'INSERT INTO spooners (first, last, order_num, staff) VALUES ("' . mysqli_real_escape_string($conn, $_POST['first-' . $i]) . '", "' . mysqli_real_escape_string($conn, $_POST['last-' . $i]) . '", ' . $order . ', ' . mysqli_real_escape_string($conn, $_POST['staff-' . $i]) . ')') or die(mysqli_error($conn));
$order++;
}
}
diff --git a/public/config-sample.php b/public/config-sample.php
index c69bb52..00e8e4c 100644
--- a/public/config-sample.php
+++ b/public/config-sample.php
@@ -1,17 +1,26 @@
\ No newline at end of file
+?>
diff --git a/public/db_connect.php b/public/db_connect.php
index 22fb193..5c988da 100644
--- a/public/db_connect.php
+++ b/public/db_connect.php
@@ -1,6 +1,17 @@
\ No newline at end of file
+//mysql_query('SET time_zone = "' . $timezone_number . '"');
+
+
+// Create connection
+$conn = mysqli_connect($db_host, $db_user, $db_pass, $db_name);
+
+// Check connection
+if (!$conn) {
+ die("Connection failed: " . mysqli_connect_error());
+}
+
+
+?>
diff --git a/public/footer.php b/public/footer.php
index 2f0dbab..84261d1 100644
--- a/public/footer.php
+++ b/public/footer.php
@@ -45,20 +45,6 @@
-
-
+
diff --git a/public/index.php b/public/index.php
index 2bf81ed..6360d78 100644
--- a/public/index.php
+++ b/public/index.php
@@ -3,10 +3,10 @@ include('init.php');
// needs to be at top so we can redirect to prevent double-shuffling or double-clearing
if(isset($_GET['shuffle']) && isset($_GET['confirmed'])) {
- shuffleSpooners();
+ shuffleSpooners($conn);
header("Location:" . $site_url . "/shuffle/done");
} else if(isset($_GET['clear']) && isset($_GET['confirmed'])) {
- mysql_query("TRUNCATE spooners");
+ mysqli_query($conn, "TRUNCATE spooners");
header("Location:" . $site_url . "/clear/done");
}
@@ -103,21 +103,21 @@ h2, h4{
/*********** SPOONING **********/
if(isset($_GET['spoon'])) {
- spoonByID($_GET['spoon']);
+ spoonByID($_GET['spoon'], $conn);
?>
×
-
has been spooned! 's new target is .
+ has been spooned! 's new target is .
×
-
has been revived, but note that he or she has been added to the end of the list.
+
has been revived, but note that he or she has been added to the end of the list.
It's recommended to drag the revived spooner below a staff member so that you don't have to tell a camper that his or her target has changed for no reason.
-Active Spooners ()
+Active Spooners ()
- 0) { ?>
+ 0) { ?>
@@ -215,7 +215,7 @@ $result = mysql_query("SELECT id, first, last, staff FROM spooners WHERE spooned
@@ -223,7 +223,7 @@ $result = mysql_query("SELECT id, first, last, staff FROM spooners WHERE spooned
' . $spooner['first'] . '
' . $spooner['last'] . '
-
+
';
}
@@ -237,12 +237,12 @@ $result = mysql_query("SELECT id, first, last, staff FROM spooners WHERE spooned
-Dead Spooners ()
+Dead Spooners ()
- 0) { ?>
+ 0) { ?>
@@ -254,14 +254,14 @@ $result = mysql_query("SELECT id, first, last, staff, spooned_by, time_spooned F
Revive
' . $spooner['first'] . ' ' . $spooner['last'] . '
- Spooned by ' . getNameByID($spooner['spooned_by']) . ' on ' . date('l', strtotime($spooner['time_spooned'])) . ' at ' . date('g:i A', strtotime($spooner['time_spooned'])) . ' .
- Spooned by ' . getNameByID($spooner['spooned_by']) . ' on ' . date('l', strtotime($spooner['time_spooned'])) . ' at ' . date('g:i A', strtotime($spooner['time_spooned'])) . ' .
+ Spooned by ' . getNameByID($spooner['spooned_by'], $conn) . ' on ' . date('l', strtotime($spooner['time_spooned'])) . ' at ' . date('g:i A', strtotime($spooner['time_spooned'])) . ' .
+ Spooned by ' . getNameByID($spooner['spooned_by'], $conn) . ' on ' . date('l', strtotime($spooner['time_spooned'])) . ' at ' . date('g:i A', strtotime($spooner['time_spooned'])) . ' .
';
diff --git a/public/print.php b/public/print.php
index 6883891..21a4c7b 100644
--- a/public/print.php
+++ b/public/print.php
@@ -9,10 +9,10 @@ if(!isset($_SESSION['logged_in']) || $_SESSION['logged_in'] == FALSE) {
include('db_connect.php');
-$result = mysql_query("SELECT first, last FROM spooners WHERE spooned = 0 ORDER BY order_num") or die(mysql_error());
+$result = mysqli_query($conn, "SELECT first, last FROM spooners WHERE spooned = 0 ORDER BY order_num") or die(mysqli_error($conn));
$i = 0;
-while($spooner = mysql_fetch_array($result)) {
+while($spooner = mysqli_fetch_array($result)) {
$spooners[$i]['name'] = $spooner['first'];
if($spooner['last']) $spooners[$i]['name'] .= " " . $spooner['last'];
diff --git a/public/sort_save.php b/public/sort_save.php
index b18dcc9..c5d481e 100644
--- a/public/sort_save.php
+++ b/public/sort_save.php
@@ -5,6 +5,6 @@ include('db_connect.php');
$order_array = explode(",", $_POST['order']);
foreach($order_array as $key => $value) {
echo $value . ' > ' . $key . "\n";
- mysql_query("UPDATE spooners SET order_num = " . $key . " WHERE id = " . $value) or die(mysql_error());
+ mysqli_query($conn, ("UPDATE spooners SET order_num = " . $key . " WHERE id = " . $value) or die(mysqli_error($conn));
}
?>
\ No newline at end of file