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.

Creating Simple account form

Discussion in 'cPanel Developers' started by ukgaz, Jan 10, 2008.

  1. ukgaz

    ukgaz Member

    Joined:
    Aug 18, 2005
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    1
    Ok, im in the process of building a simple form to create accounts, however it doesnt seem to be forwarding it properly, and creating the accounts, i'm using the standard Accounts.php.inc file

    This is the form that submits the details

    Code:
    <html>
    <title>test</title>
    <body>
    <form name="form1" method="post" action="cpanel.php">
    Domain <input name="acctdomain" type="text" id="acctdomain" size="50"><br />
    Username <input name="acctuser" type="text" id="acctuser" size="50"><br />
    Password <input name="acctpass" type="text" id="acctpass" size="50"><br />
    Plan <input name="acctplan" type="text" id="acctplan" size="50"><br />
    <input type="submit" name="Submit" value="Submit">
    <input type="reset" name="Submit2" value="Reset">
    </form>
    </body>
    </html>
    
    The page that receives the details and forwards it onto the Accounts file

    Code:
    
    <?php
    error_reporting (E_ALL);
    require 'Accounting.php.inc';
    $host = "localhost";
    $user = "root";
    $accesshash = '[i]HASH[/i]';
    $usessl="1";
    
    createacct($host,$user,$accesshash,$usessl,$_POST['acctdomain'],$_POST['acctuser'],$_POST['acctpass'],$_POST['acctplan']);
    
    echo '$_POST['acctdomain'];$_POST['acctuser'];$_POST['acctpass'];$_POST['acctplan']';
    
    ?>
    
    Any ideas?
     
  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
    A few things could be going wrong:

    Any errors in the error_log file in that directory? Does it say something like accounting.php.inc does not exist?

    I'd recommending referencing the full path instead: /usr/local/cpanel/Cpanel/Accounting.php.inc

    I notice you are setting the use SSL parameter to 1. Is Curl with SSL installed on the server (not only "regular" Curl)? If not, this will not work with the parameter set to 1. You may wish to set it to 0 instead, especially if you're just accessing the local server rather than a remote server.

    Just a head's up that we now have an XML-based API available which is a bit more robust than the old accounting system from version 10. You can find documentation on this at: http://www.cpanel.net/plugins/devel
     
    #2 cPanelDavidG, Jan 10, 2008
    Last edited: Jan 10, 2008
  3. SNN

    SNN Well-Known Member

    Joined:
    Oct 5, 2007
    Messages:
    78
    Likes Received:
    0
    Trophy Points:
    6
    It looks like there would also be a PHP Error (Unexpected T_STRING).
    PHP:
    echo '$_POST['acctdomain'];$_POST['acctuser'];$_POST['acctpass'];$_POST['acctplan']';
    This (to what I believe) will work
    PHP:
    echo $_POST['acctdomain'].$_POST['acctuser'].$_POST['acctpass'].$_POST['acctplan'];
     
  4. ukgaz

    ukgaz Member

    Joined:
    Aug 18, 2005
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    1
    Seems to helped a lot, i didnt enable OpenBase_Dir aswell.

    It's creating the accounts however the following error came up

    Code:
    Notice: Undefined variable: cpanelaccterr in /usr/local/cpanel/Cpanel/Accounting.php.inc on line 34
    
     
  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
    Try omitting the line setting the error reporting settings and see what happens.
     
Loading...

Share This Page