Page 1 of 4 123 ... LastLast
Results 1 to 10 of 40

Thread: Probelm with MySQL register.

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Private
    Join Date
    Jul 2016
    Posts
    21
    Thanks
    6
    Thanked 9 Times in 9 Posts

    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(loginpassword)
    {
        
    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(rowsargs)
    {    
       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 >= && args[2].size <= 20)
                       {
                           if(
    args[3].size >= && 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 !

  2. #2
    Private
    Join Date
    Jul 2016
    Posts
    21
    Thanks
    6
    Thanked 9 Times in 9 Posts
    bump
    10char

  3. The Following User Says Thank You to nightbot For This Useful Post:

    kubislav23 (23rd July 2016)

  4. #3
    Sergeant maxdamage99's Avatar
    Join Date
    Aug 2014
    Location
    Russia
    Posts
    458
    Thanks
    79
    Thanked 122 Times in 101 Posts
    Omg, where query's? D

  5. The Following User Says Thank You to maxdamage99 For This Useful Post:

    Paho (23rd July 2016)

  6. #4
    Private
    Join Date
    Jul 2016
    Posts
    21
    Thanks
    6
    Thanked 9 Times in 9 Posts
    could you fix it for me?

  7. The Following User Says Thank You to nightbot For This Useful Post:

    kubislav23 (23rd July 2016)

  8. #5
    Global Mossaderator Mitch's Avatar
    Join Date
    Nov 2012
    Posts
    654
    Thanks
    204
    Thanked 450 Times in 305 Posts
    Quote Originally Posted by nightbot View Post
    could you fix it for me?
    You can restrict double values with UNIQUE.
    Your problem isn't the database, but how you process the results.
    E.g.
    PHP Code:
    case "register"
       
    hasLogin searchForLogin(username); 
       if (!
    hasLogin) {
          
    createAdmin(usernamepassword);
       } 
    Note: this is not working code that you can just copy and paste and use. Just an example.

  9. The Following User Says Thank You to Mitch For This Useful Post:

    nightbot (23rd July 2016)

  10. #6
    Sergeant maxdamage99's Avatar
    Join Date
    Aug 2014
    Location
    Russia
    Posts
    458
    Thanks
    79
    Thanked 122 Times in 101 Posts
    i no use async, i can fix by simple
    Code:
    mysql_query

  11. The Following User Says Thank You to maxdamage99 For This Useful Post:

    Paho (23rd July 2016)

  12. #7
    Private
    Join Date
    Jul 2016
    Posts
    21
    Thanks
    6
    Thanked 9 Times in 9 Posts
    Ok give it

  13. The Following User Says Thank You to nightbot For This Useful Post:

    kubislav23 (23rd July 2016)

  14. #8
    Private
    Join Date
    Jul 2016
    Posts
    21
    Thanks
    6
    Thanked 9 Times in 9 Posts
    Ahaa ! But can you give me atleast a good start for it ? I'm not that good at mysql things tbh mitch

  15. The Following User Says Thank You to nightbot For This Useful Post:

    kubislav23 (23rd July 2016)

  16. #9
    Private
    Join Date
    Jul 2016
    Posts
    21
    Thanks
    6
    Thanked 9 Times in 9 Posts
    Quote Originally Posted by nightbot View Post
    I'm not that good at mysql things tbh
    Every single thing u said didn't understand anything from. Maybe a small tutorial or some links.
    If u wants to help me i will just have 3 columns login password rank in admins table.

  17. The Following User Says Thank You to nightbot For This Useful Post:

    kubislav23 (23rd July 2016)

  18. #10
    Private Paho's Avatar
    Join Date
    Feb 2014
    Location
    Russia
    Posts
    101
    Thanks
    43
    Thanked 48 Times in 37 Posts
    Quote Originally Posted by Benny Benassi View Post
    Every single
    Every single day - single hour
    I can see your face - single day

  19. The Following User Says Thank You to Paho For This Useful Post:

    kubislav23 (23rd July 2016)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •