01.02.2018, 23:02
Can anybody figure out whats wrong here, when I join my server and /register it doesn't save to MySQL database, its connected properly because if I manually create a new account by adding it to the MySQL database it successfully loads in-game its just not saving for some reason
MySQLCreateAccount stock:
OnDialogResponse for /register dialog:
empty sql table after /registering in-game:
MySQLCreateAccount stock:
Код:
stock MySQLCreateAccount(newplayersname[], newpassword[]) { new query[128]; new sqlplyname[64]; new sqlpassword[64]; mysql_real_escape_string(newplayersname, sqlplyname); mysql_real_escape_string(newpassword, sqlpassword); format(query, sizeof(query), "INSERT INTO playerinfo (user, password) VALUES ('%s', '%s')", sqlplyname, sqlpassword); mysql_query(query); new newplayersid = MySQLCheckAccount(newplayersname); if (newplayersid != 0) { return newplayersid; } return 0; }
Код:
mysql_real_escape_string(inputtext, escpass); //mysql_real_escape_string(PlayerInfo[playerid][pName],PlayerInfo[playerid][pName]); //mysql_real_escape_string(inputtext,inputtext); format(query, sizeof(query), "INSERT INTO playerdata (UserName, Password, IP) VALUES('%s', SHA1('%s'), '%s')", PlayerInfo[playerid][pName], escpass, PIP); mysql_query(query); //format(query, sizeof(query), "INSERT INTO playerdata (UserName, Password, IP) VALUES ('%s', md5('%s'), '%s')",PlayerInfo[playerid][pName], inputtext, PIP); //Insert string //mysql_query(query); format(query,sizeof(query),"UPDATE playerdata SET Registered = '%s' WHERE (UserName = '%s')",LastLogin,PlayerInfo[playerid][pName]); mysql_query(query); //queries format(query,sizeof(query),"UPDATE playerdata SET LastLogin = '%s' WHERE (UserName = '%s')",LastLogin,PlayerInfo[playerid][pName]); mysql_query(query); //queries mysql_free_result(); PlayerInfo[playerid][pLogged] = 1; PlayerInfo[playerid][pRegistered] = 1; //SendClientMessage(playerid, COLOR_SERVER_MAIN_MSG, "Registered And Logged In.");