02.08.2012, 16:02
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.
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"); }