[HELP] mysql player name -
Luca12 - 17.02.2014
Hello I was registered on my server and when I finish my level skin and money was updated but where is field in databse PlayerName that field is empty it should be my nick Mark_Johnson but is emtpy?Why? Thanks
Re: [HELP] mysql player name -
CuervO - 17.02.2014
There can be many possibilities, show us the code for registering.
Re: [HELP] mysql player name -
Luca12 - 17.02.2014
here
pawn Код:
stock MySQL_Register(playerid, passwordstring[])
{
new newid = mysql_fetch_int() + 1;
WP_Hash(passwordstring,129,PlayerInfo[playerid][Lozinka]);
new Query[200], hIme[MAX_PLAYER_NAME];
ImeIgraca(playerid, hIme);
GetPlayerIp(playerid, PlayerInfo[playerid][IP], 16);
format(Query, sizeof(Query), "INSERT INTO `users` (`ID`,`Nick`, `Password`, `Ip`) VALUES('%d','%s', '%s', '%s')", newid,hIme,passwordstring,PlayerInfo[playerid][IP]);
mysql_query(Query);
mysql_store_result();
SetPlayerInterior(playerid,0);
TogglePlayerControllable(playerid,0);
SetPlayerHealth(playerid,99.0);
RegistrationStep[playerid] = 1;
SetTimerEx("PostaviKameru1",1000,false,"d",playerid);
ClearChatbox(playerid,10);
SendClientMessage(playerid,SVIJETLOPLAVA,"*Dobrodosli na G-Unit RolePlay/DM server v2.9.9");
SendClientMessage(playerid,COLOR_WHITE,"G-Unit vam zeli ugodan i zabavan boravak te dobar provod na serveru");
SendClientMessage(playerid,COLOR_WHITE,"Sada slijedi kratak tutorijal u kojem cete naci osnovne informacije!");
SendClientMessage(playerid,COLOR_WHITE,"Nakon sto pogledate tutorijal, slijede kratka pitanja o pravilima na serveru!");
ShowPlayerDialog(playerid,3,DIALOG_STYLE_LIST,"{00C0FF}Registracija - {F3FF02}Koji ste spol?","Musko \nZensko","U redu","Odustani");
ClearChatbox(playerid,2);
}
Re: [HELP] mysql player name -
CuervO - 17.02.2014
What does the ImeIgraca function do?
On a side note: you can have automatic incremental IDS if you configure your MySQL data table values to do so with primary keys.
Re: [HELP] mysql player name -
PowerPC603 - 17.02.2014
Also, use mysql_format to format your query and use the %e specifier instead of %s to store the player's name.
Mysql_format had this specifier built-in to escape data and prevent SQL injections.
Any player could use a name like
And your query will fail.
Or worse:
Код:
');DROP TABLE users;('
This would completely delete your table and all accounts are lost, because of SQL injection.
Re: [HELP] mysql player name -
Luca12 - 17.02.2014
it says undefined symbol mysql_format and which version of plugin and inc mysql should use?thanks
Re: [HELP] mysql player name -
CuervO - 17.02.2014
You should use the latest, of course. (R37 as of today). That will probably mean a huge rewrite of anything in your code that involves SQL.
Instead of ImeIgraca(playerid, hIme); use the default GetPlayerName
Re: [HELP] mysql player name -
Luca12 - 17.02.2014
can you give me the link of that plugin and when I try repacle %s and instead of that put %e in that nick is not show just says where nick = %e
Re: [HELP] mysql player name -
anou1 - 17.02.2014
https://sampforum.blast.hk/showthread.php?tid=56564
For the R37