Accounting.inc.php Functions AND Definitions

Brett19

Registered
Mar 29, 2004
2
0
151
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"??
 

elleryjh

Well-Known Member
Apr 12, 2003
475
0
166
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.
 

elleryjh

Well-Known Member
Apr 12, 2003
475
0
166
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][email protected][/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.

}
 

rminchrist

Member
Dec 13, 2004
10
0
151
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
 

elleryjh

Well-Known Member
Apr 12, 2003
475
0
166
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.
 

rminchrist

Member
Dec 13, 2004
10
0
151
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.
 

Tapan

Well-Known Member
Dec 4, 2004
108
0
166
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.