02.05.2011, 12:38
Use the admin system hidmin but I do not know which format to encode passwords in mysql database?
this is the command /register please help me in that format encoding because I want to connect to database with php.
nod
this is the command /register please help me in that format encoding because I want to connect to database with php.
Код:
COMMAND:register(playerid, params[]) { if(GetPVarInt(playerid, "Logged")) return SendClientMessage(playerid, COLOR_ORANGE, "[*] You're already logged in!"); if(isnull(params)) return SendClientMessage(playerid, COLOR_ORANGE, "[*] Usage: /register [pass]"); new Query[320], pName[MAX_PLAYER_NAME]; GetPlayerName(playerid, pName, MAX_PLAYER_NAME); mysql_real_escape_string(pName, pName); format(Query, sizeof Query, "SELECT * FROM `accounts` WHERE `Name` = '%s' LIMIT 1", pName); mysql_query(Query); mysql_store_result(); if(mysql_num_rows()) { SendClientMessage(playerid, COLOR_ORANGE, "[*] An account already exists under that name! Use \"/login\" to log in!"); mysql_free_result(); return 1; } mysql_free_result(); WP_Hash(Query, 129, params); new IP[16]; GetPlayerIp(playerid, IP, 16); format(Query, sizeof Query, "INSERT INTO `accounts` (Name, Password, IP, Admin, Money, Score, Kills, Deaths) VALUES ('%s', '%s', '%s', %i, %i, %i, %i, %i)", pName, Query, IP, GetPVarInt(playerid, "Admin"), GetPlayerMoney(playerid), GetPlayerScore(playerid), GetPVarInt(playerid, "Kills"), GetPVarInt(playerid, "Deaths")); mysql_query(Query); SetPVarInt(playerid, "Logged", 1); SendClientMessage(playerid, COLOR_LIMEGREEN, "[*] Succesfully registered and automatically logged in!"); return 1; }