Register System
#1

So I'm having some issues with my registration system. When I register my account, it writes just fine. But upon trying to login - I can login with ANY password. I've also tried to modify it in various ways but issues still occur, such as me not being able to login at all.




Quote:

}
else if(dialogid == 1) // Register
{
if(response)
{
if(strlen(inputtext) < 6)
{
SendClientMessage(playerid, COLOR_GREY, "Password can't be shorter than 6 characters.");
ShowDialog(playerid, 1);
return 1;
}
if(strlen(inputtext) > 256)
{
SendClientMessage(playerid, COLOR_GREY, "Password can't be longer than 256 characters.");
ShowDialog(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 {FF6347}Las Venturas Roleplay{FFFFFF}. (Password: %s)", inputtext);
SendClientMessage(playerid, COLOR_LIGHTRED, string);
ShowDialog(playerid, 2);
}
}
else
{
SendClientMessage(playerid, COLOR_LIGHTRED, "SERVER: {FFFFFF}You have chosen to quit the server.");
FixedKick(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) && strcmp(password, password2, true))
{
SendClientMessage(playerid, COLOR_LIGHTRED, "SERVER: {FFFFFF}Invalid password.");
ShowDialog(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.");
FixedKick(playerid);
return 1;
}
if(strlen(inputtext) < 4)
{
SendClientMessage(playerid, COLOR_GREY, "Password can't be shorter than 6 characters.");
ShowDialog(playerid, 2);
return 1;
}
if(strlen(inputtext) > 256)
{
SendClientMessage(playerid, COLOR_GREY, "Password can't be longer than 256 characters.");
ShowDialog(playerid, 2);
return 1;
}
else if(sscanf(inputtext, "s[128]", inputtext))
{
SendClientMessage(playerid, COLOR_LIGHTRED, "SERVER: {FFFFFF}You must enter a password to procceed.");
ShowDialog(playerid, 2);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "");
SendClientMessage(playerid, COLOR_WHITE, "");
SendClientMessage(playerid, COLOR_WHITE, "");
SendClientMessage(playerid, COLOR_WHITE, "");
SendClientMessage(playerid, COLOR_WHITE, "");
SendClientMessage(playerid, COLOR_WHITE, "");
SendClientMessage(playerid, COLOR_WHITE, "");
SendClientMessage(playerid, COLOR_WHITE, "");
SendClientMessage(playerid, COLOR_WHITE, "");
SendClientMessage(playerid, COLOR_WHITE, "");
SendClientMessage(playerid, COLOR_WHITE, "");
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])
{
ShowDialog(playerid, 3);
}
else
{
LoadChar(playerid);
SpawnPlayer(playerid);
}
}
}
else
{
SendClientMessage(playerid, COLOR_LIGHTRED, "SERVER: {FFFFFF}You have chosen to quit the server.");
FixedKick(playerid);
}

Reply
#2

Change this:
Код:
if(strcmp(password, inputtext,true) && strcmp(password, password2, true))
to this:
Код:
if(strcmp(password, password2) == 0)
Reply
#3

Quote:
Originally Posted by Conradus
Посмотреть сообщение
Change this:
Код:
if(strcmp(password, inputtext,true) && strcmp(password, password2, true))
to this:
Код:
if(strcmp(password, password2) == 0)
Quote:

}
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, password2) == 0)

right?
Reply
#4

Sorry, I read your code wrong, it should be:
Код:
if(strcmp(password, password2) != 0)
Reply
#5

Quote:
Originally Posted by Conradus
Посмотреть сообщение
Sorry, I read your code wrong, it should be:
Код:
if(strcmp(password, password2) != 0)
It did not help me find a way to fix it again.

Reply
#6

Quote:
Originally Posted by Shinobu
Посмотреть сообщение
It did not help me find a way to fix it again.

Quote:
Originally Posted by Conradus
Посмотреть сообщение
Sorry, I read your code wrong, it should be:
Код:
if(strcmp(password, password2) != 0)
Shouldn't there be == instead of != ?
Reply
#7

Remove this from your code:
Код:
else if(sscanf(inputtext, "s[128]", inputtext))
{
SendClientMessage(playerid, COLOR_LIGHTRED, "SERVER: {FFFFFF}You must enter a password to procceed.");
ShowDialog(playerid, 2);
return 1;
}
Reply
#8

Quote:
Originally Posted by kamiliuxliuxliux
Посмотреть сообщение
Shouldn't there be == instead of != ?
Well, in this case it checks if the password is incorrect, so I think it should be "!=".
Reply
#9

Quote:
Originally Posted by Conradus
Посмотреть сообщение
Remove this from your code:
Код:
else if(sscanf(inputtext, "s[128]", inputtext))
{
SendClientMessage(playerid, COLOR_LIGHTRED, "SERVER: {FFFFFF}You must enter a password to procceed.");
ShowDialog(playerid, 2);
return 1;
}
Thanks, I'm done


Move the job to do it.
Reply
#10

After logging in improving.
The desired command id is not available.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)