PDA

View Full Version : CMD_API_ACCOUNT_USER has a bug!



KKerstjens
07-26-2005, 05:40 AM
Hi everyone,

I'm developing a Information System for internal use in a compnay with PHP(5.0.4). I want to create a user from this system to de DirectAdmin server.

I use the following command to create this user: CMD_API_ACCOUNT_USER

The code looks-like:

$arrtest = array(
'action' => 'create',
'username' => 'bb2009',
'email' => $_POST['email'],
'passwd' => $_POST['passwd'],
'passwd2' => $_POST['passwd'],
'domain' => 'bb2009.mybb4you.nl',
'package' => $package['list'][0],
'ip' => $hostsettings['reseller_ip'],
'notify' => 'no'
);
print_r($arrtest);
$sock->query('/CMD_API_ACCOUNT_USER', $arrtest );


And the user has been created on the DirectAddmin server. But when i look in DirectAdmin is see the following information.

Name Bandwidth Disk Usage # of Domains Suspended IP Domain(s)
bb2009 0.0 / 0.0 0.0 / 0.0 1 / 0 No 193.43.150.243 bb2009.mybb4you.nl

So as you can see, he doesn't get the right package ($package['list'][0]). $package['list'][0] gets his value of the following CMD command
$sock->query('/CMD_API_PACKAGES_USER');
$package = $sock->fetch_parsed_body();

And is filled with the package name. What he gets of DirectAdmin.

If I do print_r($arrtest) I see:


Array
(
[action] => create
[username] => bb2009
=> [email]info@xxxx.nl
[passwd] => edr3F5d
[passwd2] => edr3F5d
[domain] => bb2009.mybb4you.nl
[package] => 20mbpackage
[ip] => xxx.xxx.xxx.xxx
[notify] => no
)

So the user is created, but with NO or the worng existing package.

Is this a bugs of the CMD_API_ACCOUNT_USER command, or did I forgot something.

DirectAdmin Support
07-27-2005, 09:45 PM
Hello,

Double check that $package['list'][0] actually contains a value. The code for this API command is the exact same code used for the creation with the normal browser.. so all values are the same for both methods. If $package['list'][0] was blank, then no package is used, and the User is created in the default state (limits of 0 etc).

Also try creating the user with that package via browser to make sure the package is setup correctly.

This is one of the first API commands, and has been tested/used by many.. so if there is a bug, it hasn't been noticed for several years ;)

John

KKerstjens
07-28-2005, 12:06 AM
Originally posted by DirectAdmin Support
Hello,

Double check that $package['list'][0] actually contains a value. The code for this API command is the exact same code used for the creation with the normal browser.. so all values are the same for both methods. If $package['list'][0] was blank, then no package is used, and the User is created in the default state (limits of 0 etc).

Also try creating the user with that package via browser to make sure the package is setup correctly.

This is one of the first API commands, and has been tested/used by many.. so if there is a bug, it hasn't been noticed for several years ;)

John

Actually i did test the value of the $package['list'][0] and that has been filled with the one and only package I created for that reseller.

I also did create several users with this package, and these users has been creted perfectly, with the right package.

-------

What should I do now? All used values are filled, with the right information.

KKerstjens
07-28-2005, 02:01 AM
I solved the problem ;-)

I was forgotten the array value 'add' => 'Submit',