CPanel : Account Creation Module (Remote Access Key)

Status
Not open for further replies.

sav

Member
Oct 15, 2002
11
0
151
[quote:08ece7446f][i:08ece7446f]Originally posted by anarckie[/i:08ece7446f]
Make sense? :) [/quote:08ece7446f]
Yes. Right [i:08ece7446f]now[/i:08ece7446f] ;)
I'm going to test it on my own domain ;)
Will see.. :p
 

anarckie

Member
Jul 10, 2002
13
0
151
Great, thanks a lot.

I have everything working fine, it even sends the email out to the user, but its not complete without the IP address ;)
 

xnull

Well-Known Member
Sep 9, 2001
156
0
316
How do you get the remote access key? I can't even access the cpanel script through my web script because i don't know where to get our server's key or how to use it in the php script.
 

sav

Member
Oct 15, 2002
11
0
151
[quote:ee5a31c652][i:ee5a31c652]Originally posted by xnull[/i:ee5a31c652]How do you get the remote access key?[/quote:ee5a31c652][
By hands ;) : http://www.yourdomain.com:2086/scripts/setrhash
Than copy'n'paste it to your script source code.
 

sav

Member
Oct 15, 2002
11
0
151
[quote:48cd7d32b2][i:48cd7d32b2]Originally posted by xnull[/i:48cd7d32b2]How do you get the remote access key?[/quote:48cd7d32b2][
By hands ;) : http://www.yourdomain.com:2086/scripts/setrhash
Than copy'n'paste it to your script source code.

2All: I find that createscct() WHM API function don't returned any data - does anybody tried to use WHM scripts for account creation?
I think it should be much more easy to parse binary script html output with full data you need :)

2nd: createscct() creates account with [b:48cd7d32b2]shared[/b:48cd7d32b2] IP so don't worry about how to get your new account's IP ;D ;)
 

spinnaweb

Registered
Apr 29, 2002
3
0
301
I myself have tried using the php version for integration and ran into a roadblock (I think) with whmreq().

Needs php compiled with --enable-sockets OR curl to work using the prebuilt functions.

I am completely rewriting a system to integrate with the WHM for a project I am working on. I will try to keep any interested party posted on progress.

Thanks.
 

powerhouse

Well-Known Member
Nov 5, 2001
93
0
306
Ok
Man this sounds SO complex in PHP. I do it in Perl, in it's SO SIMPLE.

To get the IP address, first you must know if the package your creating DOES create it with an IP, if it DOES then do get it from here, BEFORE you create the package:

Here is the code in Perl:
my $path_to_ips = '/etc/ipaddrpool'; # That is where they are.
open(IPS,&$path_to_ips&) or dienice(&Can't open $path_to_ips for Reading: $!&); # Open it. Or die.
seek(IPS,0,0); # find the FIRST line of the file to start.
flock(IPS,2);# Lock the file.
$thisip = &IPS&;# Get the FIRST LINE ONLY
chomp($thisip);# Kill the rest.
close(IPS);# close the file.


$thisip is now the very first IP address in the file, which is the one the Cpanel system grabs when creating an account WITH an IP address. I'd do this ALL AT THE SAME TIME, when your creating an account that way the user don't sit there a while, someone else sign up, and then they have the wrong IP address.
If it gets it AS it is creating the account, you should never have a problem with it giving the wrong IP address.

If that gives you problems, I know of one other way to do it, I THINK.

HTH,
Richard.

Sorry, had to disable the smilies- only editting I did.
 

rochen

Active Member
PartnerNOC
Mar 5, 2002
33
0
306
I have a system setup with the accounting module which is done in PHP and does the following:

1. Adds the hosting account using PHP and gives confirmation
2. Adds the users account to Perl Desk using the same user/pass as the hosting account
3. Sends the user a welcome email
4. Displays confirmation
 

ThermoDust

Member
Oct 27, 2002
7
0
151
Hello, I'm having alittle problem with the setup. For the package name do you just put what you names the package? Caues I have it do

$acctdomain = &testdomain.tribes-hosting.com&;
$acctuser = &username&;
$acctpass = &pass&;
$acctplan = &Basic - Free&;
createacct ($host,$user,$accesshash,$usessl,$acctdomain,$acctuser,$acctpass,$acctplan);

But that does not work, anyone have an idea on why it makes the account but none of the settings are filling in like space and bandwidth?

Its like the package isnt even seen or read.
 

aral

Registered
Sep 27, 2002
1
0
151
I am running into similar problems. The most important is that there is no documentation on what the wwwacct script will accept as input from a remote request.

I'm trying to pass it a query string (via CURL/PHP). The error I'm getting is just: &WWWAcct 5.0 by J. Nick Koston Please use the this syntax wwwacct& (that's it, nothing on what the syntax should be.)

Is it even possible to use remote requests without packages (ie., pass in the quota, domain, etc. in the query string just like the interface does?)

Also, is there any documentation for the API?

Thanks!
Aral
 

Juanra

Well-Known Member
Sep 22, 2001
777
0
316
Spain
[quote:a8b6f0b231][i:a8b6f0b231]Originally posted by aral[/i:a8b6f0b231]
I'm trying to pass it a query string (via CURL/PHP). The error I'm getting is just: &WWWAcct 5.0 by J. Nick Koston Please use the this syntax wwwacct& (that's it, nothing on what the syntax should be.) [/quote:a8b6f0b231]

Is that output on a web page?
 

kahoz

Well-Known Member
Nov 7, 2003
78
0
156
Portugal
Juanra said:
[quote:a8b6f0b231][i:a8b6f0b231]Originally posted by aral[/i:a8b6f0b231]
I'm trying to pass it a query string (via CURL/PHP). The error I'm getting is just: &WWWAcct 5.0 by J. Nick Koston Please use the this syntax wwwacct& (that's it, nothing on what the syntax should be.) [/quote:a8b6f0b231]

Is that output on a web page?
i'm getting a similar error.. :rolleyes:

WWWAcct 9.2 (c) 1997-2004 cPanel, Inc. Please use the this syntax wwwacct
Account Creation Complete!!!
could any one help me on this ?

its the output from createacct..

PHP:
function createacct ($host,$user,$accesshash,$usessl,$acctdomain,$acctuser,$acctpass,$acctplan) {
	$result = whmreq("/scripts/wwwacct?remote=1&nohtml=1&username=${acctuser}&password=${acctpass}&domain=${acctdomain}&plan=${acctplan}",$host,$user,$accesshash,$usessl);
	if ($cpanelaccterr != "") { return; }
	$h=fopen(ROOTDIR."cpanel_output.html", "w");
	fputs($h, $result);	
	return $result;
}
thanks in advance.


---------

EDIT:

case solved.. i don't know how, it's solved :P
 
Last edited:
Status
Not open for further replies.