Web Hosting Talk







View Full Version : WHM Create Account


switch006
07-14-2004, 06:08 AM
I have this


<?php
require '/usr/local/cpanel/Cpanel/Accounting.php.inc';

$key = "mykeyhere";

$silver = "lukemce1_vmailsilver";
$gold = "lukemce1_vmailgold";
$user = "lukemce1";


function createbronze($acctDomain, $acctUser, $acctPass)
{
global $key;

$result = createacct("localhost", "lukemce1", $key, 0, $acctDomain, $acctUser, $acctPass, "lukemce1_vmailbronze");
if (!empty($result) ) {
echo "Created";
}
else echo "Not created";
}

createbronze("testdomain", "someusername", "somepass");
print_r(listaccts("localhost", "lukemce1", $key, 0));
?>


It echo's Creatd, but the account is not created when it prints them, or when i view in WHM. :(

Am i using the correct parameters etc, ie user IS the name i log into via mydomain.com/whm ?

Thanks :)

switch006
07-14-2004, 06:33 AM
Ok, seems to work now, no idea why! lol

Burhan
07-14-2004, 06:37 AM
You have to check what it returned. It could return an error, and still echo "Created" the way your script is desgined.

$result will contain something even if the account didn't get created.

switch006
07-14-2004, 06:54 AM
Oh, username was too long. I found out by doing echo $result and it told me it was too long :)