Login and Register system problem, doesn't save passwords. -
Stoyanov - 11.10.2014
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 .");
Re: Login and Register system problem, doesn't save passwords. -
park4bmx - 11.10.2014
everything else saves ?
try without the
hash
Re: Login and Register system problem, doesn't save passwords. -
Stoyanov - 11.10.2014
Yes. Everything else saves.
How to remove the hash? What row do i have to delete?
Re: Login and Register system problem, doesn't save passwords. -
Rudy_ - 12.10.2014
I don't see anything wrong, Show OnPlayerDisconnect and your Enums
Re: Login and Register system problem, doesn't save passwords. -
Stoyanov - 12.10.2014
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
}
Re: Login and Register system problem, doesn't save passwords. -
Rudy_ - 12.10.2014
Hm.. idk but use
Whirlpool and then use INI_WriteString instead of WriteInt for password.
Re: Login and Register system problem, doesn't save passwords. -
Stoyanov - 12.10.2014
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)
Re: Login and Register system problem, doesn't save passwords. -
Rudy_ - 12.10.2014
i said use whirlpool :P
Re: Login and Register system problem, doesn't save passwords. -
Stoyanov - 12.10.2014
I am using Whirpool
Re: Login and Register system problem, doesn't save passwords. -
Rudy_ - 12.10.2014
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)