Raised This Month: $51 Target: $400
 12% 

Mysql Problem Crash on Map end


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Kubad
Senior Member
Join Date: Sep 2015
Location: Czech Republic
Old 04-30-2018 , 08:17   Mysql Problem Crash on Map end
Reply With Quote #1

i have this onclientdisconnect and my server crash and i dont know why but i im solo on server saving working fine
PHP Code:
char querydis[1024],name[32],steamid[32];
    
GetClientAuthId(clientAuthId_Steam2steamidsizeof(steamid));
    
GetClientName(client,name,sizeof(name));
    
FormatEx(querydissizeof(querydis), "UPDATE  `JBStats` SET  `nick`= '%s', `ctkills`= '%i', `ctdeaths`= '%i', `ctheadshots`= '%i', `tkills`= '%i', `tdeaths`= '%i', `theadshots`= '%i', `days`= '%i', `hours`= '%i', `minutes`= '%i' WHERE  `JBStats`.`steamid` =  '%s'"namectkills[client], ctdeaths[client], ctheadshot[client], tkills[client], tdeaths[client], theadshot[client], days[client], hours[client], minutes[client], steamid);
    
SQL_Query(DBstatsquerydis,GetClientSerial(client)); 
Kubad is offline
Reiko1231
Member
Join Date: Apr 2013
Location: Russia
Old 04-30-2018 , 12:05   Re: Mysql Problem Crash on Map end
Reply With Quote #2

Use threaded query via SQL_TQuery. Non-threaded query forces server to wait for responce, and one query can take significant time to execute (more than 1 second). So if you have for example 20 players, your server will hang up for long time after map end, because this event force all players to reconnect to server again after map changed.
Reiko1231 is offline
Kubad
Senior Member
Join Date: Sep 2015
Location: Czech Republic
Old 04-30-2018 , 12:45   Re: Mysql Problem Crash on Map end
Reply With Quote #3

yeah i found already but thank you
Kubad is offline
shavit
AlliedModders Donor
Join Date: Dec 2011
Location: Israel
Old 05-02-2018 , 15:48   Re: Mysql Problem Crash on Map end
Reply With Quote #4

You can perform SQL injection using this.
When processing any user input, you should escape it. Look up SQL_EscapeString, escape the name and make sure the SteamID is valid (GetClientAuthId returns true if it is).
__________________
retired
shavit is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 23:38.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode