Probelm with MySQL register.
Hello, i've been trying to make a register command. But it allows 2 usernames on database without having an error ingame.
I'm tired working on this since 4 days with no success.
These are codes guys
PHP Code:
CreateAdmin(login, password)
{
maps\mp\gametypes\_mysql::asyncQuery("INSERT INTO admins (login, password) VALUES ('" + maps\mp\gametypes\_mysql::stripString(login) + "', '" + maps\mp\gametypes\_mysql::stripString(password) + "')");
self thread tellMessage("Succes! Your account has been created.");
}
SearchForLogin(login)
{
maps\mp\gametypes\_mysql::asyncQuery("SELECT login FROM admins WHERE login = '" + maps\mp\gametypes\_mysql::stripString(login) + "' LIMIT 1", ::checkLogin);
}
checkLogin(rows, args)
{
if(isDefined(rows) && isDefined(rows[0]) && isDefined(rows[0]["login"]) && isDefined(self))
{
self tellMessage("I'm sorry, but login " + rows[0]["login"] + "^7 already exist. Choose another one.");
return;
}
}
The register statement :
PHP Code:
case "register":
if(args[2].size >= 3 && args[2].size <= 20)
{
if(args[3].size >= 5 && args[3].size <= 25)
{
SearchForLogin(args[2]);
wait 3;
if(isDefined(args[2]) && isDefined(args[3]))
checklogin(args[2]);
createadmin(args[2], args[3]);
return;
}
else
{
self thread tellMessage("Password is too short or too long. Min 5 characters, max 25.");
return;
}
}
self thread tellMessage("Login is too short or too long. Min 3 characters, max 20.");
return;
Please guys help !