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.

add ftp account from webpage

Discussion in 'General Discussion' started by audun1, Aug 19, 2005.

  1. audun1

    audun1 Member

    Joined:
    Dec 6, 2004
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    Hi. I now this has been asked many times but i cant find a and answer to this.

    I have a script that i have writed myself, and i read on some webpage that i must use cprq function in php.

    It look like this

    PHP:
    include('conf.php');
    function 
    leggtilftp(){
        
    $host "server1.servercompany.com";
        
    $port "2083";
        
    $brukernavn $cpaneluser;
        
    $passord $cpanelpassword;
        
        
        
        
    $request "server1.servercompany.com:2083/frontend/$cpanelmodus/ftpaccountadded.html?login=$_POST[userid]&password=$_POST[password]&homedir=$_POST[userid]";
        
    $result cprq($host$port$brukernavn$passord$request);
        
        
        
        
    $show strip_tags($result);
        echo 
    $show;
        
    }
        
    I get this error:

    Fatal error: Call to undefined function: cprq() in /home/xxxxxx/public_html/cp/index.php4 on line 86

    How can i get a skript that add a ftp account on one of my clients webpage ?
     
  2. adept2003

    adept2003 Well-Known Member

    Joined:
    Aug 11, 2003
    Messages:
    283
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    ~ "/(extra|special)/data"
    It means exactly what it says on the tin! You haven't defined the cprq function. Check this thread: http://www.webhostingtalk.com/showthread.php?threadid=372483

    They've defined cprq as follows:
    PHP:
    function cprq($host,$port,$ownername,$reseller_pass,$request) {
    global 
    $email,$password;
    $sock fsockopen($host,$port);
    if(!
    $sock)
    {
    print(
    'Socket error');
    exit();
    }
    }
    If you manage to get the script working, then please post it here - I'm sure others will be grateful in future... :D
     
  3. fwwebs

    fwwebs Well-Known Member

    Joined:
    Feb 16, 2004
    Messages:
    329
    Likes Received:
    0
    Trophy Points:
    16
    Just define the variables.

    PHP:
    $request "/frontend/$cpmod/ftp/doaddftp.html?login=$email&password=$password&homedir=$homedir&quota=$ftp_lim";

    $result cprq($host,$port,$ownername,$reseller_pass,$request);

    $show strip_tags($result);  

    function 
    cprq($host,$port,$ownername,$reseller_pass,$request)  {
    global 
    $email,$db_user1,$db_user2,$db_user3,$password;

    $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))  {

    $result .= fgets ($sock,128);
    }
    fclose$sock );
    return 
    $result;
    }
     
     
Loading...

Share This Page