diff --git a/website/api/manager/ManagerAPI.php b/website/api/manager/ManagerAPI.php index 06ede14a3..3994d667f 100644 --- a/website/api/manager/ManagerAPI.php +++ b/website/api/manager/ManagerAPI.php @@ -131,11 +131,12 @@ protected function compile() { if($didCompile == 1) { // Did succeed $this->sendNotification($user, "Compilation Success", "
Your bot was sucessfully compiled on our servers as a program written in {$language}. Within a few minutes, your bot will begin playing games against other contestant's programs. Replays of these games will show up on your homepage.
", 1); - $this->insert("UPDATE User SET numSubmissions=numSubmissions+1, numGames=0, mu = 25.000, sigma = 8.333, compileStatus = 0, isRunning = 1, language = '".$this->mysqli->real_escape_string($language)."' WHERE userID = ".$this->mysqli->real_escape_string($userID)); + $this->insert("UPDATE User SET numSubmissions=numSubmissions+1, numGames=0, mu = 25.000, sigma = 8.333, compileStatus = 0, isRunning = 1, language = '".$this->mysqli->real_escape_string($language)."', compileTime = NOW() WHERE userID = ".$this->mysqli->real_escape_string($userID)); if(intval($user['numSubmissions']) != 0) { $numActiveUsers = mysqli_query($this->mysqli, "SELECT userID FROM User WHERE isRunning=1")->num_rows; - $this->insert("INSERT INTO UserHistory (userID, versionNumber, lastRank, lastNumPlayers, lastNumGames) VALUES ({$user['userID']}, {$user['numSubmissions']}, {$user['rank']}, $numActiveUsers, {$user['numGames']})"); + $compileTime = $user['compileTime'] == NULL ? 'NULL' : "'{$user['compileTime']}'"; + $this->insert("INSERT INTO UserHistory (userID, versionNumber, compileTime, lastRank, lastNumPlayers, lastNumGames) VALUES ({$user['userID']}, {$user['numSubmissions']}, $compileTime, {$user['rank']}, $numActiveUsers, {$user['numGames']})"); } } else { // Didnt succeed $this->sendNotification($user, "Compilation Failure", "The bot that you recently submitted to the Halite competition would not compile on our servers.
Our autocompile script thought that your bot was written in \"{$language}\".
Here is a description of the compilation error:
{$_POST['errors']}", -1);
diff --git a/website/api/web/WebsiteAPI.php b/website/api/web/WebsiteAPI.php
index 064e449cd..fd2820e0a 100644
--- a/website/api/web/WebsiteAPI.php
+++ b/website/api/web/WebsiteAPI.php
@@ -134,7 +134,12 @@ protected function user() {
else if(isset($_GET['fields']) && isset($_GET['values'])) {
$limit = isset($_GET['limit']) ? intval($_GET['limit']) : 10;
$whereClauses = array_map(function($a) {
- return $this->mysqli->real_escape_string($_GET['fields'][$a])." = '".$this->mysqli->real_escape_string($_GET['values'][$a])."'";
+ $allowedOps = array("=", "!=", ">", "<", ">=", "<=", "IS", "IS NOT");
+ $compOp = "=";
+ if(isset($_GET['comparison']) && in_array($_GET['comparison'][$a], $allowedOps)) {
+ $compOp = $_GET['comparison'][$a];
+ }
+ return $this->mysqli->real_escape_string($_GET['fields'][$a])." ".$compOp." '".$this->mysqli->real_escape_string($_GET['values'][$a])."'";
}, range(0, count($_GET['fields'])-1));
$orderBy = isset($_GET['orderBy']) ? $this->mysqli->real_escape_string($_GET['orderBy']) : 'rank';
$page = isset($_GET['page']) ? intval($_GET['page']) : 0;
diff --git a/website/recent_submissions.php b/website/recent_submissions.php
new file mode 100644
index 000000000..585faa0ed
--- /dev/null
+++ b/website/recent_submissions.php
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+ | Time | Player | Last Rank | Language | Version | +
|---|