SA-MP Forums Archive
[Help] Password saving - 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)
+--- Thread: [Help] Password saving (/showthread.php?tid=436545)



[Help] Password saving - bugi - 11.05.2013

Hello everyone I've got some problems with how the title says "PASSWORD SAVING" Heres the code
Код:
	if(dialogid == DIALOG_LOGIN1)
	{
		if(!response ) return Kick (playerid);
		if(response)
		{
			if(udb_hash(inputtext) == PlayerInfo[playerid][pLozinka])
			{
				INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
				SpawnPlayer(playerid);
				ResetPlayerMoney(playerid);
                GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
			}
			else
			{
				ShowPlayerDialog(playerid, DIALOG_LOGIN2, DIALOG_STYLE_INPUT,"{FFFF00}LifeZone RolePlay","Uneli ste pogresnu lozinku.\nUnesite tacnu lozinku da se logujete.","Login","Quit");
				
			}
		}
	}
I use pLozinka for my password variable and when i register everything is ok but when i relog and login again it says wrong password every time and i cant log in, now can u guys just tell me what am I doing wron and yeah in folder Users where is my users documents u know for everyone password is 0 HELP HELP HELP


Re: [Help] Password saving - bugi - 11.05.2013

I'll try thank you mister Less


Re: [Help] Password saving - bugi - 11.05.2013

Sorry for posting twice I was wondering how can this be mistake i have a loading and writing option i just dont get it i mean a very good scripter(one of the best i know) named Blaeks said that i have hashed password and is that the issue?


Re: [Help] Password saving - bugi - 12.05.2013

Well what if I want to ? I will never learn if I never try, well can u help me about this scheme? I know you know the best but I want to make something that is "mine" not to just download and put it in gamemode if u know what I mean mister..


Re: [Help] Password saving - Cjgogo - 12.05.2013

Well, if you do want to code your own, here are 2 sugesstions:

1)Try to follow the best rated topic for account saving

2)DO not use udb_hash, use Whirlpool, at least that's the first thing I've been told when I first posted here, that udb_hash isn't good at all


Re: [Help] Password saving - RajatPawar - 12.05.2013

Quote:
Originally Posted by bugi
Посмотреть сообщение
Well what if I want to ? I will never learn if I never try, well can u help me about this scheme? I know you know the best but I want to make something that is "mine" not to just download and put it in gamemode if u know what I mean mister..
I too disagree with ****** that you ever shouldn't write your own, but for now, you should download one because as above, there are a lot of security flaws. You can try if you are an intelligent scripter and knows how to do things, otherwise, I'd say you go for maybe something else. However, you can try writing your own, but beware of the flaws and any leaks of passwords, if there are any.


Re: [Help] Password saving - bugi - 12.05.2013

Well now, I mean thank u for answering... I'll follow that but.. I'm stil waiting :/ because I think the problem is not just a little thing lets see what Mr.Less thinks


Re: [Help] Password saving - Lordzy - 12.05.2013

pawn Код:
if(dialogid == DIALOG_LOGIN)
{
 if(!response) Kick(playerid);
 if(response) {
 if(!strcmp(udb_hash(inputtext), PlayerInfo[playerid][pLozinka], false))
 {
  //Login functions.
 }
 else
 {
  //Wrong pass
 }
 }
}
return 1;
}
Use strcmp to see if two strings are equal or not, I haven't used udb_hash so I don't know about that. Also 'LoadUser_%s' could create problems. I'd rather choose creating a function like 'LoadUser_Data' to load the user data from the file and execute it in 'INI_ParseFile'. Also, use a better hash like Whirlpool hash or SHA1. Those are really nice.


Re: [Help] Password saving - bugi - 12.05.2013

Not glad to use strcmp but I'll try that my bro thanks anyway... I'll tellu later if this worked


Re: [Help] Password saving - bugi - 12.05.2013

Not glad but I'll try well i need strcmp or some special include for that?