The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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:
    16
    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