stock udb_CheckLogin(nickname[],pwd[]) {
new fname[MAX_STRING], hashpass[129];
WP_Hash(hashpass,sizeof(hashpass),pwd);
format(fname,sizeof(fname),"SFTDM/Users/%s.sav",udb_encode(nickname));
if (udb_UserInt(nickname,"password_hash")==hashpass) return true;
return false;
}
stock udb_Create(nickname[],pwd[]) {
if (udb_Exists(nickname)) return false;
new fname[MAX_STRING], hashpass[129];
WP_Hash(hashpass,sizeof(hashpass),pwd);
format(fname,sizeof(fname),"SFTDM/Users/%s.sav",udb_encode(nickname));
dini_Create(fname);
udb_UserSetInt(nickname,"password_hash",hashpass);
return true;
}
blabla\include\dudb.inc(141) : error 033: array must be indexed (variable "hashpass")
blabla\include\dudb.inc(152) : error 035: argument type mismatch (argument 3)
The problem is most likely that "udb_hash" returns a number (which is why it is so bad - there are too few values it can take to be secure), and "WP_Hash" returns a string so is not a drop-in replacement.
|
udb_UserSet(nickname[],key[],value[])
if (udb_UserInt(nickname,"password_hash")==hashpass) return true;
stock udb_CheckLogin(nickname[], pwd[])
{
new fname[MAX_STRING], hashpass[129];
WP_Hash(hashpass, sizeof(hashpass), pwd);
format(fname, sizeof(fname), "SFTDM/Users/%s.sav", udb_encode(nickname));
if(!strcmp(udb_User(nickname, "password_hash"), hashpass, false)) return true;
return false;
}
stock udb_Create(nickname[], pwd[])
{
if (udb_Exists(nickname)) return false;
new fname[MAX_STRING], hashpass[129];
WP_Hash(hashpass, sizeof(hashpass), pwd);
format(fname, sizeof(fname), "SFTDM/Users/%s.sav", udb_encode(nickname));
dini_Create(fname);
udb_UserSet(nickname, "password_hash", hashpass);
return true;
}