I encountered another problem. My hashed password doesn't seem to save.
at register dialogue I have:
PHP код:
WP_Hash(pass, sizeof(pass), inputtext);
mysql_format(mysql, query, sizeof(query), "INSERT INTO `users` (`Username`, `Password`, `IP`, `Admin`, `Money`, `Level`, `Kills`, `Deaths`, `Warns`, `Banned`, `BanReason`, `BannedBy`, `Beta`, `Faction`, `FactionRank`, `FactionRight`) VALUES ('%e', '%s', '%s', 0, 0, 1, 0, 0, 0, 0, '%s', '%s', 0, -1, '%s', -1)", Name[playerid], pass, IP[playerid], Empty, Empty, Empty);
mysql_tquery(mysql, query, "OnAccountRegister", "i", playerid);
and at login I have
PHP код:
new hpass[129];
WP_Hash(hpass, 129, inputtext);
if(!strcmp(hpass, PlayerInfo[playerid][pPass]))
{
new query[100];
mysql_format(mysql, query, sizeof(query), "SELECT * FROM `users` WHERE `Username` = '%e' LIMIT 1", Name[playerid]);
mysql_tquery(mysql, query, "OnAccountLoad", "i", playerid);
PassWordSecure[playerid] = 1;
}
Also, when I register a lot of stuff get's set to 0 by default. But when I log in; it's normal again.
Mysql log:
Код:
[23:16:37] [DEBUG] mysql_connect - host: "localhost", user: "root", database: "Database_DRP", password: "****", port: 3306, autoreconnect: true, pool_size: 2
[23:16:37] [DEBUG] CMySQLHandle::Create - creating new connection..
[23:16:37] [DEBUG] CMySQLHandle::CMySQLHandle - constructor called
[23:16:37] [DEBUG] CMySQLHandle::Create - connection created (id: 1)
[23:16:37] [DEBUG] CMySQLConnection::Connect - establishing connection to database...
[23:16:37] [DEBUG] CMySQLConnection::Connect - connection was successful
[23:16:37] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled
[23:16:37] [DEBUG] mysql_errno - connection: 1
[23:16:37] [DEBUG] CMySQLConnection::Connect - establishing connection to database...
[23:16:37] [DEBUG] CMySQLConnection::Connect - establishing connection to database...
[23:16:37] [DEBUG] CMySQLConnection::Connect - establishing connection to database...
[23:16:37] [DEBUG] CMySQLConnection::Connect - connection was successful
[23:16:37] [DEBUG] CMySQLConnection::Connect - connection was successful
[23:16:37] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled
[23:16:37] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled
[23:16:37] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled
[23:17:13] [DEBUG] mysql_format - connection: 1, len: 512, format: "SELECT `Password`, `ID` FROM `users` WHERE `Username` = '%e' LIMIT 1"
[23:17:13] [DEBUG] mysql_tquery - connection: 1, query: "SELECT `Password`, `ID` FROM `users` WHERE `Username` = 'Yo_Momm", callback: "OnAccountCheck", format: "i"
[23:17:13] [DEBUG] CMySQLQuery::Execute[OnAccountCheck] - starting query execution
[23:17:13] [DEBUG] CMySQLQuery::Execute[OnAccountCheck] - query was successfully executed within 0.280 milliseconds
[23:17:13] [DEBUG] CMySQLResult::CMySQLResult() - constructor called
[23:17:13] [DEBUG] Calling callback "OnAccountCheck"..
[23:17:13] [DEBUG] cache_get_data - connection: 1
[23:17:13] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called
[23:17:18] [DEBUG] mysql_format - connection: 1, len: 300, format: "INSERT INTO `users` (`Username`, `Password`, `IP`, `Admin`, `Money`, `Level`, `Kills`, `Deaths`, `Warns`, `Banned`, `BanReason`,..."
[23:17:18] [DEBUG] mysql_tquery - connection: 1, query: "INSERT INTO `users` (`Username`, `Password`, `IP`, `Admin`, `Mon", callback: "OnAccountRegister", format: "i"
[23:17:18] [DEBUG] CMySQLQuery::Execute[OnAccountRegister] - starting query execution
[23:17:18] [DEBUG] CMySQLQuery::Execute[OnAccountRegister] - query was successfully executed within 118.86 milliseconds
[23:17:18] [DEBUG] CMySQLResult::CMySQLResult() - constructor called
[23:17:18] [DEBUG] Calling callback "OnAccountRegister"..
[23:17:18] [DEBUG] cache_insert_id - connection: 1
[23:17:18] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called
[23:17:21] [DEBUG] mysql_tquery - connection: 1, query: "UPDATE `users` SET `IP`=127.0.0.1 `Admin`=0, `Money`=0, `Level`=", callback: "(null)", format: "(null)"
[23:17:21] [DEBUG] CMySQLQuery::Execute[] - starting query execution
[23:17:21] [ERROR] CMySQLQuery::Execute[] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.0.1 `Admin`=0, `Money`=0, `Level`=0, `Kills`=0, `Deaths`=0, `Warns`=0, `Banned`' at line 1
[23:17:21] [DEBUG] CMySQLQuery::Execute[] - error will be triggered in OnQueryError
[23:17:48] [DEBUG] mysql_format - connection: 1, len: 512, format: "SELECT `Password`, `ID` FROM `users` WHERE `Username` = '%e' LIMIT 1"
[23:17:48] [DEBUG] mysql_tquery - connection: 1, query: "SELECT `Password`, `ID` FROM `users` WHERE `Username` = 'Yo_Momm", callback: "OnAccountCheck", format: "i"
[23:17:48] [DEBUG] CMySQLQuery::Execute[OnAccountCheck] - starting query execution
[23:17:48] [DEBUG] CMySQLQuery::Execute[OnAccountCheck] - query was successfully executed within 0.251 milliseconds
[23:17:48] [DEBUG] CMySQLResult::CMySQLResult() - constructor called
[23:17:48] [DEBUG] Calling callback "OnAccountCheck"..
[23:17:48] [DEBUG] cache_get_data - connection: 1
[23:17:48] [DEBUG] cache_get_field_content - row: 0, field_name: "Password", connection: 129, max_len: 1
[23:17:48] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "Password", data: ""
[23:17:48] [DEBUG] cache_get_field_content_int - row: 0, field_name: "ID", connection: 1
[23:17:48] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "ID", data: "11"
[23:17:48] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called
[23:28:19] [DEBUG] mysql_tquery - connection: 1, query: "UPDATE `users` SET `IP`=127.0.0.1 `Admin`=-1, `Money`=-1, `Level", callback: "(null)", format: "(null)"
[23:28:19] [DEBUG] CMySQLQuery::Execute[] - starting query execution
[23:28:19] [ERROR] CMySQLQuery::Execute[] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.0.1 `Admin`=-1, `Money`=-1, `Level`=-1, `Kills`=-1, `Deaths`=-1, `Warns`=-1, `B' at line 1
[23:28:19] [DEBUG] CMySQLQuery::Execute[] - error will be triggered in OnQueryError