Jump to content

DirectAdmin hosting usage detail


welch

Recommended Posts

**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]

Link to comment
Share on other sites

  • 2 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated