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.

Accounting.inc.php Functions AND Definitions

Discussion in 'General Discussion' started by Brett19, Mar 29, 2004.

  1. Brett19

    Brett19 Registered

    Joined:
    Mar 29, 2004
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    I was wondering what params the php accounting functions have and also if there are also any over what is in the documentation. I have heard of a "whmreq"??
     
  2. elleryjh

    elleryjh Well-Known Member

    Joined:
    Apr 12, 2003
    Messages:
    479
    Likes Received:
    0
    Trophy Points:
    16
    Look in the accounting.inc.php file. It's just what's in the docs, but you can make your own functions by looking at the current ones and the way whm works.
     
  3. Brett19

    Brett19 Registered

    Joined:
    Mar 29, 2004
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    I cannot access my Accounting.inc.php I can only include it...
     
  4. elleryjh

    elleryjh Well-Known Member

    Joined:
    Apr 12, 2003
    Messages:
    479
    Likes Received:
    0
    Trophy Points:
    16
    I think it's ok to post this here. If anyone thinks I should remove it, let me know.

    PHP:
    <?php
    # cpanel4 - Accounting.php.inc              Copyright(c) 1999-2002 John N. Koston
    #                                 All rights Reserved.
    # [email]nick@cpanel.net[/email]              [url]http://cpanel.net[/url]
    #
    # This file is governed by the cPanel license


    global $cpanelaccterr;


    function 
    suspend ($host,$user,$accesshash,$usessl,$suspenduser) {
            
    $result whmreq("/scripts/remote_suspend?user=${suspenduser}",$host,$user,$accesshash,$usessl);
            if (
    $cpanelaccterr != "") { return; }
            return 
    $result;
    }
    function 
    unsuspend ($host,$user,$accesshash,$usessl,$suspenduser) {
            
    $result whmreq("/scripts/remote_unsuspend?user=${suspenduser}",$host,$user,$accesshash,$usessl);
            if (
    $cpanelaccterr != "") { return; }
            return 
    $result;
    }
    function 
    killacct ($host,$user,$accesshash,$usessl,$killuser) {
            
    $result whmreq("/scripts/killacct?user=${killuser}&nohtml=1",$host,$user,$accesshash,$usessl);
            if (
    $cpanelaccterr != "") { return; }
            return 
    $result;
    }
    function 
    showversion ($host,$user,$accesshash,$usessl) {
            
    $result whmreq("/scripts2/showversion",$host,$user,$accesshash,$usessl);
            if (
    $cpanelaccterr != "") { return; }
            return 
    $result;
    }
    function 
    createacct ($host,$user,$accesshash,$usessl,$acctdomain,$acctuser,$acctpass,$acctplan) {
            
    $result whmreq("/scripts/wwwacct?remote=1&nohtml=1&username=${acctuser}&password=${acctpass}&domain=${acctdomain}&plan=${acctplan}",$host,$user,$accesshash,$usessl);
            if (
    $cpanelaccterr != "") { return; }
            return 
    $result;
    }

    function 
    listaccts ($host,$user,$accesshash,$usessl) {
            
    $result whmreq("/scripts2/listaccts?nohtml=1&viewall=1",$host,$user,$accesshash,$usessl);
            if (
    $cpanelaccterr != "") { return; }

            
    $page split("\n",$result);
            foreach (
    $page as $line) {
                    list(
    $acct,$contents) = split("="$line);
                    if (
    $acct != "") {
                            
    $allc split(","$contents);
                            
    $accts[$acct] = $allc;
                    }
            }
            return(
    $accts);
    }
    function 
    listpkgs ($host,$user,$accesshash,$usessl) {
            
    $result whmreq("/scripts/remote_listpkg",$host,$user,$accesshash,$usessl);
            if (
    $cpanelaccterr != "") { return; }


            
    $page split("\n",$result);
            foreach (
    $page as $line) {
                    list(
    $pkg,$contents) = split("="$line);
                    if (
    $pkg != "") {
                            
    $allc split(","$contents);
                            
    $pkgs[$pkg] = $allc;
                    }
            }
            return(
    $pkgs);
    }
    function 
    whmreq ($request,$host,$user,$accesshash,$usessl) {

    //Not including code here because I don't think it's necessesary.  It should be obvious how this functinon works.

    }

     
  5. rminchrist

    rminchrist Member

    Joined:
    Dec 13, 2004
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Nairobi - Kenya
    Hello

    Is there, or are there functions that relate to email account creation, subdomain creation in the Accounting.inc.php? (I want to create a webpage that allows users to signup for new email accounts)

    Regards
     
  6. elleryjh

    elleryjh Well-Known Member

    Joined:
    Apr 12, 2003
    Messages:
    479
    Likes Received:
    0
    Trophy Points:
    16
    Accounting module only works with WHM, not cpanel. Those functions are cpanel functions, not WHM so you can't use it.

    There is a way to automate it with a custom php script by connecting to cpanel. I can write one for you for a fee - PM me with details if you're interested.
     
  7. rminchrist

    rminchrist Member

    Joined:
    Dec 13, 2004
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Nairobi - Kenya
    I can create email addresses by simply sending the same variables to the action file called when creating new emails in cPanel, and so also subdomains. Thanks for your offer elleryjh.

    I just wanted to know if there were functions that has to do with emails, subdomains etc.
     
  8. Tapan

    Tapan Well-Known Member

    Joined:
    Dec 4, 2004
    Messages:
    109
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Chandigarh
    Need help with building scripts...

    Hello,

    I need to automate 3 simple tasks for WHM.

    1. Suspend Account
    2. Un-suspend Account
    3. Terminate Account

    Can someone tell me how do i start on this ? I would just be able to provide username and select weather to suspend, unsuspend or terminate the account and it should get done.

    Please help me.

    Thanks.
     
Loading...

Share This Page