Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
EHCP API Help needed
#1
Hello

I want to make use of the EHCP API, however im having some trouble with it.

Im trying to use one of the default api examples, namely api2.php:

Heres the code it has:

<code>
require("../classapp.php");
$domainname = "d2omainsite.com";
$panelusername = "blabla";
$ftppassword=$paneluserpass="123";
$ftpusername = "ftpusername2";
$status="active";

$app = new Application();
$app->connectTodb(); # fill config.php with db user/pass for things to work..
$app->activeuser=$panelusername;

$ret=$app->addDomainDirect($domainname,$panelusername,$paneluserpass,$ftpusername,$ftppassword,$status,$email='',$quota=0);

if($ret){
&nbsp;&nbsp;&nbsp;echo "Success";
} else {
&nbsp;&nbsp;&nbsp;echo $app->output;
}

echo "($ret)";
</code>

My problem is that the above code returns and error that the user "blabla" is not active:

<code>
Error:User is not active..: blabla (Your account not active,contact your panel service provider, status: )

If you just upgraded your ehcp, try to logout, login back.
</code>

It is true that the user is not active, but am i completely missing something, when my thought was the script was supposed to create the user? Or do i use it wrong?

Oh and config.php is holding the correct db information..

Restored from old drupal forum, for user uid:27840 username:djda9l
You may reset your password to access your new account here.
Reply
#2
the command "addDomainDirect" in that api, "adds/setups domain in an 'existing paneluser'".

So, you should add/setup the user before adding domain, in similar way:


<code>
$app->activeuser="admin"
$app->addPanelUserDirect($panelusername,$paneluserpass,1,0,0,0,0,10000,'',$email,"active");
$ret=$app->addDomainDirect($domainname,$panelusername,$paneluserpass,$ftpusername,$ftppassword,$status,$email='',$quota=0);
if($ret){
echo "Success";
} else {
echo $app->output;
}
</code>

The panelusername parameter in addDomainDirect is used to set the "owner" of new domain, not for adding paneluser.
But, I accept your case like a "feature request" and will add an all-in-one command next time.
Thank you for you inspiration.



Restored from old drupal forum, for user uid:27840 username:djda9l
You may reset your password to access your new account here.
Reply
#3
Thanks for your assistance!

I tried you code, but then i get another error, actually the direct opposite as before : "panelusername already exists: blabla"

It should be mentioned that i have already tried with an existing user, before you wrote the first time, which gave me the same error.

Heres my code for reference, i believe it should be working as per what you wrote earlier:

require("../classapp.php");
$domainname = "d2omainsite.com";
$panelusername = "blabla";
$ftppassword=$paneluserpass="123";
$ftpusername = "ftpusername2";
$status="active";
$email="";

$app = new Application();
$app->connectTodb(); # fill config.php with db user/pass for things to work..
$app->activeuser="admin";

$app->addPanelUserDirect($panelusername,$paneluserpass,1,0,0,0,0,10000,'',$email,$status);
$ret=$app->addDomainDirect($domainname,$panelusername,$paneluserpass,$ftpusername,$ftppassword,$status,$email='',$quota=0);

if($ret){
echo "Success";
} else {
echo $app->output;
}

echo "($ret)";

Restored from old drupal forum, for user uid:1 username:ehcpdeveloper
You may reset your password to access your new account here.
Reply
#4
Oh and as for the above i have checked that the user do not exist when the script is run. I can also see that the script has success on creating the user, but that the addDomainDirect function fails to use it for some reason with the above message

Restored from old drupal forum, for user uid:27840 username:djda9l
You may reset your password to access your new account here.
Reply
#5
I will check this and fix if anything wrong.

Restored from old drupal forum, for user uid:27840 username:djda9l
You may reset your password to access your new account here.
Reply
#6
If you do not find any bugs, please let me know so i can look further into my own code

Restored from old drupal forum, for user uid:1 username:ehcpdeveloper
You may reset your password to access your new account here.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)

Online Shopping App
Online Shopping - E-Commerce Platform
Online Shopping - E-Commerce Platform
Feinunze Schmuck Jewelery Online Shopping