Register system question? -
baba1234 - 28.06.2015
When someone is registering I want to make when every field is filled up that msg box dialog pop up his account data example Name:, Password:, Gender:, etc but I am stuck on Password I printed all but I cannot print password is it possible to save a password into the string before it gets hashed and print it out in his data msg box? And an example. This is my register on dialog response
Код:
if(dialogid == DIALOG_LOZINKA)
{
if(response)
{
if(!strlen(inputtext))
{
ShowPlayerDialog(playerid, DIALOG_LOZINKA, DIALOG_STYLE_INPUT, ""COL_BIJELA"Balkan Godfather-"COL_ZLATNA"Lozinka",""COL_BIJELA"Unijeli ste pogresan format "COL_CRVENA"sifre!\n\n"COL_BIJELA"Pokusaj "COL_ZLATNA"Ponovo!\n","Dalje","Odustani");
return 1;
}
else
{
new hashpass[129];
WP_Hash(hashpass,sizeof(hashpass),inputtext);
new INI:file = INI_Open(Path(playerid));
INI_SetTag(file,"[Data]");
INI_WriteString(file,"Password",hashpass);
INI_Close(file);
}
}
return 1;
}
And this is where I print my data
Код:
else if(clickedid == RegRegistriraj19)
{
new pinfo[255];
format(pinfo,sizeof(pinfo),""COL_BIJELA"-----------"COL_ZLATNA"PODATCI"COL_BIJELA"-----------\n"COL_ZLATNA"Ime"COL_BIJELA": %s\n"COL_ZLATNA"Lozinka"COL_BIJELA": %s\n"COL_ZLATNA"Spol"COL_BIJELA": %s\n"COL_ZLATNA"Porijeklo"COL_BIJELA": %s\n"COL_ZLATNA"Godine"COL_BIJELA": %d\n"COL_ZLATNA"Email"COL_BIJELA": %s", PlayerName(playerid),getPlayerPass(playerid),getsex(playerid),getporijeklo(playerid),PlayerInfo[playerid][pGodine],PlayerInfo[playerid][pEmail]);
ShowPlayerDialog(playerid, DIALOG_REGISTRIRAJ, DIALOG_STYLE_MSGBOX, ""COL_BIJELA"Balkan Godfather-"COL_ZLATNA"Registriraj", pinfo, "Da", "Ne");
}
Ignore the getPlayerPass(playerid) I tried it with some stock functions but I didnt succeed.
Respuesta: Register system question? -
[DOG]irinel1996 - 28.06.2015
You can declare
pPass[50] in your
enum and make this when you hash the password:
PHP код:
strdel(PlayerInfo[playerid][pPass], 0, 49);
strcat(PlayerInfo[playerid][pPass], inputtext, 50);
So, yes, you would get this:
PHP код:
new hashpass[129];
WP_Hash(hashpass, 129, inputtext);
strdel(PlayerInfo[playerid][pPass], 0, 49);
strcat(PlayerInfo[playerid][pPass], inputtext, 50);
new INI:file = INI_Open(Path(playerid));
INI_SetTag(file,"[Data]");
INI_WriteString(file,"Password",hashpass);
INI_Close(file);
PD: I set the password to 50 max. chars. but set it as you want.
Re: Respuesta: Register system question? -
baba1234 - 28.06.2015
Quote:
Originally Posted by [DOG]irinel1996
You can declare pPass[50] in your enum and make this when you hash the password:
PHP код:
strdel(PlayerInfo[playerid][pPass], 0, 49);
strcat(PlayerInfo[playerid][pPass], inputtext, 50);
So, yes, you would get this:
PHP код:
new hashpass[129];
WP_Hash(hashpass, 129, inputtext);
strdel(PlayerInfo[playerid][pPass], 0, 49);
strcat(PlayerInfo[playerid][pPass], inputtext, 50);
new INI:file = INI_Open(Path(playerid));
INI_SetTag(file,"[Data]");
INI_WriteString(file,"Password",hashpass);
INI_Close(file);
PD: I set the password to 50 max. chars. but set it as you want. 
|
Yea that works thanks +rep for u. But can u explain me what did u do there I readed the wiki about strdel and I dont get it like u are deleting some string or something?
Respuesta: Register system question? -
[DOG]irinel1996 - 28.06.2015
You clear the variable first, leave it empty. I did that because strcat
adds a new string to the variable but it doesn't clear it, so we clear it just in case of it has anything on it.