Login and Register system problem, doesn't save passwords.
#1

Hello.

I have problem with my register and login system. It doesn't save passwords.

Login Dialog:

Код:
case DIALOG_LOGIN:
        {
            if ( !response ) return Kick ( playerid );
            if( response )
            {
                if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
                {
                    INI_ParseFile(UserPath(playerid), "LoadUser_data", .bExtra = true, .extra = playerid);
                    GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
                    ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_LGREEN"Success",""COL_LGREEN"You have successfully logged in!","Ok","");
				}
                else
                {
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_GREY"Login",""COL_GREY"You have entered an incorrect {FF6347}password{B4B5B7}.\n"COL_GREY"Type your password below to login.","Login","Quit");
                }
      	    	SendClientMessage(playerid, lightgreen, "[{B4B5B7}System{9ACD32}]: {B4B5B7}You have successfully register this account .");
                return 1;
Register Dialog:

Код:
case DIALOG_REGISTER:
        {
            if (!response) return Kick(playerid);
            if(response)
            {
                if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_GREY"Registering...",""COL_GREY"You have entered an invalid {FF6347}password{B4B5B7}.\n"COL_GREY"Type your password below to register a new account.","Register","Quit");
                new INI:File = INI_Open(UserPath(playerid));
                INI_SetTag(File,"data");
                INI_WriteInt(File,"Password",udb_hash(inputtext));
                INI_WriteInt(File,"Admin",0);
				INI_WriteInt(File,"VIP",0);
				INI_WriteInt(File,"Wanted",0);
				INI_WriteInt(File,"Kills",0);
				INI_WriteInt(File,"Deaths",0);
				INI_WriteInt(File,"Jailed",0);
				INI_WriteInt(File,"Muted",0);
				INI_WriteInt(File,"Cash",0);
				INI_WriteInt(File,"Score",0);
				INI_WriteInt(File,"Banned",0);
                INI_Close(File);

   				SendClientMessage(playerid, lightgreen, "[{B4B5B7}System{9ACD32}]: {B4B5B7}You have successfully register this account .");
Reply
#2

everything else saves ?
try without the hash
Reply
#3

Yes. Everything else saves.
How to remove the hash? What row do i have to delete?
Reply
#4

I don't see anything wrong, Show OnPlayerDisconnect and your Enums
Reply
#5

OnPlayerDisconnect

Код:
public OnPlayerDisconnect(playerid, reason)
{
    if(IsBeingSpeced[playerid] == 1)
    {
        foreach(Player,i)
        {
            if(spectatorid[i] == playerid)
            {
                TogglePlayerSpectating(i, 0);
            }
        }
    }
	new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"data");
    INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
    INI_WriteInt(File,"VIP",PlayerInfo[playerid][pVIP]);
    INI_WriteInt(File,"Wanted",GetPlayerWantedLevel(playerid));
    INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
    INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
    INI_WriteInt(File,"Jailed",PlayerInfo[playerid][pJailed]);
    INI_WriteInt(File,"Muted",PlayerInfo[playerid][pMuted]);
    INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
	INI_WriteInt(File,"Score",GetPlayerScore(playerid));
	INI_WriteInt(File,"Banned",PlayerInfo[playerid][pBanned]);
    INI_Close(File);
    
    IsOnDuty[playerid] = 0;
    IsGodMode[playerid] = 0;
	return 1;
}
enum

Код:
enum pInfo
{
	pPass,
	pAdmin,
	pVIP,
	pWanted,
	pKills,
	pDeaths,
	pJailed,
	pMuted,
	pCash,
	pScore,
	pBanned
}
Reply
#6

Hm.. idk but use Whirlpool and then use INI_WriteString instead of WriteInt for password.
Reply
#7

DIALOG_REGISTER

Код:
case DIALOG_REGISTER:
        {
            if (!response) return Kick(playerid);
            if(response)
            {
                if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_GREY"Registering...",""COL_GREY"You have entered an invalid {FF6347}password{B4B5B7}.\n"COL_GREY"Type your password below to register a new account.","Register","Quit");
                new INI:File = INI_Open(UserPath(playerid));
                INI_SetTag(File,"data");
                INI_WriteString(File,"Password",udb_hash(inputtext));
                INI_WriteInt(File,"Admin",0);
				INI_WriteInt(File,"VIP",0);
				INI_WriteInt(File,"Wanted",0);
				INI_WriteInt(File,"Kills",0);
				INI_WriteInt(File,"Deaths",0);
				INI_WriteInt(File,"Jailed",0);
				INI_WriteInt(File,"Muted",0);
				INI_WriteInt(File,"Cash",0);
				INI_WriteInt(File,"Score",0);
				INI_WriteInt(File,"Banned",0);
                INI_Close(File);

   				SendClientMessage(playerid, lightgreen, "[{B4B5B7}System{9ACD32}]: {B4B5B7}You have successfully register this account .");
            }
        }
argument type mismatch (argument 3)
Reply
#8

i said use whirlpool :P
Reply
#9

I am using Whirpool
Код:
plugins Whirlpool
Reply
#10

pawn Код:
native WP_Hash(buffer[],len,const str[]); // Whirlpool native, add it at the top of your script under includes
pawn Код:
INI_WriteString(file,"Password",hashpass)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)