02.09.2018, 19:27
(
Last edited by Aerotactics; 05/09/2018 at 03:16 AM.
)
I have a valid connection to the host, but the query isn't writing entries.
EDIT: Thanks for the support to a new MySQL user. These are the right questions:
Short Answer: Integers require a default value.
EDIT: Thanks for the support to a new MySQL user. These are the right questions:
Quote:
|
Is mysql_log enabled? The query can fail if the rest of the columns you did not specify in the query do not have a default value. Have you tried executing the query you printed for debug purposes earlier in phpMyAdmin and see the results there?
EDIT: A per-player salt is a better idea. |
Code:
Dialog:DIALOG_REGISTER(playerid, response, listitem, inputtext[])
{
if(!response) return Kick(playerid);
new passhash[257];
SHA256_PassHash(inputtext, #SALT, passhash, sizeof passhash);
pInfo[playerid][Password] = passhash;
new query[256];
mysql_format(gSQL, query, sizeof query, "INSERT INTO `users` (`Name`, `Password`, `IP`) VALUES ('%s', '%s', '%s')", pName[playerid], passhash, pInfo[playerid][IP]);
mysql_tquery(gSQL, query, "OnPlayerRegister", "i", playerid);
Dialog_Show(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "alone", "Please enter your password.", "Enter", "Exit");
return 1;
}
function OnPlayerRegister(playerid)
{
pInfo[playerid][SQLID] = cache_insert_id();
return 1;
}


