[Ajuda] Hash MyBB - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: Non-English (
https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (
https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (
https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] Hash MyBB (
/showthread.php?tid=628281)
Hash MyBB -
pWesley - 08.02.2017
Estou tentando usar o hash do MyBB no PAWN para tentar criar um sistema de login, mas acontece o seguinte. Nгo sei se o problema deva ser diferenciaзгo por conta de caracteres em letras maiъsculas ou sei lб o que. Mas eu fiz um debug de como estou utilizando a funзгo:
pawn Код:
debug com tolower: C17B0956505182F5308108A602077A1D
debug com toupper: E1B1BC3B6D56D56531FF2E47106F6A9E
Deixarei o cуdigo de como estб a funзгo, para que se alguйm puder ajudar ficarei agradecido:
PHP код:
Dialog:DialogLogin(playerid, response, listitem, inputtext[])
{
if(response)
{
if(strcmp(MyBB_Hash(inputtext, APlayerData[playerid][Salt]), APlayerData[playerid][Password]) == 0)
{
cache_set_active(APlayerData[playerid][Player_Cache]);
cache_get_value_int(0, "uid", APlayerData[playerid][ID]);
cache_delete(APlayerData[playerid][Player_Cache]);
APlayerData[playerid][Player_Cache] = MYSQL_INVALID_CACHE;
APlayerData[playerid][LoggedIn] = true;
SendClientMessage(playerid, COLOR_GREEN, "Logado com sucesso.");
}
else
{
SendClientMessage(playerid, COLOR_LIGHTRED, "Senha incorreta.");
Dialog_Show(playerid, DialogLogin, DIALOG_STYLE_PASSWORD, "Logando", "Teste", "Registrar", "Sair");
}
}
return 1;
}
Respuesta: Hash MyBB -
SammyJ - 08.02.2017
PHP код:
Dialog:DialogLogin(playerid, response, listitem, inputtext[])
{
if(response)
{
if(strcmp(MyBB_Hash(inputtext, APlayerData[playerid][Salt]), APlayerData[playerid][Password], true) == 0)// ultimo argumento como true para ignorar case sensitive
{
cache_set_active(APlayerData[playerid][Player_Cache]);
cache_get_value_int(0, "uid", APlayerData[playerid][ID]);
cache_delete(APlayerData[playerid][Player_Cache]);
APlayerData[playerid][Player_Cache] = MYSQL_INVALID_CACHE;
APlayerData[playerid][LoggedIn] = true;
SendClientMessage(playerid, COLOR_GREEN, "Logado com sucesso.");
}
else
{
SendClientMessage(playerid, COLOR_LIGHTRED, "Senha incorreta.");
Dialog_Show(playerid, DialogLogin, DIALOG_STYLE_PASSWORD, "Logando", "Teste", "Registrar", "Sair");
}
}
return 1;
}
Re: Hash MyBB -
pWesley - 08.02.2017
Preciso analisar um pouco mais meus cуdigos. Deu certo aqui. Obrigado.