23.06.2014, 13:09
I don't know at all how to use SQL through SAMP, but I think in SQL this is possible :
And there's another way to proceed, but this one have to be done when you create your table :
This way, you can just do (register step)
Oh and btw, it's strongly recommended to HASH (Whirlpool for example) your user passwords BEFORE inserting them in your database. Because once someone else than the user can see as plain text the passwords : they are leaked.
PHP код:
format(Query, sizeof(Query), "INSERT INTO `Conturi` (`PlayerIP`,`Nume`,\
`Parola`, `AdminLevel`,\
`Ucideri`,`Decese`,\
`Bani`,`Culoare`,\
`Skin`,`Level`) VALUES('%d','%s','%s','0','0','0','0','0','0','0')",GetPlayerIPEx(playerid),DB_Escape(name),DB_Escape(inputtext),0,0,0,0,0,0,0);
PHP код:
CREATE TABLE IF NOT EXISTS `Conturi` (
PlayerIP VARCHAR(16) NOT NULL,
Nume VARCHAR(25) NOT NULL,
Parola VARCHAR(60) NOT NULL,
AdminLevel SMALLINT NOT NULL DEFAULT 0,
Ucideri INT NOT NULL DEFAULT 0,
Decese INT NOT NULL DEFAULT 0,
Bani TINYINT NOT NULL DEFAULT 0,
Cloare INT NOT NULL DEFAULT 0,
Skin SMALLINT NOT NULL DEFAULT 0,
Level TINYINT NOT NULL DEFAULT 0,
Primary Key(whatever)
)
ENGINE=INNODB;
PHP код:
format(query, sizeof(query), "INSERT INTO Conturi (PlayerIP, Nume, Parola) VALUES ('%s', '%s', '%s')", GetPlayerIPEx(playerid), DB_Escape(name), DB_Escape(inputtext));

