diff --git a/view/requirements/page.php b/view/requirements/page.php
index f86a542..140a5ff 100644
--- a/view/requirements/page.php
+++ b/view/requirements/page.php
@@ -37,33 +37,52 @@
$reason = "";
if ($session->getUserInfo('ram') > SettingsManager::getSetting('max_ram')) {
$reason = "RAM";
- $conn->query("UPDATE `mythicaldash_users` SET `ram` = '".SettingsManager::getSetting('max_ram') - 1 ."' WHERE `mythicaldash_users`.`api_key` = '".mysqli_real_escape_string($conn, $_COOKIE['token'])."';");
+ $new_ram = (int)SettingsManager::getSetting('max_ram') - 1;
+ if ($new_ram >= 0) {
+ $conn->query("UPDATE `mythicaldash_users` SET `ram` = '". $new_ram ."' WHERE `mythicaldash_users`.`api_key` = '".mysqli_real_escape_string($conn, $_COOKIE['token'])."';");
+ }
} elseif ($session->getUserInfo('cpu') > SettingsManager::getSetting('max_cpu')) {
$reason = "CPU";
- $conn->query("UPDATE `mythicaldash_users` SET `cpu` = '". SettingsManager::getSetting('max_cpu') - 1 ."' WHERE `mythicaldash_users`.`api_key` = '".mysqli_real_escape_string($conn, $_COOKIE['token'])."';");
+ $new_cpu = (int)SettingsManager::getSetting('max_cpu') - 1;
+ if ($new_cpu >= 0) {
+ $conn->query("UPDATE `mythicaldash_users` SET `cpu` = '". $new_cpu ."' WHERE `mythicaldash_users`.`api_key` = '".mysqli_real_escape_string($conn, $_COOKIE['token'])."';");
+ }
} elseif ($session->getUserInfo('disk') > SettingsManager::getSetting('max_disk')) {
$reason = "Disk Space";
- $conn->query("UPDATE `mythicaldash_users` SET `disk` = '".SettingsManager::getSetting('max_disk') - 1 ."' WHERE `mythicaldash_users`.`api_key` = '".mysqli_real_escape_string($conn, $_COOKIE['token'])."';");
+ $new_disk = (int)SettingsManager::getSetting('max_disk') - 1;
+ if ($new_disk >= 0) {
+ $conn->query("UPDATE `mythicaldash_users` SET `disk` = '". $new_disk ."' WHERE `mythicaldash_users`.`api_key` = '".mysqli_real_escape_string($conn, $_COOKIE['token'])."';");
+ }
} elseif ($session->getUserInfo('server_limit') > SettingsManager::getSetting('max_servers')) {
$reason = "Server Limit";
- $conn->query("UPDATE `mythicaldash_users` SET `server_limit` = '".SettingsManager::getSetting('max_servers') - 1 ."' WHERE `mythicaldash_users`.`api_key` = '".mysqli_real_escape_string($conn, $_COOKIE['token'])."';");
+ $new_server_limit = (int)SettingsManager::getSetting('max_servers') - 1;
+ if ($new_server_limit >= 0) {
+ $conn->query("UPDATE `mythicaldash_users` SET `server_limit` = '". $new_server_limit ."' WHERE `mythicaldash_users`.`api_key` = '".mysqli_real_escape_string($conn, $_COOKIE['token'])."';");
+ }
} elseif ($session->getUserInfo('databases') > SettingsManager::getSetting('max_dbs')) {
$reason = "Databases";
- $conn->query("UPDATE `mythicaldash_users` SET `databases` = '".SettingsManager::getSetting('max_dbs')- 1 ."' WHERE `mythicaldash_users`.`api_key` = '".mysqli_real_escape_string($conn, $_COOKIE['token'])."';");
+ $new_databases = (int)SettingsManager::getSetting('max_dbs') - 1;
+ if ($new_databases >= 0) {
+ $conn->query("UPDATE `mythicaldash_users` SET `databases` = '". $new_databases ."' WHERE `mythicaldash_users`.`api_key` = '".mysqli_real_escape_string($conn, $_COOKIE['token'])."';");
+ }
} elseif ($session->getUserInfo('backups') > SettingsManager::getSetting('max_backups')) {
$reason = "Backups";
- $conn->query("UPDATE `mythicaldash_users` SET `backups` = '".SettingsManager::getSetting('max_backups')- 1 ."' WHERE `mythicaldash_users`.`api_key` = '".mysqli_real_escape_string($conn, $_COOKIE['token'])."';");
+ $new_backups = (int)SettingsManager::getSetting('max_backups') - 1;
+ if ($new_backups >= 0) {
+ $conn->query("UPDATE `mythicaldash_users` SET `backups` = '". $new_backups ."' WHERE `mythicaldash_users`.`api_key` = '".mysqli_real_escape_string($conn, $_COOKIE['token'])."';");
+ }
} elseif ($session->getUserInfo('ports') > SettingsManager::getSetting('max_allocations')) {
$reason = "Ports";
- $conn->query("UPDATE `mythicaldash_users` SET `ports` = '".SettingsManager::getSetting('max_allocations') - 1 ."' WHERE `mythicaldash_users`.`api_key` = '".mysqli_real_escape_string($conn, $_COOKIE['token'])."';");
+ $new_ports = (int)SettingsManager::getSetting('max_allocations') - 1;
+ if ($new_ports >= 0) {
+ $conn->query("UPDATE `mythicaldash_users` SET `ports` = '". $new_ports ."' WHERE `mythicaldash_users`.`api_key` = '".mysqli_real_escape_string($conn, $_COOKIE['token'])."';");
+ }
}
if (!empty($reason)) {
echo '';
}
}
} catch (Exception $e) {
- die($e);
+ echo '';
}
-
-
-?>
\ No newline at end of file
+?>