case BankRegisterDialog:
{
if(Player[playerid][BankLogged] == 1)
{
if(strlen(inputtext) < 5)
{
SendClientMessage(playerid, COLOR_RED, "[ERROR] You password must be longer than 5 characters!");
return ShowPlayerDialog(playerid, BankRegisterDialog, DIALOG_STYLE_PASSWORD, "Bank Password", "Enter your desired password below:", "Register", "Cancel");
}
new query[100], name[24], query2[100];
GetPlayerName(playerid, name, 24);
WP_Hash(Player[playerid][BankPassword], 129, inputtext);
format(query, sizeof(query), "UPDATE 'accounts' SET 'Bankpassword' = '%s' WHERE 'Name' = '%s'", Player[playerid][BankPassword], name);
mysql_query(mysql, query);
}
}
format(query, sizeof(query), "INSERT INTO `accounts` (`Name`, `Bankpassword`) VALUES (`%e`, `%e`)", name, Player[playerid][BankPassword]);
PHP код:
|
Read your mysql_log.txt file, it should say more information on why the query failed.
I also agree with JasperM about adding a salt along with the hash so even if two or more users have the same password, they will have different hashed output. |
mysql_log(LOG_ALL);
[13:06:31] [DEBUG] mysql_connect - host: "localhost", user: "root", database: "samp", password: "****", port: 3306, autoreconnect: true, pool_size: 2
[13:06:31] [DEBUG] CMySQLHandle::Create - creating new connection..
[13:06:31] [WARNING] CMySQLHandle::Create - connection already exists
[13:06:31] [DEBUG] CMySQLConnection::Connect - establishing connection to database...
[13:06:31] [DEBUG] CMySQLConnection::Connect - connection was successful
[13:06:31] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled
[13:06:31] [DEBUG] mysql_errno - connection: 1
[13:06:31] [DEBUG] mysql_format - connection: 1, len: 128, format: "SELECT `Password`, `ID` FROM `accounts` WHERE `Name` = '%e' LIMIT 1"
[13:06:31] [DEBUG] mysql_tquery - connection: 1, query: "SELECT `Password`, `ID` FROM `accounts` WHERE `Name` = 'sorenkai", callback: "OnAccountCheck", format: "i"
[13:06:31] [DEBUG] CMySQLConnection::Connect - establishing connection to database...
[13:06:31] [DEBUG] CMySQLConnection::Connect - connection was successful
[13:06:31] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled
[13:06:31] [DEBUG] CMySQLConnection::Connect - establishing connection to database...
[13:06:31] [DEBUG] CMySQLConnection::Connect - connection was successful
[13:06:31] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled
[13:06:31] [DEBUG] CMySQLQuery::Execute[OnAccountCheck] - starting query execution
[13:06:31] [DEBUG] CMySQLQuery::Execute[OnAccountCheck] - query was successfully executed within 0.227 milliseconds
[13:06:31] [DEBUG] CMySQLResult::CMySQLResult() - constructor called
[13:06:31] [DEBUG] CMySQLConnection::Connect - establishing connection to database...
[13:06:31] [DEBUG] CMySQLConnection::Connect - connection was successful
[13:06:31] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled
[13:06:31] [DEBUG] Calling callback "OnAccountCheck"..
[13:06:31] [DEBUG] cache_get_data - connection: 1
[13:06:31] [DEBUG] cache_get_field_content - row: 0, field_name: "Password", connection: 1, max_len: 129
[13:06:31] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "Password", data: "****"
[13:06:31] [DEBUG] cache_get_field_content_int - row: 0, field_name: "ID", connection: 1
[13:06:31] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "ID", data: "3"
[13:06:31] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called
[13:06:36] [DEBUG] mysql_format - connection: 1, len: 100, format: "SELECT * FROM `accounts` WHERE `Name` = '%e' LIMIT 1"
[13:06:36] [DEBUG] mysql_tquery - connection: 1, query: "SELECT * FROM `accounts` WHERE `Name` = 'sorenkai' LIMIT 1", callback: "OnAccountLoad", format: "i"
[13:06:36] [DEBUG] CMySQLQuery::Execute[OnAccountLoad] - starting query execution
[13:06:36] [DEBUG] CMySQLQuery::Execute[OnAccountLoad] - query was successfully executed within 0.235 milliseconds
[13:06:36] [DEBUG] CMySQLResult::CMySQLResult() - constructor called
[13:06:36] [DEBUG] Calling callback "OnAccountLoad"..
[13:06:36] [DEBUG] cache_get_field_content_int - row: 0, field_name: "Score", connection: 1
[13:06:36] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "Score", data: "104"
[13:06:36] [DEBUG] cache_get_field_content_int - row: 0, field_name: "Admin", connection: 1
[13:06:36] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "Admin", data: "6"
[13:06:36] [DEBUG] cache_get_field_content_int - row: 0, field_name: "VIP", connection: 1
[13:06:36] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "VIP", data: "0"
[13:06:36] [DEBUG] cache_get_field_content_int - row: 0, field_name: "Money", connection: 1
[13:06:36] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "Money", data: "150229"
[13:06:36] [DEBUG] cache_get_field_content_int - row: 0, field_name: "Bankpassword", connection: 1
[13:06:36] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "Bankpassword", data: "0"
[13:06:36] [DEBUG] cache_get_field_content_int - row: 0, field_name: "Bankmoney", connection: 1
[13:06:36] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "Bankmoney", data: ""
[13:06:36] [ERROR] cache_get_field_content_int - invalid datatype
[13:06:36] [DEBUG] cache_get_field_content_int - row: 0, field_name: "Banklogged", connection: 1
[13:06:36] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "Banklogged", data: "2"
[13:06:36] [DEBUG] cache_get_field_content_float - row: 0, field_name: "PosX", connection: 1
[13:06:36] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "PosX", data: "2316.29"
[13:06:36] [DEBUG] cache_get_field_content_float - row: 0, field_name: "PosY", connection: 1
[13:06:36] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "PosY", data: "-11.52"
[13:06:36] [DEBUG] cache_get_field_content_float - row: 0, field_name: "PosZ", connection: 1
[13:06:36] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "PosZ", data: "26.742"
[13:06:36] [DEBUG] cache_get_field_content_float - row: 0, field_name: "PosA", connection: 1
[13:06:36] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "PosA", data: "182.048"
[13:06:36] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called