|
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. |
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;
}
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];
format(query, sizeof(query), "INSERT INTO `users` (`Password`, `Name`, `IP`) VALUES ('%s', '%s', '%s')", passhash, pName[playerid], pInfo[playerid][IP]);
gSQL = mysql_tquery(gSQL, query, "OnPlayerRegister", "i", playerid);
Dialog_Show(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "alone", "Please enter your password.", "Enter", "Exit");
return 1;
}
|
HTML 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];
format(query, sizeof(query), "INSERT INTO `users` (`Password`, `Name`, `IP`) VALUES ('%s', '%s', '%s')", passhash, pName[playerid], pInfo[playerid][IP]);
gSQL = mysql_tquery(gSQL, query, "OnPlayerRegister", "i", playerid);
Dialog_Show(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "alone", "Please enter your password.", "Enter", "Exit");
return 1;
}
|
|
Dafak?
1.Print the query after formating it and check (debug) 2.Does OnPlayerRegister get called? (you can check with debug) 3.Check mysql_logs for any errors |
function OnPlayerRegister(playerid)
{
pInfo[playerid][SQLID] = cache_insert_id();
print("OnPlayerRegister has been called");
return 1;
}
|
Have you tried debugging them?
EDIT: Try to debug them, here's an example: PHP Code:
|
mysql_format(gSQL, query, sizeof query, "INSERT INTO `users` (`Name`, `Password`, `IP`) VALUES ('%e', '%e', '%e')", pName[playerid], passhash, pInfo[playerid][IP]);