Mysql and MD5 hash problem
#6

ok i changed my code in:

Код:
if(dialogid==LOGIN_DIALOG)
	{
	  if(response)
	  {
			new valori[128], query[128], escaped[51];
	    samp_mysql_real_escape_string(inputtext, escaped);
			format(query,128,"SELECT * FROM account WHERE Username='%s' AND Password=MD5('%s')",PName(playerid),escaped);
			samp_mysql_query(query);
			samp_mysql_store_result();
			
 			if(samp_mysql_fetch_row(valori))
 			{
			  LoginPlayer(playerid);
			}else{
			  new msg[128];
			  PWErrata[playerid]+=1;
			  format(msg,sizeof(msg),"Password errata [%d/3]",PWErrata[playerid]);
			  ShowPlayerDialog(playerid,LOGIN_DIALOG,DIALOG_STYLE_INPUT,"Login",msg,"Login","Annulla");
        if(PWErrata[playerid]==3)
      	{
          SendClientMessage(playerid,COLOR_RED,"Hai sbagliato la password 3 volte.");
          Kick(playerid);
          format(msg,sizeof(msg),">> %s и stato kickato dal server per non aver effettuato correttamente il login",PName(playerid));
          SendClientMessageToAll(COLOR_RED,msg);
        }
			}

	  }
	}
Код:
if(dialogid==REGISTER_DIALOG)
	{
		if(response)
		{
		  if(!strlen(inputtext)) 	return ShowPlayerDialog(playerid,REGISTER_DIALOG,DIALOG_STYLE_INPUT ,"Errore","Non hai inserito alcuna password.", "Register","Annulla");
		  if(strlen(inputtext)<5)	return ShowPlayerDialog(playerid,REGISTER_DIALOG,DIALOG_STYLE_INPUT ,"Errore","Inserisci una password \ndi almeno 6 caratteri.", "Register","Annulla");
			if(strlen(inputtext)>25)return ShowPlayerDialog(playerid,REGISTER_DIALOG,DIALOG_STYLE_INPUT ,"Errore","Inserisci una password \ndi inferiore di 25 caratteri.", "Register","Annulla");
			
			
		  new query[164];
      new escaped[51];
	    samp_mysql_real_escape_string(inputtext, escaped);
		  format(query,128,"INSERT INTO `account` (Username,Password,Entrata,Score,Admin,Nome) VALUES ('%s',md5('%s'),0,0,0,'none')",PName(playerid),escaped);
		  samp_mysql_query(query);
		  ShowPlayerDialog(playerid,NAME_DIALOG,DIALOG_STYLE_INPUT,"Register","Inerisci il tuo nome","Avanti","X");
		  
			return 1;
		}else{
		  ShowPlayerDialog(playerid,REGISTER_DIALOG,DIALOG_STYLE_INPUT ,"Login","Non hai un account su questo server.\nRegistrati inserendo una password.", "Register","Annulla");
		}
	}
But I did not understand how i can connect tables via IDs, can you do an example for me?

thx
Reply


Messages In This Thread
Mysql and MD5 hash problem - by ft941 - 05.06.2010, 10:13
Re: Mysql and MD5 hash problem - by ft941 - 06.06.2010, 08:09
Re: Mysql and MD5 hash problem - by Sergei - 06.06.2010, 08:11
Re: Mysql and MD5 hash problem - by ft941 - 06.06.2010, 08:36
Re: Mysql and MD5 hash problem - by Sergei - 06.06.2010, 08:44
Re: Mysql and MD5 hash problem - by ft941 - 06.06.2010, 15:41
Re: Mysql and MD5 hash problem - by ft941 - 07.06.2010, 15:20
Re: Mysql and MD5 hash problem - by ft941 - 09.06.2010, 08:53
Re: Mysql and MD5 hash problem - by ft941 - 11.06.2010, 11:53
Re: Mysql and MD5 hash problem - by ft941 - 15.06.2010, 19:14

Forum Jump:


Users browsing this thread: 1 Guest(s)