aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLiam McLoughlin <hexxeh@hexxeh.net>2011-07-27 21:04:32 +0100
committerLiam McLoughlin <hexxeh@hexxeh.net>2011-07-27 21:04:32 +0100
commite27028f91f5fb2149054adbb89d14177f0e6f3db (patch)
treeb4a1c0729fbb92237fd6e25434b93b8b761c7e5e /web/index.php
parentMoved to using mysqli and prepared statements (diff)
downloadgentoaster-e27028f91f5fb2149054adbb89d14177f0e6f3db.tar.gz
gentoaster-e27028f91f5fb2149054adbb89d14177f0e6f3db.tar.bz2
gentoaster-e27028f91f5fb2149054adbb89d14177f0e6f3db.zip
Added simultaneous build settings
Diffstat (limited to 'web/index.php')
-rw-r--r--web/index.php23
1 files changed, 23 insertions, 0 deletions
diff --git a/web/index.php b/web/index.php
index 6b6abec..a68a219 100644
--- a/web/index.php
+++ b/web/index.php
@@ -5,6 +5,29 @@
require_once "recaptcha.php";
}
+ if(!SIMULTANEOUS_BUILDS) {
+ $db = new mysqli(MYSQL_HOSTNAME, MYSQL_USERNAME,
+ MYSQL_PASSWORD, MYSQL_DATABASE);
+ if (mysqli_connect_errno()) {
+ die("Could not connect to database ".mysqli_connect_error());
+ }
+
+ $ipaddress = filter_input(INPUT_SERVER, "REMOTE_ADDR",
+ FILTER_VALIDATE_IP);
+
+ $stmt = $db->prepare("SELECT id FROM builds WHERE ipaddress = ?");
+ $stmt->bind_param("s", $ipaddress);
+ $stmt->execute();
+ $stmt->store_result();
+
+ if ($stmt->num_rows == 1) {
+ $stmt->bind_result($buildID);
+ $stmt->fetch();
+ header("Location: status.php?uuid=".$buildID."&simultaneous=true");
+ }
+ $stmt->close();
+ }
+
$timezones = array();
$zonetab = file(ZONETAB);
foreach ($zonetab as $buf) {