Wont save password
#1

Код:
    else if(dialogid == 1) // Register
	{
	    if(response)
	    {
	        if(strlen(inputtext) < 4)
            {
             SendClientMessage(playerid, COLOR_GREY, "Password can't be shorter than 4 characters.");
             SSSShowDialog(playerid, 1);
             return 1;
            }
	        if(strlen(inputtext) > 256)
	        {
	            SendClientMessage(playerid, COLOR_GREY, "Password can't be longer than 256 characters.");
	            SSSShowDialog(playerid, 1);
	            return 1;
	        }
			new file[64], IP[16], string[128], password[256];
			format(file, sizeof(file), "users/%s.ini", RPNU(playerid));
			if(!dini_Exists(file))
			{
				GetPlayerIp(playerid, IP, sizeof(IP));
				dini_Create(file);
    			WP_Hash(password, sizeof(password), inputtext);
				dini_Set(file, "Password", password);
				dini_Set(file, "IP", IP);
				PlayerInfo[playerid][pLevel] = 1;
				dini_IntSet(file, "Level", PlayerInfo[playerid][pLevel]);
				format(string, sizeof(string), "SERVER: {FFFFFF}You have successfully registered on {009300}IBS:Roleplay{FFFFFF}. (Password: %s)", inputtext);
				SendClientMessage(playerid, STATSGG, string);
				SSSShowDialog(playerid, 2);
			}
	    }
	    else
	    {
	        SendClientMessage(playerid, COLOR_GREEN, "SERVER: {FFFFFF}You have chosen to quit the server.");
	        Kick(playerid);
	    }
	}
	else if(dialogid == 2) // Login
	{
	    if(response)
	    {
   			new file[64], password[256], IP[16], password2[256];
			format(file, sizeof(file), "users/%s.ini", RPNU(playerid));
   			WP_Hash(password2, sizeof(password2), inputtext);
			format(password, sizeof(password), "%s", dini_Get(file, "Password"));
			if(strcmp(password, inputtext,true))
			{
				SendClientMessage(playerid, COLOR_LIGHTRED, "SERVER: {FFFFFF}Invalid password.");
			    SSSShowDialog(playerid, 2);
			    return 1;
			}
			if(dini_Int(file, "AdminAccount") == 1)
			{
			    SendClientMessage(playerid, COLOR_LIGHTRED, "SERVER: {FFFFFF}You can't login directly from an admin account.");
			    Kick(playerid);
			    return 1;
			}
			else if(sscanf(inputtext, "s[128]", inputtext))
			{
			    SendClientMessage(playerid, COLOR_LIGHTRED, "SERVER: {FFFFFF}You must enter a password to procceed.");
			    SSSShowDialog(playerid, 2);
			    return 1;
			}
			else
			{
			    SendClientMessage(playerid, COLOR_LIME, "");
			    SendClientMessage(playerid, COLOR_LIME, "");
			    SendClientMessage(playerid, COLOR_LIME, "");
			    format(PlayerInfo[playerid][pIP], 16, "%s", dini_Get(file, "IP"));
				GetPlayerIp(playerid, IP, sizeof(IP));
				dini_Set(file, "IP", IP);
				PlayerInfo[playerid][pGender] = dini_Int(file, "Gender");
				PlayerInfo[playerid][pAge] = dini_Int(file, "Age");
				if(!PlayerInfo[playerid][pGender] || !PlayerInfo[playerid][pAge])
				{
				    SSSShowDialog(playerid, 3);
				}
				else
				{
        			LoadChar(playerid);
				    SpawnPlayer(playerid);
				}
			}
	    }
	    else
	    {
	        SendClientMessage(playerid, COLOR_LIGHTRED, "SERVER: {FFFFFF}You have chosen to quit the server.");
	        Kick(playerid);
	    }
	}
When you try to login after registering it does not matter what you put hte password as. It will log you in anyways. So lets say my password is 1, thats what I said it was at registering and tried loging in with T it would let me in.

Will REP who ever helps me first, thanks for replys.
Reply
#2

Does it properly insert the information?
Reply
#3

dini_IntSet password should be
Reply
#4

pawn Код:
dini_IntSet(file, "Password", udb_hash(inputtext));
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)