05.06.2011, 18:01
Hello, so i am trying to create a register, login system. I made the register and it works fine, it shows my nickname in database and password that i set, but i am having problems with login, because i don't really know how to check if the password is correct that you typed compared to password in the database. Here's the script:
I am new to MSQL, can anyone tell me where's the problem?
Код:
if(dialogid == 200)
{
if(response)
{
new vardas[MAX_PLAYER_NAME];
if(!strlen(inputtext)) return ShowPlayerDialog(playerid,200,DIALOG_STYLE_INPUT,"{A3E4FF}Prisijungimas","{FFFFFF}Jus neivedete slaptazodzio.\n{FFFFFF}Prasome ivesti slaptazodi, kad galetumete prisijungti.","Prisijungti","Atsaukti");
if(strlen(inputtext) < 3 || strlen(inputtext) >= 32)
return ShowPlayerDialog(playerid,200,DIALOG_STYLE_INPUT,"{A3E4FF}Prisijungimas","{FFFFFF}Slaptazodis yra per trumpas arba per ilgas.\n{FFFFFF}Prasome ivesti teisinga slaptazodi, kad galetumete prisijungti!","Prisijungti","Atsaukti");
CheckMySQL();
new string[128];
format(string, sizeof(string), "SELECT * FROM Saskaitos WHERE Vardas = '%s' AND Slaptazodis = '%s'", vardas, inputtext);
mysql_query(string);
mysql_store_result();
if(mysql_num_rows())
{
prisijunges[playerid] = 1;
SendClientMessage(playerid, geltona, "[FunZoneLT]>> Jus prisijungete! Sekmes zaidime jums linki Administracijos komanda!");
GivePlayerMoney(playerid, -50000);
if(ALygis[playerid] >= 1)
{
Alabel[playerid] = Create3DTextLabel("Administratorius", raudona,30.0,40.0,50.0,40.0,0);
Attach3DTextLabelToPlayer(Alabel[playerid], playerid, 0.0, 0.0, 0.7);
}
}
else
{
ShowPlayerDialog(playerid,200,DIALOG_STYLE_INPUT,"{A3E4FF}Prisijungimas","{FFFFFF}Jus ivedete neteisinga slaptazodi.\n{FFFFFF}Prasome ivesti teisinga slaptazodi, kad galetumete prisijungti!","Prisijungti","Atsaukti");
return 1;
}
new row[128];
new field[7][32]; // [4] = Amount of fields, [24] = Max length of the bigest field.
mysql_fetch_row_format(row, "|");
explode(row, field, "|");
mysql_free_result();
// The field starts here with 1, because the field 'Name' = 0, and we already have the name in a variable.
format(ZStats[playerid][Slaptazodis], 32, "%s", field[1]);
ZStats[playerid][Adminas] = strval(field[2]);
ZStats[playerid][Pinigai] = strval(field[3]);
GivePlayerMoney(playerid, ZStats[playerid][Pinigai]);
}
else
{
SendClientMessage(playerid, raudona, "[FunZoneLT]>> Jus turite prisijungti prie serverio, pries zaidziant!");
Kick(playerid);
}
}


( Im new to MSQL
