Guten Tag zusammen,
nach einer kleinen Umstellung auf SHA256 von MD5 habe ich nun ein kleines Problem bekommen, was vorher nicht vorhanden war:
ZitatAlles anzeigen[11:41:13] [WARNING] CMySQLResult::GetRowDataByName - field not found ("id")
[11:41:13] [ERROR] cache_get_field_content_int - invalid datatype
[11:41:13] [WARNING] CMySQLResult::GetRowDataByName - field not found ("name")
[11:41:13] [ERROR] cache_get_field_content_int - invalid datatype
[11:41:13] [ERROR] cache_get_field_content_int - invalid datatype
[11:41:13] [WARNING] CMySQLResult::GetRowDataByName - field not found ("level")
[11:41:13] [ERROR] cache_get_field_content_int - invalid datatype
[11:41:13] [WARNING] CMySQLResult::GetRowDataByName - field not found ("adminlevel")
[11:41:13] [ERROR] cache_get_field_content_int - invalid datatype
[11:41:13] [WARNING] CMySQLResult::GetRowDataByName - field not found ("money")
[11:41:13] [ERROR] cache_get_field_content_int - invalid datatype
[11:41:13] [WARNING] CMySQLResult::GetRowDataByName - field not found ("kills")
[11:41:13] [ERROR] cache_get_field_content_int - invalid datatype
[11:41:13] [WARNING] CMySQLResult::GetRowDataByName - field not found ("deaths")
[11:41:13] [ERROR] cache_get_field_content_int - invalid datatype
[11:41:13] [WARNING] CMySQLResult::GetRowDataByName - field not found ("fracid")
[11:41:13] [ERROR] cache_get_field_content_int - invalid datatype
[11:41:13] [WARNING] CMySQLResult::GetRowDataByName - field not found ("rang")
[11:41:13] [ERROR] cache_get_field_content_int - invalid datatype
[11:41:13] [WARNING] CMySQLResult::GetRowDataByName - field not found ("spawnchange")
[11:41:13] [ERROR] cache_get_field_content_int - invalid datatype
Als Anleitung habe ich diese hier genutzt : http://forum.sa-mp.com/showthread.php?t=581336
Register und Login funktioniert soweit. Beim Laden passiert sehr wahrscheinlich der Fehler.
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_REGISTER)
{
if(!response) return Kick(playerid);
new salt[11];
for(new i; i < 10; i++)
{
salt[i] = random(79) + 47;
}
salt[10] = 0;
SHA256_PassHash(inputtext, salt, PlayerInfo[playerid][pPassword], 65);
if(strlen(inputtext) < 5) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Registration", "Bitte registriere Dich:\n{FF0000}Mindestens 5 Zeichen!", "Ok", "Abbrechen");
new query[256];
mysql_format(handle, query, sizeof(query), "INSERT INTO `users` (`name`, `password`, `salt`) VALUES ('%e', '%e', '%e')", PlayerInfo[playerid][pName], PlayerInfo[playerid][pPassword], salt);
mysql_pquery(handle, query, "OnUserRegister", "d", playerid);
return 1;
}
if(dialogid == DIALOG_LOGIN)
{
if(!response) return Kick(playerid);
new hash[65];
SHA256_PassHash(inputtext, PlayerInfo[playerid][pSalt], hash, 64);
if(strlen(inputtext) < 5) return ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Anmeldung", "Bitte logge Dich ein:\n{FF0000}Mindestens 5 Zeichen!", "Ok", "Abbrechen");
new query[256];
mysql_format(handle, query, sizeof(query), "SELECT `password`, `salt` FROM `users` WHERE `name` = '%e'", PlayerInfo[playerid][pName]);
mysql_pquery(handle, query, "OnUserLogin", "d", playerid);
return 1;
}
return 0;
}
forward OnUserLogin(playerid);
public OnUserLogin(playerid)
{
if(cache_get_row_count() == 0)
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Anmeldung", "Bitte logge Dich ein:\n{FF0000}Falsches Passwort!", "Ok", "Abbrechen");
}
else
{
PlayerInfo[playerid][p_id] = cache_get_field_content_int(0, "id", handle);
PlayerInfo[playerid][pName] = cache_get_field_content_int(0, "name", handle);
PlayerInfo[playerid][pPassword] = cache_get_field_content_int(0, "password", handle);
PlayerInfo[playerid][pSalt] = cache_get_field_content_int(0, "salt", handle);
PlayerInfo[playerid][pLevel] = cache_get_field_content_int(0, "level", handle);
PlayerInfo[playerid][pAdminlevel] = cache_get_field_content_int(0, "adminlevel", handle);
PlayerInfo[playerid][pMoney] = cache_get_field_content_int(0, "money", handle);
PlayerInfo[playerid][pKills] = cache_get_field_content_int(0, "kills", handle);
PlayerInfo[playerid][pDeaths] = cache_get_field_content_int(0, "deaths", handle);
PlayerInfo[playerid][pFracID] = cache_get_field_content_int(0, "fracid", handle);
PlayerInfo[playerid][pRang] = cache_get_field_content_int(0, "rang", handle);
PlayerInfo[playerid][pSpawnchange] = cache_get_field_content_int(0, "spawnchange", handle);
PlayerInfo[playerid][pLoggedIn] = true;
SendClientMessage(playerid, 0x00FF00FF, "[Konto] Eingeloggt.");
GivePlayerMoney(playerid, PlayerInfo[playerid][pMoney]);
}
return 1;
}