SA-MP Forums

Go Back   SA-MP Forums > Non-English > Languages > Romnă/Romanian

Reply
 
Thread Tools Display Modes
Old 28/01/2017, 06:15 PM   #1
ProAeXel
Little Clucker
 
Join Date: Oct 2014
Posts: 7
Reputation: 0
Default mysql_real_escape_string

Salutare.Poate cineva sa ma ajute cu unele indrumari in legatura cu mysql_real_escape_string?
Cum trebuie sa arate linia de cod mai exact?
Stiu ca trebuie folosit atunci cand player-ul scrie ceva ce se duce catre baza de date.Dar nu stiu cum mai exact sa folosesc aceasta functie .Trebuiesc declarate niste caractere interzise pe undeva sau cum?
Am incercat sa o folosesc pentru comanda de schimbare a parolei,dar nu functioneaza.Cand introduc %n imi inchide serverul.O sa las partea de cod mai jos,poate cineva o sa imi explice ce si unde am gresit.

Code:
if(strlen(inputtext) > 1 && strlen(inputtext) < 16)
			{
				new tmppass[64],namee[30],playerip[16];
				mysql_real_escape_string(inputtext, tmppass);
				strmid(PlayerInfo[playerid][pKey], tmppass, 0, strlen(tmppass), 255);
				format(string,sizeof(string),"Your new password is %s.",tmppass);
				SendClientMessage(playerid, COLOR_YELLOW,string);
				GetPlayerName(playerid, namee, sizeof(namee));
				GetPlayerIp(playerid, playerip, sizeof(playerip));
				format(string,sizeof(string),"%s[user:%d] changed his password. IP: %s",namee,PlayerInfo[playerid][pSQLID],playerip);
				ABroadCast(COLOR_YELLOW, string,1);
				GetPlayerName(playerid,sendername,sizeof(sendername));
				new str2[240];
		        mysql_format(SQL, str2, sizeof(str2), "UPDATE users SET `password`='%s' WHERE `name`='%s\'",PlayerInfo[playerid][pKey], PlayerInfo[playerid][pNormalName]);
		        mysql_tquery(SQL,str2,"","");
				return 1;
			}
ProAeXel is offline   Reply With Quote
Old 28/01/2017, 08:20 PM   #2
edyun
Little Clucker
 
Join Date: Sep 2014
Posts: 36
Reputation: 0
Default Re: mysql_real_escape_string

Codul tau este ok,doar ca trebuie definite niste caractere invalide,trebuie sa faci un IF si sa declari acolo toate functiile,daca nu stii cum voi incerca sa te ajut maine cand ajung.
edyun is offline   Reply With Quote
Old 30/01/2017, 07:54 AM   #3
Sh0wN
Little Clucker
 
Sh0wN's Avatar
 
Join Date: Jan 2017
Location: Romania
Posts: 4
Reputation: 0
Default Re: mysql_real_escape_string

De ce nu faci un simplu strfind? (in viata pana nu va complicati nu se poate...)
Sh0wN is offline   Reply With Quote
Old 18/03/2017, 11:14 AM   #4
TheHonnor
Big Clucker
 
TheHonnor's Avatar
 
Join Date: Mar 2016
Posts: 71
Reputation: 1
Default Re: mysql_real_escape_string

la ce strfind dacă query-ul merge direct la baza de date? Funcția aia o folosește să prevină injectarea bazei de date.
TheHonnor is offline   Reply With Quote
Reply

Thread Tools
Display Modes

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Mysql_real_escape_String Banditukas Scripting Help 2 26/11/2014 01:16 PM
What does mysql_real_escape_string do? Xtreme Brotherz Scripting Help 1 11/05/2014 07:00 AM
mysql_real_escape_string audriuxxx Scripting Help 3 02/02/2014 12:49 PM
mysql_real_escape_string CamperGTA Русский/Russian 11 14/08/2013 08:03 AM
mysql_real_escape_string... Miguel Help Archive 2 08/01/2010 12:25 AM


All times are GMT. The time now is 10:08 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.