SQL syntax error

Ask questions about errors and problems related to the amxbans project.
The more details you give, the better answer you will receive, READ the sticky topics before posting!

Be sure to post in the right sub forum: Bugs and Security
Post Reply
thescaryguy
Posts: 18
Joined: 19 Feb 2020, 20:37

SQL syntax error

Post by thescaryguy »

When I try to ban a player through the web Admin Area/Add ban (https://mywebsite.net/amxbans/admin.php?site=ban_add), I get an error and the ban does not go through. This is a new install.

I need your help in solving this. Any suggestions are appreciated.

AMXBans Website Version 6.14.4
Webserver Apache
PHP Version 7.1.14
MySQL Version 5.6.41-84.1

THE ERROR:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ing',UNIX_TIMESTAMP(),'60','website')' at line 4

Using GitBash linux console shell in Windows, I used grep to search for "UNIX_TIMESTAMP" with the following command:

Code: Select all

grep -i -r 'UNIX_TIMESTAMP()'
This yielded the following results:

Code: Select all

$ grep -i -r 'UNIX_TIMESTAMP()'
include/access.inc.php: $query = mysql_query("UPDATE `".$config->db_prefix."_webadmins` SET `last_action`=UNIX_TIMESTAMP() WHERE `id`=".$_SESSION["uid"]);
include/admin/admin_ban_add.php:                                        ('".$ip."','".$steamid."','".$name."','".$_SESSION["uname"]."','".$_SESSION["uname"]."','".$ban_type."','".$reason."',UNIX_TIMESTAMP(),'".$ban_length."','website')
include/admin/admin_ban_add_online.php:                                        ('".$pl_ip."','".$pl_steamid."','".$pl_name."','".$_SESSION["uname"]."','".$_SESSION["uname"]."','".$type."','".$pl_reason."',UNIX_TIMESTAMP(),'".$pl_ban_length."','website')
include/admin/admin_sm_av.php:                  $exp="(UNIX_TIMESTAMP()+(".($days * 86400).")),";
include/admin/admin_sm_av.php:                                                 UNIX_TIMESTAMP(),
include/logfunc.inc.php:                        NULL , UNIX_TIMESTAMP(), '".$_SERVER["REMOTE_ADDR"]."', '".$_SESSION["uname"]."', '".sql_safe($action)."', '".sql_safe($remarks)."'
include/sql.inc.php:    $query = mysql_query("SELECT * FROM `".$config->db_prefix."_amxadmins` WHERE `ashow`=1 AND (`expired`=0 OR `expired`>UNIX_TIMESTAMP()) ORDER BY `expired`,`access` DESC,`username` ASC") or die (mysql_error());
include/user/user_bd.php:                               VALUES ('".$bid."',UNIX_TIMESTAMP(),'".$_SESSION["uname"]."','".$edit_reason."')"
include/user/user_bd.php:                               VALUES ('".$name."','".$comment."','".$email."','".$_SERVER["REMOTE_ADDR"]."',UNIX_TIMESTAMP(),".$bid.")"
include/user/user_bd.php:                               VALUES (UNIX_TIMESTAMP(),0,".$bid.",'".$temp_file."','".$real_file."','".$comment."','".$name."','".$email."',".$_FILES['filename']['size'].",'".$_SERVER["REMOTE_ADDR"]."')"
login.php:                                      $query = mysql_query("UPDATE `".$config->db_prefix."_webadmins` SET `logcode`='".session_id()."',`last_action`=UNIX_TIMESTAMP(),`try`=0 WHERE `id`=".$_SESSION["uid"]);
login.php:                                              $query = @mysql_query("UPDATE `".$config->db_prefix."_webadmins` SET `try`=".$try.",`logcode`=NULL,`last_action`=UNIX_TIMESTAMP() WHERE username='$uname' LIMIT 1");
phpmyadmin/libraries/classes/Controllers/Server/Status/StatusController.php:            'SELECT UNIX_TIMESTAMP() - ' . $this->data->status['Uptime']
phpmyadmin-old/server_status.php:        'SELECT UNIX_TIMESTAMP() - ' . $ServerStatusData->status['Uptime']
UNIX_TIMESTAMP.error.txt:include/access.inc.php:        $query = mysql_query("UPDATE `".$config->db_prefix."_webadmins` SET `last_action`=UNIX_TIMESTAMP() WHERE `id`=".$_SESSION["uid"]);
UNIX_TIMESTAMP.error.txt:include/admin/admin_ban_add.php:                      ('".$ip."','".$steamid."','".$name."','".$_SESSION["uname"]."','".$_SESSION["uname"]."','".$ban_type."','".$reason."',UNIX_TIMESTAMP(),'".$ban_length."','website')
UNIX_TIMESTAMP.error.txt:include/admin/admin_ban_add_online.php:               ('".$pl_ip."','".$pl_steamid."','".$pl_name."','".$_SESSION["uname"]."','".$_SESSION["uname"]."','".$type."','".$pl_reason."',UNIX_TIMESTAMP(),'".$pl_ban_length."','website')
UNIX_TIMESTAMP.error.txt:include/admin/admin_sm_av.php:                 $exp="(UNIX_TIMESTAMP()+(".($days * 86400).")),";
UNIX_TIMESTAMP.error.txt:include/admin/admin_sm_av.php:                        UNIX_TIMESTAMP(),
UNIX_TIMESTAMP.error.txt:include/logfunc.inc.php:                       NULL , UNIX_TIMESTAMP(), '".$_SERVER["REMOTE_ADDR"]."', '".$_SESSION["uname"]."', '".sql_safe($action)."', '".sql_safe($remarks)."'
UNIX_TIMESTAMP.error.txt:include/sql.inc.php:   $query = mysql_query("SELECT * FROM `".$config->db_prefix."_amxadmins` WHERE `ashow`=1 AND (`expired`=0 OR `expired`>UNIX_TIMESTAMP()) ORDER BY `expired`,`access` DESC,`username` ASC") or die (mysql_error());
UNIX_TIMESTAMP.error.txt:include/user/user_bd.php:                             VALUES ('".$bid."',UNIX_TIMESTAMP(),'".$_SESSION["uname"]."','".$edit_reason."')"
UNIX_TIMESTAMP.error.txt:include/user/user_bd.php:                             VALUES ('".$name."','".$comment."','".$email."','".$_SERVER["REMOTE_ADDR"]."',UNIX_TIMESTAMP(),".$bid.")"
UNIX_TIMESTAMP.error.txt:include/user/user_bd.php:                             VALUES (UNIX_TIMESTAMP(),0,".$bid.",'".$temp_file."','".$real_file."','".$comment."','".$name."','".$email."',".$_FILES['filename']['size'].",'".$_SERVER["REMOTE_ADDR"]."')"
UNIX_TIMESTAMP.error.txt:login.php:                                     $query = mysql_query("UPDATE `".$config->db_prefix."_webadmins` SET `logcode`='".session_id()."',`last_action`=UNIX_TIMESTAMP(),`try`=0 WHERE `id`=".$_SESSION["uid"]);
UNIX_TIMESTAMP.error.txt:login.php:                                            $query = @mysql_query("UPDATE `".$config->db_prefix."_webadmins` SET `try`=".$try.",`logcode`=NULL,`last_action`=UNIX_TIMESTAMP() WHERE username='$uname' LIMIT 1");
UNIX_TIMESTAMP.error.txt:phpmyadmin/libraries/classes/Controllers/Server/Status/StatusController.php:            'SELECT UNIX_TIMESTAMP() - ' . $this->data->status['Uptime']
UNIX_TIMESTAMP.error.txt:phpmyadmin-old/server_status.php:        'SELECT UNIX_TIMESTAMP() - ' . $ServerStatusData->status['Uptime']
I am thinking that the problem lies in include/admin/admin_ban_add_online.php. I don't know PHP well enough to tackle this and need help. Any suggestions?
User avatar
indianiso1
Posts: 173
Joined: 16 Oct 2015, 01:59
Contact:

Re: SQL syntax error

Post by indianiso1 »

Yes probably- what data did you write in following fields:
- Player name
- reason?

btw I would appreciate any server that is currently active with players and bans to test newest version of AMXBans. More different systems will be tested - less bug-fixes will be needed.
GodOfWonders
Posts: 5
Joined: 24 Nov 2019, 21:10

Re: SQL syntax error

Post by GodOfWonders »

I can do whatever testing you need. I have a couple of servers that I have with 1.6 and would be willing to help out with bug testing on 1 of them if needed.
Post Reply