Login Problem
#1

I am currently using another server's login and register system. The problem is that you can login to any account with any password.
For example if Dante_William's password is "fdapolice", you can login with "asdfsdfsdf".

I'm quite new to scripting so if anyone could tell me what is needed to resolve this problem, it would be great.

This is the login system.

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	new sendername[MAX_PLAYER_NAME];
	new string[128];
	if(dialogid == 1 || dialogid == 2)
	{
		if(dialogid == 1)
		{
			if( response == 0 )
			{
				SendClientMessage(playerid, COLOR_RED, "SERVER: You have been kicked out automatically.");
				Kick(playerid);
			}
			else
			{
				if(strlen(inputtext))
				{
					new tmppass[64];
					strmid(tmppass, inputtext, 0, strlen(inputtext), 255);
					Encrypt(tmppass);
					OnPlayerLogin(playerid,tmppass);
				}
				else
				{
					new loginstring[128];
					new loginname[64];
					GetPlayerName(playerid,loginname,sizeof(loginname));
					format(loginstring,sizeof(loginstring),"Incorrect password. \n \nThat name is registered, you may now enter your password.");
					ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Login",loginstring,"Login","Exit");
					gPlayerLogTries[playerid] += 1;
					if(gPlayerLogTries[playerid] == 2) { SendClientMessage(playerid, COLOR_RED, "SERVER: Wrong password, you have been kicked out automatically."); Kick(playerid); }
				}
			}
		}
		if(dialogid == 2)
		{
			if(strlen(inputtext))
			{
				GetPlayerName(playerid, sendername, sizeof(sendername));
				format(string, sizeof(string), "users/%s.ini", sendername);
				new File: hFile = fopen(string, io_read);
				if (hFile)
				{
					SendClientMessage(playerid, COLOR_YELLOW, "That username is already taken, please choose a different one.");
					fclose(hFile);
					return 1;
				}
				new tmppass[64];
				strmid(tmppass, inputtext, 0, strlen(inputtext), 255);
				Encrypt(tmppass);
				OnPlayerRegister(playerid,tmppass);
			}
			else
			{
 				new regstring[128];
				format(regstring,sizeof(regstring),"Welcome, %s.\nYou don't have an account here...\nplease register by entering a password:",GetPlayerNameEx(playerid));
				ShowPlayerDialog(playerid,12345,DIALOG_STYLE_INPUT,"Register",regstring,"Register","Exit");
			}
Reply
#2

Throw that system and create your own if you really want to learn scripting.
Reply
#3

Dudb / dini or mysql?
Reply
#4

Any help?
Reply
#5

Can someone please help me quick, my server launch day is suppose to be today...
Reply
#6

I thing that the problem is not in your login code, its with register code. Try to find where your script is registering the password because you have telling the script to register everybody how joins your server with that password!
Reply
#7

I don't know where did you found this code, but it HAS A LOT OF mistakes. Better search on tutorial section how to make a /login /register commands/dialogs system.
>>example<<
Reply
#8

Quote:
Originally Posted by Stm
Посмотреть сообщение
I thing that the problem is not in your login code, its with register code. Try to find where your script is registering the password because you have telling the script to register everybody how joins your server with that password!
Right here.
Код:
new tmppass[64];
				strmid(tmppass, inputtext, 0, strlen(inputtext), 255);
				Encrypt(tmppass);
				OnPlayerRegister(playerid,tmppass);
			}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)