Escape string
#1

Alright so Ive got a simple question, since I want to avoid any data injection, could I simply do things such as

PHP код:
mysql_format(mysqlquery,sizeof(query),"UPDATE `players` SET `Username`='%e' WHERE `ID`=%d",NewName,AccInfo[playerid][ID]);
    
mysql_tquery(mysqlquery); 
Or Id have to escape the string other way?

Im trying to understand how it all works.

So basically is it enough if I use '%e' when formating or I have to still do something to avoid data injection?
Reply
#2

I believe in this mysql version you are using %e is enough, although, you should use usual mysql string escape.
Reply
#3

Quote:
Originally Posted by ikey07
Посмотреть сообщение
I believe in this mysql version you are using %e is enough, although, you should use usual mysql string escape.
Yes but how do I use it? Im not that good with this to be honest
Reply
#4

%e is escaping the string, should be good enough.
Reply
#5

Thanks! Thats all I needed! ++rep
Reply
#6

%e is indeed an escape string,
Im using it in my code too.
Код:
mysql_format(mysql, query, sizeof(query), "SELECT * FROM `players` WHERE `Username` = '%e' LIMIT 1", Name[playerid]);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)