Skip to content

Commit

Permalink
Merge pull request #161 from CraftedRO/ipban
Browse files Browse the repository at this point in the history
Fix ip ban sql insert syntax error
  • Loading branch information
Err0r1 committed Jan 30, 2023
2 parents e070fcd + 4873e05 commit d9e1bfa
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions application/modules/mod/models/Mod_model.php
Expand Up @@ -97,13 +97,13 @@ public function setIPBan($realmdConnection, $IP, $bannedBy, $banReason, $banDate
if ($realmdConnection && $IP && $bannedBy && $banReason) {
if (column("ip_banned", "banreason") && column("ip_banned", "bandate")) {
//check if it go the banreason and bandate
$realmdConnection->query("INSERT INTO " . table("ip_banned") . " (`" . column("ip_banned", "ip") . "`, `" . column("ip_banned", "bandate") . "`, `" . column("ip_banned", "unbandate") . "`, `" . column("ip_banned", "bannedby") . "`, `" . column("ip_banned", "banreason") . "`) VALUES (" . $IP . ", " . time() . ", " . $banDate . ", '" . $bannedBy . "', '" . $banReason . "')");
$realmdConnection->query("INSERT INTO " . table("ip_banned") . " (`" . column("ip_banned", "ip") . "`, `" . column("ip_banned", "bandate") . "`, `" . column("ip_banned", "unbandate") . "`, `" . column("ip_banned", "bannedby") . "`, `" . column("ip_banned", "banreason") . "`) VALUES ('" . $IP . "', " . time() . ", " . $banDate . ", '" . $bannedBy . "', '" . $banReason . "')");
} elseif (column("ip_banned", "banreason") && !column("ip_banned", "bandate")) {
//check if it got only banreason
$realmdConnection->query("INSERT INTO " . table("ip_banned") . " (`" . column("ip_banned", "ip") . "`, `" . column("ip_banned", "banreason") . "`) VALUES (" . $IP . ", '" . $banReason . "')");
$realmdConnection->query("INSERT INTO " . table("ip_banned") . " (`" . column("ip_banned", "ip") . "`, `" . column("ip_banned", "banreason") . "`) VALUES ('" . $IP . "', '" . $banReason . "')");
} else {
//else it doesn't got the banreason and bandate
$realmdConnection->query("INSERT INTO " . table("ip_banned") . " (`" . column("ip_banned", "ip") . "`) VALUES (" . $IP . ")");
$realmdConnection->query("INSERT INTO " . table("ip_banned") . " (`" . column("ip_banned", "ip") . "`) VALUES ('" . $IP . "')");
}
} else {
return false;
Expand Down

0 comments on commit d9e1bfa

Please sign in to comment.