Results 1 to 10 of 14

Thread: Register mysql problem

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Private First Class
    Join Date
    Mar 2016
    Posts
    134
    Thanks
    48
    Thanked 11 Times in 10 Posts

    Register mysql problem

    Hello,
    I'm trying to make a register system using mysql. I got some problems while creating the account and saving it to mysql.
    Here's my code:
    PHP Code:
    registeraccount(usernamepassword)
    {
        
    args = [];
        
    args[0] = "register";
        
    maps\mp\gametypes\_mysql::asyncQuery("SELECT createNewAccount('" maps\mp\gametypes\_mysql::stripstring(username) + "', '" maps\mp\gametypes\_mysql::stripstring(password) + "') AS `userid`", ::recieveloginargs);

    PHP Code:
    recievelogin(rowsargs)
    {
        if(
    rows.size && isdefined(rows[0]) && isdefined(rows[0]["userid"]) && int(rows[0]["userid"]) != 0)
        {
            
    self.pers["userid"] = int(rows[0]["userid"]);
        if(
    isdefined(rows[0]["rank"]))
        {
            
    self.pers["admin"] = int(rows[0]["rank"]); 
            
    self thread tellmessage(sprintf(self.pers["admname"] + " Account opened ! Rank : ^1(^7%^1)"self.pers["admin"]));
            return;
        }
        else
        {
            
    self.pers["admin"] = 0;
            
    self.pers["admname"] = "";
            return;

        }
        if(
    args[0] == "register")
                
    self thread tellmessage("Account created !");
            
    self thread tellmessage("In case you forgot them, you will find a screehshot Info.jpeg on UdSSR mod folder");
            
    self execclientcommand("screenshotJpeg Info");
            return;
        }
        else
        {
            if(
    args[0] == "login")
                
    self thread tellmessage("Wrong Password. Which means username is taken !");
        else
            
    self thread tellmessage("Username already exists");
        }
        

    PHP Code:
    case "register":
            if(
    args[2].size >= && args[2].size <= 20
                { 
                    if(
    args[3].size >= && args[3].size <= 25)
            {
            
    registeraccount(args[2], args[3]);
            return;
              }
            
    self thread tellmessage("pw too short/long");
            return;
        }
        
    self thread tellmessage("user too short/long"); 
    When i try to !register user pass i get this in console:
    PHP Code:
    querySELECT createNewAccount('user''pass') AS `userid
    But nothing is saved to the database.

    I think my createNewAccount table settings are wrong.

    Click image for larger version. 

Name:	create.PNG 
Views:	52 
Size:	25.1 KB 
ID:	1311

    Any solutions please?
    Thanks

  2. The Following 2 Users Say Thank You to suck000 For This Useful Post:

    kubislav23 (16th April 2017),kung foo man (16th April 2017)

Posting Permissions

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