SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 11/02/2019, 10:47 PM   #1
itachi
Big Clucker
 
Join Date: Jul 2010
Posts: 168
Reputation: 2
Default mysql table...

Hello,

I need help with mysql table plase.

Code:
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 :
Code:
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.
itachi is offline   Reply With Quote
Old 12/02/2019, 02:02 AM   #2
Y_Less
Beta Tester
 
Y_Less's Avatar
 
Join Date: Jun 2008
Location: 629 - git.io/Y
Posts: 15,699
Reputation: 3226
Default Re: mysql table...

Use an existing user system, this is already insecure.
Y_Less is online now   Reply With Quote
Old 12/02/2019, 03:29 PM   #3
ComDuck
Big Clucker
 
ComDuck's Avatar
 
Join Date: Feb 2019
Posts: 78
Reputation: 12
Default Re: mysql table...

Code:
new query[72+MAX_PLAYER_NAME+32];


Code:
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

Code:
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 Y_Less, 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.

Last edited by ComDuck; 12/02/2019 at 04:01 PM.
ComDuck is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
MYSQL table Puff Scripting Help 8 01/09/2017 06:59 PM
Help Mysql Table?[+REP] PAF Scripting Help 12 24/06/2014 11:55 AM
MySQL Table JaKe Elite Scripting Help 5 13/11/2012 08:53 AM
MySQL: Update all values in table from another table kurta999 Scripting Help 8 23/08/2012 09:55 PM


All times are GMT. The time now is 02:39 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.