sql error

Šiame forume rašomi vartotojų klausimai/problemos su kuriomis jie susidūrė kuriant pluginus.
Post Reply
User avatar
aurimasko
Flooderis arba specialistas
Posts: 736
Joined: 2010 Sep 04 08:45

sql error

Post by aurimasko »

Code: Select all

 public connect_message(id){    new name[50], steamid[32], ip[32]        get_user_info(id, "name", name, 49)    get_user_authid(id, steamid, 31)    get_user_ip(id, ip, 31, 1)        new ErrorCode,Handle:SqlConnection = SQL_Connect(g_SqlTuple,ErrorCode,g_Error,511)    if(g_SqlTuple == Empty_Handle) {        log_amx(g_Error)    }       new Handle:Query = SQL_PrepareQuery(SqlConnection,"SELECT * FROM `vvp_users` WHERE (`username`='%s' OR `ip`='%s' OR `steamid`='%s')", name, ip, steamid)} 
Erroras:

Code: Select all

 L 07/22/2011 - 14:20:22: [public_vip.amxx] 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 't Stop | auD maS' OR `ip`='78.63.100.209' OR `steamid`='STEAM_0:0:947429302')' at line 1 
O nickas ne t Stop.., o Don't Stop | auD maS


Kaip galima būtų ištaisyt?

morka
Gana aktyvus vartotojas
Posts: 292
Joined: 2011 Jan 08 00:21

Re: sql error

Post by morka »

mysql_escape_string(); arba su Regular Expresions patikrint ir neleisti ivesti tokiu simboliu kaip apostrofos, arba dar galima is ivedamo teksto istrinti tokius simbolius.

Nes taip gausis kaip sql injeksija.
Image

User avatar
psychical
Viršininkas
Posts: 2094
Joined: 2011 Mar 12 22:19
Skype: tautvydas11
Location: Linksmakalnis
Contact:

Re: sql error

Post by psychical »

Naudok "(bent php tai imanoma) vietoj ' Query'je, del amxx mysql nzn

User avatar
aaarnas
Vyr. diskusijų administratorius
Posts: 3891
Joined: 2010 Aug 31 13:21
Skype: fiarno
Contact:

Re: sql error

Post by aaarnas »

Pamėgink niką prieš tau praleisti pro šitą funkciją: SQL_QuoteString

Nepamiršk, kad reikia šiai funkcijai ne tuple handle, o connection.

Be to nesvarbu kokia programavimo kalba, visur sql užklausos turi savo taisykles ir visos kalbos vienodai suformatuoja, skiriasi tik kaip jos tai padaro.
Palikau CS pasaulį ;/ . Nebepasiekiamas.

User avatar
aurimasko
Flooderis arba specialistas
Posts: 736
Joined: 2010 Sep 04 08:45

Re: sql error

Post by aurimasko »

o tai mano sql būdas blogas?

User avatar
aaarnas
Vyr. diskusijų administratorius
Posts: 3891
Joined: 2010 Aug 31 13:21
Skype: fiarno
Contact:

Re: sql error

Post by aaarnas »

Code: Select all

public connect_message(id){    new name[50], steamid[32], ip[32]        get_user_info(id, "name", name, 49)    get_user_authid(id, steamid, 31)    get_user_ip(id, ip, 31, 1)        new ErrorCode,Handle:SqlConnection = SQL_Connect(g_SqlTuple,ErrorCode,g_Error,511)    if(g_SqlTuple == Empty_Handle) {        log_amx(g_Error)    }        SQL_QuoteString(SqlConnection, name, charsmax(name), name)        new Handle:Query = SQL_PrepareQuery(SqlConnection,"SELECT * FROM `vvp_users` WHERE (`username`='%s' OR `ip`='%s' OR `steamid`='%s')", name, ip, steamid)}
Palikau CS pasaulį ;/ . Nebepasiekiamas.

morka
Gana aktyvus vartotojas
Posts: 292
Joined: 2011 Jan 08 00:21

Re: sql error

Post by morka »

Pazejau tai pats zaidimas pasalina ' " simbolius, tipo vistiek is amxx puses reikia konvertuoti? Galima su exploitais prisijungt prie serverio su siais zenklais?
Image

User avatar
aaarnas
Vyr. diskusijų administratorius
Posts: 3891
Joined: 2010 Aug 31 13:21
Skype: fiarno
Contact:

Re: sql error

Post by aaarnas »

Reikia žiūrėti kokia yra sql klaida ir ją taisyti.
Palikau CS pasaulį ;/ . Nebepasiekiamas.

hermiane
Naujokas apylinkėse
Posts: 1
Joined: 2024 Jun 05 10:58
Skype: NA

Re: sql error

Post by hermiane »

Enjoy informative and interactive learning with the College of Contract Management. The online attendance college provides a pool of courses you can choose from. Plus, it is an online course so you will get full access of course materials and lectures anytime! Visit their student portal UNICCM.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest