Hallo,
Ich habe folgendes Problem:
Ich habe es geschafft das dass Passwort des Benutzers in meiner MySQL Datenbank per MD5 Hash verschlüsselt wird. Jedoch wird dies beim Ausloggen überschrieben & es steht nun nur noch zur Hälfte in der Datenbank.
Beispiel:
So ist es beim ersten einloggen: 651b0a713597ff71883d9e1050ba6df9
So ist es nach dem Ausloggen: 651b0a713597ff7
Ich komme einfach nicht weiter ...
Ich wäre sehr dankbar, wenn jemand von euch die Zeit hätte, mir über Teamviewer kurz zu Helfen.
Mit freundlichen grüßen PSAIKO.DINO
public OnPlayerRegister(playerid, password[])
{
StuffInfo[sNeuUser] += 1;
if(IsPlayerConnected(playerid))
{
new string[128],
playername[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, sizeof(playername));
format(string, sizeof(string), "%s", password);
strmid(PlayerInfo[playerid][pKey], MD5_Hash(string), 0, strlen(string), 255);
//PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash];
//#if defined MySQLSpeicherung
format(string, sizeof(string), "INSERT INTO `users` (`Name`, `Key`) VALUES ('%s', '%s')", playername, PlayerInfo[playerid][pKey]);
self_mysql_query(string);
format(string, sizeof(string), "UPDATE `users` SET `RegisterDatum`='%d' WHERE `Name`='%s'", Time(), playername);
self_mysql_query(string);
else if(dialogid == Login)
{
if(response == 0)
{
SendClientMessage(playerid, COLOR_ERRORTEXT, " Du hast den Vorgang abgebrochen und wurdest automatisch gekickt.");
TogglePlayerControllable(playerid, 0);
Kick(playerid);
}
if(response == 1)
{
if(strlen(inputtext) == 0 || strlen(inputtext) < 7 || strlen(inputtext) > 32) // Wenn kein Passwort angegebene wurde
{
ShowPlayerDialog(playerid, Login, DIALOG_STYLE_PASSWORD, "Login", "Bitte logge dich ein indem du dein Passwort unten eingibst.","Login","Abbruch");
return 1;
}
else
{
new NotJoin = 0;
new StepID = -1;
new sendername[MAX_PLAYER_NAME];
for(new i = 0; i < sizeof(OffPickup); i++)
{
if(OffPickup[i][OffErstellt] == 1)
{
if(OffPickup[i][OffZeit] > 0)
{
GetPlayerName(playerid, sendername, sizeof(sendername));
if(strcmp(sendername,OffPickup[i][OfflineName], true) == 0)
{
NotJoin = 1;
StepID = i;
break;
}
}
}
}
if(CheckPasswort(playerid, MD5_Hash(inputtext)) == 1) // Wir holen uns das Passwort aus der MySQL Datenbank und überprüfen es mit dem angegebenen passwort.
{
if(NotJoin == 1)
{
format(string, sizeof(string), "Du musst warten bis dein Logout Pickup weg ist. {0087FF}(%d Sekunden)", OffPickup[StepID][OffZeit]);
ShowPlayerDialog(playerid, Login, DIALOG_STYLE_PASSWORD, "Login", string,"Login","Abbruch");
return 1;
}
strmid(PlayerInfo[playerid][pKey], MD5_Hash(inputtext), 0, strlen(inputtext), 255);
OnPlayerLogin(playerid); //Der Spieler wird "geladen", speich es werden seine Daten aus der Datenbank geholt und in variablen gespeichert um diese im Skript zu verwenden.
return 1;
}
else
{
//Wenn das Passwort falsch war, lassen wir erneut das Login fenster erscheinen damit der Spieler das Richtige Passwort eingibt.
ShowPlayerDialog(playerid, Login, DIALOG_STYLE_PASSWORD, "Login", "Das eingegebene Passwort ist Falsch, bitte versuche es erneut.","Login","Abbruch");
return 1;
}
}
}
return 1;
}
public PlayerUpdate(playerid)
{
if(IsPlayerConnected(playerid))
{
if(IsPlayerNPC(playerid))
{
return 1;
}
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, sizeof(playername));
new endstring[4000];
new var[500];
format(endstring, sizeof(endstring), "UPDATE `users` SET ");
format(var, sizeof(var), "`Key`='%s', ", PlayerInfo[playerid][pKey]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`Level`='%d', ", PlayerInfo[playerid][pLevel]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`AdminLevel`='%d', ", PlayerInfo[playerid][pAdmin]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`DonateRank`='%d', ", PlayerInfo[playerid][pDonatorRank]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`UpgradePoints`='%d', ", PlayerInfo[playerid][gPupgrade]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`ConnectedTime`='%d', ", PlayerInfo[playerid][pConnectTime]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`Registered`='%d', ", PlayerInfo[playerid][pReg]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`Sex`='%d', ", PlayerInfo[playerid][pSex]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`Age`='%d', ", PlayerInfo[playerid][pAlter]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`Origin`='%d', ", PlayerInfo[playerid][pOrigin]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`Muted`='%d', ", PlayerInfo[playerid][pMuted]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`Respect`='%d', ", PlayerInfo[playerid][pRespekt]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`Money`='%d', ", PlayerInfo[playerid][pCash]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`Bank`='%d', ", PlayerInfo[playerid][pBank]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`Allowed`='%d', ", PlayerInfo[playerid][pAllowed]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`bankfach1`='%d', ", PlayerInfo[playerid][pBankFach1]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`bankfach2`='%d', ", PlayerInfo[playerid][pBankFach2]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`bankfach3`='%d', ", PlayerInfo[playerid][pBankFach3]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`bankfach4`='%d', ", PlayerInfo[playerid][pBankFach4]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`wgs`='%d', ", PlayerInfo[playerid][pwgs]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`facherlaubis`='%d', ", PlayerInfo[playerid][pfacherlaubis]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`Crimes`='%d', ", PlayerInfo[playerid][pCrimes]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`Kills`='%d', ", PlayerInfo[playerid][pKills]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`sKills`='%d', ", PlayerInfo[playerid][psKills]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`Deaths`='%d', ", PlayerInfo[playerid][pDeaths]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`Arrested`='%d', ", PlayerInfo[playerid][pArrested]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`ArrestTime`='%d', ", PlayerInfo[playerid][pArrestTime]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`PhoneBook`='%d', ", PlayerInfo[playerid][pPhoneBook]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`LottoNr`='%d', ", PlayerInfo[playerid][pLottoNr]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`Fishes`='%d', ", PlayerInfo[playerid][pFishes]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`BiggestFish`='%d', ", PlayerInfo[playerid][pBiggestFish]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`Job`='%d', ", PlayerInfo[playerid][pJob]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`Paycheck`='%d'", PlayerInfo[playerid][pPayCheck]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), " WHERE `Name`='%s'", playername);
strcat(endstring, var, sizeof(endstring));
self_mysql_query(endstring);
format(endstring, sizeof(endstring), "UPDATE `users` SET ");
format(var, sizeof(var), "`HeadValue`='%d', ", PlayerInfo[playerid][pHeadValue]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`Jailed`='%d', ", PlayerInfo[playerid][pJailed]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`JailTime`='%d', ", PlayerInfo[playerid][pJailTime]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`Leader`='%d', ", PlayerInfo[playerid][pLeader]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`Member`='%d', ", PlayerInfo[playerid][pMember]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`Rank`='%d', ", PlayerInfo[playerid][pRank]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`Skin`='%d', ", PlayerInfo[playerid][pChar]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`Vertragszeit`='%d', ", PlayerInfo[playerid][pVertragszeit]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`DetSkill`='%d', ", PlayerInfo[playerid][pDetSkill]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`SexSkill`='%d', ", PlayerInfo[playerid][pSexSkill]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`LawSkill`='%d', ", PlayerInfo[playerid][pAnwaltSkill]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`MechSkill`='%d', ", PlayerInfo[playerid][pMechSkill]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`JackSkill`='%d'", PlayerInfo[playerid][pJackSkill]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), " WHERE `Name`='%s'", playername);
strcat(endstring, var, sizeof(endstring));
self_mysql_query(endstring);
format(endstring, sizeof(endstring), "UPDATE `users` SET ");
format(var, sizeof(var), "`CarSkill`='%d', ", PlayerInfo[playerid][pCarSkill]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`NewsSkill`='%d', ", PlayerInfo[playerid][pNewsSkill]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`DrugsSkill`='%d', ", PlayerInfo[playerid][pDrugsSkill]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`CookSkill`='%d', ", PlayerInfo[playerid][pCookSkill]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`FishSkill`='%d', ", PlayerInfo[playerid][pFishSkill]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`pSHealth`='%.1f', ", PlayerInfo[playerid][pSHealth]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`PhoneNr`='%d', ", PlayerInfo[playerid][pNummer]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`House`='%d', ", PlayerInfo[playerid][pPhousekey]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`Biz`='%d', ", PlayerInfo[playerid][pBizKey]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`CarLic`='%d', ", PlayerInfo[playerid][pCarLic]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`FlyLic`='%d', ", PlayerInfo[playerid][pFlyLic]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`BoatLic`='%d', ", PlayerInfo[playerid][pBoatLic]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`FishLic`='%d', ", PlayerInfo[playerid][pFishLic]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`GunLic`='%d', ", PlayerInfo[playerid][pGunLic]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`Zollpass`='%d'", PlayerInfo[playerid][pZollpass]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), " WHERE `Name`='%s'", playername);
strcat(endstring, var, sizeof(endstring));
self_mysql_query(endstring);
format(endstring, sizeof(endstring), "UPDATE `users` SET ");
format(var, sizeof(var), "`Gun1`='%d', ", PlayerInfo[playerid][pGun1]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`Gun2`='%d', ", PlayerInfo[playerid][pGun2]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`Gun3`='%d', ", PlayerInfo[playerid][pGun3]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`Gun4`='%d', ", PlayerInfo[playerid][pGun4]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`Ammo1`='%d', ", PlayerInfo[playerid][pAmmo1]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`Ammo2`='%d', ", PlayerInfo[playerid][pAmmo2]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`Ammo3`='%d', ", PlayerInfo[playerid][pAmmo3]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`Ammo4`='%d', ", PlayerInfo[playerid][pAmmo4]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`CarTime`='%d', ", PlayerInfo[playerid][pCarTime]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`PayDay`='%d', ", PlayerInfo[playerid][pPayDay]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`PayDayHad`='%d', ", PlayerInfo[playerid][pPayDayHad]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`CDPlayer`='%d', ", PlayerInfo[playerid][pCDPlayer]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`AlcoholPerk`='%d', ", PlayerInfo[playerid][pAlcoholPerk]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`PainKillerPerk`='%d', ", PlayerInfo[playerid][pPainKillerPerk]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`DrugPerk`='%d', ", PlayerInfo[playerid][pDrugPerk]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`MiserPerk`='%d', ", PlayerInfo[playerid][pMiserPerk]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`TraderPerk`='%d', ", PlayerInfo[playerid][pTraderPerk]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`Tutorial`='%d', ", PlayerInfo[playerid][pTut]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`Warnings`='%d'", PlayerInfo[playerid][pWarns]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), " WHERE `Name`='%s'", playername);
strcat(endstring, var, sizeof(endstring));
self_mysql_query(endstring);
format(endstring, sizeof(endstring), "UPDATE `users` SET ");
format(var, sizeof(var), "`Fuel`='%d', ", PlayerInfo[playerid][pFuel]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`Married`='%d', ", PlayerInfo[playerid][pMarried]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`MarriedTo`='%s', ", PlayerInfo[playerid][pMarriedTo]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`WantedLevel`='%d', ", PlayerInfo[playerid][pWantedLevel]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`Spawn`='%d', ", PlayerInfo[playerid][pSpawn]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`SavedMaterials`='%d', ", PlayerInfo[playerid][pSaveMats]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`SavedDrugs`='%d', ", PlayerInfo[playerid][pSaveDrugs]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`SaveCodes`='%d', ", PlayerInfo[playerid][pSaveCodes]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`BikeLic`='%d', ", PlayerInfo[playerid][pBikeLic]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`LKWLic`='%d', ", PlayerInfo[playerid][pLKWLic]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`DonatorTime`='%d', ", PlayerInfo[playerid][pDonatorZeit]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`WerberName`='%s', ", PlayerInfo[playerid][pWerberName]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`FightingStyle`='%d', ", PlayerInfo[playerid][pFightingStyle]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`Handy`='%d'", PlayerInfo[playerid][pHandy]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), " WHERE `Name`='%s'", playername);
strcat(endstring, var, sizeof(endstring));
self_mysql_query(endstring);
format(endstring, sizeof(endstring), "UPDATE `users` SET ");
format(var, sizeof(var), "`OnDutySkin`='%d', ", PlayerInfo[playerid][pOnDutySkin]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`CarLicPoints`='%d', ", PlayerInfo[playerid][pCarLicPoints]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`BikeLicPoints`='%d', ", PlayerInfo[playerid][pBikeLicPoints]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`InviteSperre`='%d', ", PlayerInfo[playerid][pInviteSperre]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`WeaponTime`='%d', ", PlayerInfo[playerid][pGWeaponTime]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`warntime1`='%d', ", PlayerInfo[playerid][pWarnTime1]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`warntime2`='%d', ", PlayerInfo[playerid][pWarnTime2]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`Ticketsopen`='%d', ", PlayerInfo[playerid][pTicketsopen]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`DonatorTime`='%d', ", PlayerInfo[playerid][pDonatorZeit]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`OldName`='%s', ", PlayerInfo[playerid][pOldName]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`ClientIP`='%s', ", PlayerInfo[playerid][pUserIP]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`OrgMember`='%d', ", PlayerInfo[playerid][pOrgaID]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`OrgLeader`='%d', ", PlayerInfo[playerid][pOrgaLeader]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), "`OrgName`='%s'", PlayerInfo[playerid][pOrgaName]);
strcat(endstring, var, sizeof(endstring));
format(var, sizeof(var), " WHERE `Name`='%s'", playername);
strcat(endstring, var, sizeof(endstring));
self_mysql_query(endstring);
new string[500];