MD5 Problem. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: MD5 Problem. (
/showthread.php?tid=244501)
MD5 Problem. -
Xivop. - 27.03.2011
Hello Guys, i have a Problem with MD5, i have Created a Login & Register System, but everytime
the Password is incorrect hmm ?
Thats the Code :
new Query[200], Pname[24];
GetPlayerName(playerid, Pname, 24);
new escpname[24];
mysql_real_escape_string(Pname, escpname);
format(Query, sizeof(Query), "SELECT * FROM `wcf1_user` WHERE `username` = '%s' AND `password` = '%s'", escpname, MD5_Hash(inputtext));
mysql_query(Query);
mysql_store_result();
Re: MD5 Problem. -
nickolas12 - 27.03.2011
here login:
Код:
dcmd_login(playerid,params[])
{
new file[256],n[MAX_PLAYER_NAME];
GetPlayerName(playerid,n,MAX_PLAYER_NAME);
format(file,sizeof(file),"cool/users/%s.txt",n);
if(!dini_Exists(file)) return SendClientMessage(playerid,YELLOW,"You are not registered! Please /register");
if(PlayerInfo[playerid][Logged] == 1) return SendClientMessage(playerid,LIGHTBLUE,"You are already logged in!");
if(PlayerInfo[playerid][Regged] == 0) return SendClientMessage(playerid,ORANGE,"You are not registered! Please /register");
if(strlen(params))
{
new pass[256];
pass = dini_Get(file,"Password");
if(dini_Exists(file))
{
if(strcmp(params,pass,false) != 0)
{
SendClientMessage(playerid,YELLOW,"Wrong Password!");
}
else
{
dini_IntSet(file,"Logged",1);
PlayerInfo[playerid][Logged] = 1;
PlayerInfo[playerid][AdminLevel] = dini_Int(file,"AdminLevel");
PlayerInfo[playerid][Kills] = dini_Int(file,"Kills");
PlayerInfo[playerid][Deaths] = dini_Int(file,"Deaths");
PlayerInfo[playerid][MinutesOnline] = dini_Int(file,"MinutesOnline");
PlayerInfo[playerid][HoursOnline] = dini_Int(file,"HoursOnline");
PlayerInfo[playerid][Rank] = dini_Int(file,"Rank");
PlayerInfo[playerid][BMoney] = dini_Int(file,"BMoney");
PlayerInfo[playerid][VIP] = dini_Int(file,"VIP");
GivePlayerMoney(playerid,dini_Int(file,"Money"));
SendClientMessage(playerid,YELLOW,"You have now logged in!");
OnlineTimer[playerid] = SetTimerEx("OnlineTime",60000,true,"i",playerid);
TextDrawDestroy(TextDrawNotLogged[playerid]);
TextDrawShowForPlayer(playerid,TotalStats[playerid]);
SetTimerEx("UpdateStats",1000,1,"i",playerid);
return 1;
}
}
}
else
{
SendClientMessage(playerid,GREY,"USAGE: /login <Password>");
return 1;
}
return 1;
}
put code for onplayercommandtext it work
Re: MD5 Problem. -
Macluawn - 27.03.2011
Код:
format(Query, sizeof(Query), "SELECT * FROM `wcf1_user` WHERE `username` = '%s' AND `password` = md5('%s')", escpname, inputtext);
Try this.
Re: MD5 Problem. -
Xivop. - 27.03.2011
Hmm, dont work... Wbb 3.x use MD5 ?
Re: MD5 Problem. -
Zh3r0 - 27.03.2011
MD5 is unsafe! Use Whirlpool!
Re: MD5 Problem. -
Vince - 27.03.2011
Yeah, let's add another plugin while MySQL provides hashing functions itself.
http://dev.mysql.com/doc/refman/5.5/...functions.html