Making this hashed.
#1

Hello my system is a little bit unsafe for those who have the FTP.
They can read passwords.
This is the register hash, dini_Set(file,"Password",params); but how to make it a hashed pass in the .ini?
And when im logging in:
Код:
dcmd_login(playerid,params[])
{
	new file[256],n[MAX_PLAYER_NAME];
	GetPlayerName(playerid,n,MAX_PLAYER_NAME);
	format(file,sizeof(file),"gio_admin/Users/%s.sav",n);
 	if(!dini_Exists(file)) return SendClientMessage(playerid,YELLOW,"You are not registered! Please /register");
 	if(PInfo[playerid][Logged] == 1) return SendClientMessage(playerid,LIGHTBLUE,"You are already logged in!");
 	if(PInfo[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);
			    PInfo[playerid][Logged] = 1;
			    PInfo[playerid][Level] = dini_Int(file,"Level");
			    SendClientMessage(playerid,YELLOW,"You have now logged in!");
			    return 1;
			}
		}
	}
	else
	{
	    SendClientMessage(playerid,GREY,"USAGE: /login <Password>");
	    return 1;
	}
	return 1;
}
Thanks for helping.
Reply
#2

Код:
new PassWordStringInput[24];
new buffer[129];
new filename[32];
new Name[MAX_PLAYER_NAME];
GetPlayerName(playerid,Name,sizeof(Name));
if(!sscanf(inputtext,"s[24]",PassWordStringInput))
{
	WP_Hash(buffer,sizeof(buffer),PassWordStringInput);
	format(filename, sizeof(filename),"playerpasswords/%s.txt",Name);
	new File:PWFile=fopen(filename,io_readwrite);
	fwrite(PWFile,buffer);
	fclose(PWFile);
}
thats not meant to correct your code, just read it - the hashing function is easier to use than you maybe think ^^
Reply
#3

But its NOT an input. Otherwise i already had it hashed.
Its just /register pass and /login pass
Reply
#4

Then change the "inputtext" to "params", should work
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)