29.05.2014, 06:55
Hello;
I have a little problem with this code in one time the Encrypt wasn't made then, I change for this actual code and the encrypt is successfull but the Name of the player isn't saved in the mysql database I don't know what exactly is wrong I hope anybody might help me
I have a little problem with this code in one time the Encrypt wasn't made then, I change for this actual code and the encrypt is successfull but the Name of the player isn't saved in the mysql database I don't know what exactly is wrong I hope anybody might help me
PHP код:
//Dialog to get connected and not registered
case Register_doc:
{
if(response == 0)
{
Kick(playerid);
return 1;
}
else
{
if(strlen(inputtext))
{
new tmppass[64];
strmid(tmppass, inputtext, 0, strlen(inputtext), 255);
OnPlayerRegister(playerid,inputtext);
return 1;
}
else
{
ShowRegisterDialog(playerid);//Register_doc
return 1;
}
}
}
PHP код:
public OnPlayerRegister(playerid, password[])
{
if(IsPlayerConnected(playerid))
{
MySQLCheck();
new playername3[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername3, sizeof(playername3));
new escapedPassword[129];
WP_Hash(escapedPassword, sizeof(escapedPassword), password);
new newaccountsqlid = InsertPlayer(playername3, escapedPassword);
if (newaccountsqlid != 0)
{
//Register data
}
else
{
SendClientMessage(playerid, COLOR_RED, "Error occurred, Disconnected.");
// Kick(playerid);
return 0;
}
}
return 0;
}
PHP код:
//stock
stock InsertPlayer(pname[], password[])
{
new query[200], escapedname[ MAX_PLAYER_NAME ],escapedPassword[129];
mysql_real_escape_string( pname, escapedname );
WP_Hash(escapedPassword, sizeof(escapedPassword), password);
format(query, sizeof(query), "INSERT INTO "TABLENAME" (`"User_Name"`, `"P_Passswd"`) VALUES ('%s', '%s')", escapedname, escapedPassword);
mysql_query(query);
new newplayersid = E_user(pname);
if (newplayersid != 0)
{
return newplayersid;
}
return 0;
}