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.

Account Creation

Discussion in 'General Discussion' started by william321, May 9, 2008.

  1. william321

    william321 Member

    Joined:
    Jan 2, 2004
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    New Zealand
    Hi all

    i have developing a custom billing system but a problerm has a rose that i cant seem to fix which one is the creation of the accounts for some reason the createactt functions disaplys a login form and an error about cpanelerror function not being valid and this is my code.

    PHP:
    $status createacct($host,$user,$accesshash,$usessl,$acctdomain,$acctuser,$acctpass,$acctplan);
    print 
    $status;
    Not sure why its asking me to login but it does for some reason displays a form for some reason anyone can help me here i here is the rest of my code i have

    PHP:
    if(isset($_POST['GetAccount']))
                    {
                        //
                        $cpuser=$_POST['cpuser'];
                        $cppass=$_POST['cppass'];
                        if($cpuser || $cppass)
                        {
                            //
                            $message = "Somone has Ordered Hosting from you.";
                    //
                            mail("$owneremail", "Thank you!", $message, "From: $from");
                            echo "Thanks for Ordering your Hosting Account will be created shortly";
                            $acctuser=$cpuser;
                            $acctpass=$cppass;
                            //Get Package Data
                            $acctplan=get_hpid_by_id($hpid);
                            $acctdomain=getplanoninvoice($invoice);        
                            //
                            $host = "localhost";
                            $user = "root";
                            $usessl = 0;
                            $acctdomain = "demonichosting.com";
                            $accesshash = 'accesshash here';
                            require '/usr/local/cpanel/Cpanel/Accounting.php.inc';
                            $status = createacct($host,$user,$pass,$accesshash,$usessl,$acctdomain,$acctuser,$acctpass,$acctplan);
                            print $status;
                            echo "Result is";
                            echo $result;
                            //
                        }
                        //
                    }
                    else
                    {
                        ?>
                        <fieldset>
                        <legend>Before You Continue with your Order please Enter your Cpanel Login Information below.</legend>
                        <table>
                        <form method="post" action="">
                                <tr>
                                    <th>Cpanel username</th>
                                    <th><input type="text" name="cpuser" maxlength="8" /></th>
                                </tr>
                                <tr>
                                    <th>Cpanel Password:</th>
                                    <th><input type="password" name="cppass" /></th>
                                </tr>
                                <tr>
                                    <th><input type="submit" value="Generate Account" name="GetAccount" /></th>
                                </tr>
                                </table></form>    
                        </fieldset>                
                    <?
                    }
                }
    What am i doing wrong anything else i can do to make it autoamtically create the account?
     
  2. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    You may want to use the more robust XML-API in favor of the old WHM API. However, typically a login form means that the script is not properly authenticating. That cpanelerror message goes beyond my technical knowledge though.
     
    #2 cPanelDavidG, May 9, 2008
    Last edited: May 14, 2008
  3. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,458
    Likes Received:
    22
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator

    Please post the exact error message being returned. Also, what is your full cPanel version number?
     
  4. kalipiev

    kalipiev Member

    Joined:
    Feb 12, 2008
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    1
    Hello all,

    I have problem with account creation too. It's not same with this one but I don't want to open another thread. I have some problems with scripts account creation. When I use root password I succeed to create the account but I don't get response from server that the account has been made.(result, ip & response are empty). Also the account is created with package 'default' but not with that I put in the script URL?
    I am not very sure but I think that root can create accounts only with default package and cannot do it with reseller_whatever.

    Please assist me.

    Cheers!
     
  5. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Does the same thing happen you try to create an account using a package owned by root?
     
  6. kalipiev

    kalipiev Member

    Joined:
    Feb 12, 2008
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    1
    Yes, same thing with package owned by root. This time I get another error:
    0 Sorry that username (XXXXXX) is taken. Check /etc/passwd

    But the account is created with default package.

    Please help.

    Cheers!
     
  7. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,458
    Likes Received:
    22
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    What is the exact url you use to create an account?
     
  8. kalipiev

    kalipiev Member

    Joined:
    Feb 12, 2008
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    1
  9. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,458
    Likes Received:
    22
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
  10. kalipiev

    kalipiev Member

    Joined:
    Feb 12, 2008
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    1
    Thanks. That seems to work.

    Would you please give me a link where I can find information for all the arguments?

    Cheers
     
  11. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,458
    Likes Received:
    22
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
  12. kalipiev

    kalipiev Member

    Joined:
    Feb 12, 2008
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    1
    Just last question:

    I am very sure that it works before with msel? Why it's not working now? Due to upgrade reasons or anything else?

    Will plan argument work with older cpanel/WHM versions?

    Best regards.
     
  13. kalipiev

    kalipiev Member

    Joined:
    Feb 12, 2008
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    1
    Is there anybody who can answer my questions?

    I am very sure that it works before with msel? Why it's not working now? Due to upgrade reasons or anything else?

    Will plan argument work with older cpanel/WHM versions?

    Cheers
     
  14. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Calling :2086/scripts and :2086/scripts2 are not recommended and are subject to breaking as these are not APIs.

    If you wish to create accounts programmatically, please use the XML-API as Kenneth suggested.
     
  15. kalipiev

    kalipiev Member

    Joined:
    Feb 12, 2008
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    1
    Hello again,

    I have another issue with account creation. I am using this code
    PHP:
    $whm_url  $this->proto $this->whm_user ":" $this->whm_password "@" $this->whm_server ":" $this->whm_port "/scripts/wwwacct?" $string;
    ob_start();
    $response join(""file($whm_url));
    ob_end_clean();
    $whm_url is the correct URL. I tried to run it in my browser and it works fine, but through PHP I can't get server response.
    I mean var_dump($response); returns bool(false).

    Any suggestions?

    Cheers,
     
  16. kalipiev

    kalipiev Member

    Joined:
    Feb 12, 2008
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    1
    I forget to mention I am unable to use XML-API.
     
  17. kalipiev

    kalipiev Member

    Joined:
    Feb 12, 2008
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    1
    Anybody who can help me?
     
  18. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    That's odd. If you are using cPanel 11 and have access to WHM, you should be able to use the XML-API.
     
  19. kalipiev

    kalipiev Member

    Joined:
    Feb 12, 2008
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    1

    Did you read this post?
     
  20. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    I would advise against calling anything in :208x/scripts or :208x/scripts2 directly as the syntax for that can change unexpectedly as that is not an API.
     
Loading...

Share This Page