1

I am trying to create reseller account in directadmin in PHP using a pre-made package, but it doesnt work.. I have used my admin account.

I dont have any problems to create user account:

include 'httpsocket.php';

$server_ip="ip"; //IP that User is assigned to
$server_login="admin";
$server_pass="mypass"";
$server_host="ip"; //where the API connects to
$server_ssl="Y";
$server_port=2222;

$username='username'
$domain='domain.com'
$email='email@email.com'
$pass='pass'
$package='package'


echo "Creating user $username on $server_ip.... <br>\n";

$sock = new HTTPSocket;
if ($server_ssl == 'Y')
{
    $sock->connect("ssl://".$server_host, $server_port);
}
else
{ 
    $sock->connect($server_host, $server_port);
}

$sock->set_login($server_login,$server_pass);

$sock->query('/CMD_ACCOUNT_RESELLER',
    array(
        'action' => 'create',
        'add' => 'Submit',
        'username' => $username,
        'email' => $email,
        'passwd' => $pass,
        'passwd2' => $pass,
        'domain' => $domain,
        'package' => $package,
        'ip' => $server_ip,
        'notify' => 'yes'
    ));

$result = $sock->fetch_parsed_body();

if ($result['error'] != "0")
{
    echo "<b>Error Creating user $username on server $server_ip:<br>\n";
    echo $result['text']."<br>\n";
    echo $result['details']."<br></b>\n";
}
else
{
    echo "User $username created on server $server_ip<br>\n";
}

exit(0);
Billal Begueradj
  • 20,717
  • 43
  • 112
  • 130
  • I see various syntax errors - [are you seeing error messages](http://stackoverflow.com/questions/1053424/how-do-i-get-php-errors-to-display)? – HPierce Jan 31 '17 at 16:38
  • "I dont have any problems" If the code you've shown *is* working then there's nothing for us to off of here. Either way, we need more information to help here. Please [edit] adding any error messages you're seeing, and the expected result from running this code ("doesn't work" isn't specific enough). VTC. – HPierce Jan 31 '17 at 16:46
  • When you say it doesn't work you should see error. Please run DA in debug mode you will what would be the error. – MaXi32 Jan 03 '21 at 13:11

0 Answers0