PDA

View Full Version : Fields like CGI/PHP/Anonymous FTP not passed



Woet
10-31-2009, 11:46 PM
I'm using this code:



$sock->query('/CMD_API_ACCOUNT_USER',
array(
'action' => 'create',
'add' => 'Submit',
'username' => $value['clientUsername'],
'email' => $value['clientEmail'],
'passwd' => $password,
'passwd2' => $password,
'domain' => $data['domain'],
'bandwidth' => $data['bandwidth'],
'quota' => $data['diskspace'],

'uvdomains' => 'on',
'unsubdomains' => 'on',
'unemails' => 'on',
'unemailf' => 'on',
'unemailml' => 'on',
'unemailr' => 'on',
'umysql' => 'on',
'udomainptr' => 'on',
'uftp' => 'on',
'aftp' => 'on',
'cgi' => 'on',
'php' => 'on',
'spam' => 'on',
'cron' => 'on',
'catchall' => 'on',
'suspend_at_limit' => 'on',
'skin' => 'serverFFS'

'ip' => $dedi,
'notify' => 'no'
));


The problem is, these options are not actually enabled:


'uftp' => 'on',
'aftp' => 'on',
'cgi' => 'on',
'php' => 'on',
'spam' => 'on',
'cron' => 'on',
'catchall' => 'on',
'suspend_at_limit' => 'on',


Am I doing something wrong?

DirectAdmin Support
11-01-2009, 03:26 PM
Hello,

It comes down to how a browser sends the data from a form. Our job with the API is to match what the browser sends.

The way a "checkbox" works with a browser, is that when it's checked (enabled) it's name and value are passed.

However, if a checkbox is not enabled (unchecked) then that name is not passed at all. This is how checkboxes work (don't ask me why the do it that way).

So to duplicate that with the API, if you want something that uses a checkbox to be disabled, then you must not pass it to DA at all. No name, no value, nothing.

This is rather quirky, but it's the nature of checkboxes and how they're transmitted by browsers.

John

Woet
11-01-2009, 09:42 PM
But I want them enabled!

DirectAdmin Support
11-01-2009, 10:12 PM
It's case sensitive.

1) pass them normally.

2) use "ON" instead of "on".

John