PDA

View Full Version : DirectAdmin hosting usage detail



welch
01-26-07, 10:20 PM
**Updated for WHMCS V3**

I noticed why customizing my billing system that there was a cpanel usage information based on the hosting account details. Well, what a better time to make one for directadmin. Feel free to customize and work with it any way you need.

Please add this to your clientareaproductdetails.tpl file.




{php}

global $smarty;
$username = $smarty->get_template_vars('username');

$sock = new HTTPSocket;
$sock->connect('domain',2222);
$sock->set_login("admin","*******");
$sock->set_method('GET');


/************************************************** *********/
/* This is where we get what they are currently using */
/************************************************** *********/
$sock->query('/CMD_API_SHOW_USER_USAGE',
array(
'user' => "$username",
));

$str = $sock->fetch_body();
parse_str($str, $output);
/************************************************** *********/
/* End lookup of resources used */
/************************************************** *********/


/************************************************** *********/
/* This is where we get what resources they are limited to */
/************************************************** *********/

$sock->query('/CMD_API_SHOW_USER_CONFIG',
array(
'user' => "$username",
));

$str1 = $sock->fetch_body();
parse_str($str1, $output1);
/************************************************** *********/
/* End lookup of resources alloted */
/************************************************** *********/





echo "<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" id=\"resourcetable\">";
echo " <tr>";
echo " <td>Bandwidth in MB: </td>";
echo " <td>" . $output['bandwidth'] . " / " . $output1['bandwidth'] . "</td>";
echo " </tr>";
echo " <tr>";
echo " <td>Disk Space used in MB: </td>";
echo " <td>" . $output['quota'] . " / " . $output1['quota'] . "</td>";
echo " </tr>";
echo " <tr>";
echo " <td>Domain pointers: </td>";
echo " <td>" . $output['domainptr'] . " / " . $output1['domainptr'] . "</td>";
echo " </tr>";
echo " <tr>";
echo " <td>FTP Accounts: </td>";
echo " <td>" . $output['ftp'] . " / " . $output1['ftp'] . "</td>";
echo " </tr>";
echo " <tr>";
echo " <td>MySQL Databases: </td>";
echo " <td>" . $output['mysql'] . " / " . $output1['mysql'] . "</td>";
echo " </tr>";
echo " <tr>";
echo " <td>Email Forwarders: </td>";
echo " <td>" . $output['nemailf'] . " / " . $output1['nemailf'] . "</td>";
echo " </tr>";
echo " <tr>";
echo " <td>Mailing Lists: </td>";
echo " <td>" . $output['nemailml'] . " / " . $output1['nemailml'] . "</td>";
echo " </tr>";
echo " <tr>";
echo " <td>Autoresponders: </td>";
echo " <td>" . $output['nemailr'] . " / " . $output1['nemailr'] . "</td>";
echo " </tr>";
echo " <tr>";
echo " <td>Email Accounts: </td>";
echo " <td>" . $output['nemails'] . " / " . $output1['nemails'] . "</td>";
echo " </tr>";
echo " <tr>";
echo " <td>Subdomains: </td>";
echo " <td>" . $output['nsubdomains'] . " / " . $output1['nsubdomains'] . "</td>";
echo " </tr>";
echo " <tr>";
echo " <td>Virtual Domains: </td>";
echo " <td>" . $output['vdomains'] . " / " . $output1['vdomains'] . "</td>";
echo " </tr>";
echo "</table>";
{/php}



**WARNING**
I am not responsible for mis-use and if you add more php, pleaes be carefull as the {php}{/php} tags are only necessary when needed.[/b]

EWH1
04-13-07, 06:39 PM
This current for 3.1.2?

welch
04-13-07, 10:41 PM
Yup, sure does.