mysql table... - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread:  mysql table... (
/showthread.php?tid=663816)
 
mysql table... - 
itachi -  11.02.2019
Hello,
I need help with mysql table plase.
Код:
Registruj(playerid, const sheslo[])
{
	new heslo[64];
	mysql_escape_string(sheslo, heslo, handle);
	if (!KontrolaFormatu(heslo)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Registrбcia", "Zadaj svoje heslo\n(Dostupnй znaky: 0-9, a-Z)", "Ok", "Zruљ");
	new query[72+MAX_PLAYER_NAME+32];
	mysql_format(handle, query, sizeof(query), "INSERT INTO `ASystem` (nick, pass, hodnost, prihlaseny) VALUES ('%s', MD5('%s'), 0, 0)", Meno(playerid), heslo);
	mysql_query(handle, query);
	return 1;
}
 My table not funciton :
Код:
CREATE TABLE IF NOT EXISTS `ASystem` (
  `nick` varchar(25) NOT NULL,
  `pass` varchar(64) NOT NULL,
  `hodnost` int(11) NOT NULL,
  `prihlaseny` int(11) NOT NULL,
  PRIMARY KEY (`nick`,`pass`,`hodnost`,`prihlaseny`),
  UNIQUE KEY `nick` (`nick`),
  UNIQUE KEY `pass` (`pass`),
  UNIQUE KEY `hodnost` (`hodnost`),
  UNIQUE KEY `prihlaseny` (`prihlaseny`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 Thank you.
Re: mysql table... - 
ComDuck -  12.02.2019
Код:
new query[72+MAX_PLAYER_NAME+32];
  
 
Код:
mysql_format(handle, query, sizeof(query), .... VALUES ('%s', MD5('%s'), 0, 0)", ... );
 Why are you using MD5 without salting it? Let alone even using MD5 in the first place 


 
Код:
mysql_query(handle, query);
 mysql_query is deprecated. Please use the latest version of the MySQL plugin and the much safer natives that come with it.
I agree with ******, switch to a ready-made user management system that is more secure than this one. Or learn how to make a better one on your own with the latest functions.