Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

outside - CP - mysql add user

Discussion in 'General Discussion' started by kistler, Sep 11, 2005.

  1. kistler

    kistler Well-Known Member

    Joined:
    Jan 27, 2005
    Messages:
    136
    Likes Received:
    0
    Trophy Points:
    166
    When I add a MySQL user using php from my web server it doesn’t enter the password right...

    PHP:
    <?
    //file - test_add.php
    $ownername="cpuser";
    $reseller_pass="cppass";
    $domain="mydomain.com";
    $cpmod="x";
    $add_username="testme";
    $add_password="test";

    $sqlusr="http://$ownername:$reseller_pass@$host:2082/frontend/$cpmod/sql/adduser.html?user=$add_username&pass=$add_password";
    fopen ($sqlusr,"r");
    if(!
    fopen){
    echo 
    "Database username may be corrupted contact the administrator";
    }

    $sock fsockopen($host,$port);
    if(!
    $sock)
    {
    print(
    'Socket error');
    exit();
    }
    $authstr "$ownername:$reseller_pass";
    $pass base64_encode($authstr);
    $in  "GET $request\r\n";
    $in .= "HTTP/1.0\r\n";
    $in .= "Host:$domain\r\n";
    $in .= "Authorization: Basic $pass\r\n";
    $in .= "\r\n";
       
    fputs($sock$in);
       while (!
    feof($sock))  {
    // fgets ($sock,128);
    $result .= fgets ($sock,128);
    }
    fclose$sock );
    return 
    $result;

    }

    ?>
    It will ad the user, but messes up the password... HELP ???
     
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice