CPanel : Account Creation Module (Remote Access Key)

Status
Not open for further replies.

rochen

Active Member
PartnerNOC
Mar 5, 2002
33
0
306
Has anyone had any luck getting this to work? I have successfully got it to list accounts, list packages etc. However, no matter what I have tried, for the life of me I can't get it to create new accounts. I am using the PHP version (not Perl). The command I am using is:

[quote:c3a155c06a]createacct ($host,$user,$accesshash,$acctdomain,$acctuser,$acctpass,$acctplan,$usessl,0);[/quote:c3a155c06a]

Is this correct? and secondly, if not what command should I be using?

No error is returned, it just doesn't make the account.

I have of course got all the variables such as &$acctdomain& set. I am just not sure if the command above is correct or not.

Any help would be appreciated :)
 

jimcarter

Well-Known Member
Jun 30, 2002
152
0
166
UK
the correct way to do it is:
createacct ($host,$user,$accesshash,$usessl,$acctdomain,$acctuser,$acctpass,$acctplan);
make sure that usernames dont have numbers or are longer than 8 characters, mail me if you have any other problems :)
 

rochen

Active Member
PartnerNOC
Mar 5, 2002
33
0
306
Thanks for your help, I got a bit further. However now I get the error &Unable to find a ip address&. When I create an account via WHM it works fine.
 

jimcarter

Well-Known Member
Jun 30, 2002
152
0
166
UK
ive never had this problem before, make sure that when creating your packages you have setup the IP address of an account on that package, i.e. whether it has its own IP address or is on the main server IP
 

mort

Registered
Jun 26, 2002
4
0
151
[quote:54877c9936][i:54877c9936]Originally posted by jimcarter[/i:54877c9936]

ive never had this problem before, make sure that when creating your packages you have setup the IP address of an account on that package, i.e. whether it has its own IP address or is on the main server IP[/quote:54877c9936]

I am having the same problem, by setup the IP address, I assume you just mean put a 'n' in the package string.

Could you either confirm this or post the createacct string that works for you.

Thanks
 

rochen

Active Member
PartnerNOC
Mar 5, 2002
33
0
306
I am not using the sting, what I have done is, setup a &package& via WHM, then where it asks you for the package you want to use, I have filled in &user_packagename&. When I used the package string it didn't work at all and returned errors such as &Unrecognised package& etc.

If anyone has any has ideas regarding this problem, I am open to suggestions :)
 

mort

Registered
Jun 26, 2002
4
0
151
Rochen,
My reply was actually intended for jim. I don't have the option to create packages, but even so I seem to have got stuck at the same point as you.
 

jimcarter

Well-Known Member
Jun 30, 2002
152
0
166
UK
I havent been able to find any documentation on this problem so far sorry,
the following is how I create my accounts through PHP:

require '/usr/local/cpanel/Cpanel/Accounting.php.inc';
$host = &localhost&;
$user = &username&;
$accesshash = &myaccesshash173644684&;

$usessl = &1&;

$acctdomain = &testdomain.com&;
$acctuser = &username&;
$acctpass = &pass&;
$acctplan = &user_Basic&;
createacct ($host,$user,$accesshash,$usessl,$acctdomain,$acctuser,$acctpass,$acctplan);


try doing this in a single script before you start doing it with variables posted in forms, let me know how you get on :)
 

mort

Registered
Jun 26, 2002
4
0
151
Thanks for getting back to me jim

I don't have the option to create packages, but I just ran it using one of the predefined packages and it worked.

Either I will have to try to figure out how to send the package string or use the work around of:

$response = join(&&, file(&http://& . $user . &@& . $whm_server . &:& . $whm_port . &/scripts/wwwacct?& . $request));
 

rochen

Active Member
PartnerNOC
Mar 5, 2002
33
0
306
How did you get round the problem of the &Unable to obtain IP& ?
 

jimcarter

Well-Known Member
Jun 30, 2002
152
0
166
UK
mort just managed to create a new account with the code what I just posted, also mort, to list the package names available you can just put in the following:

$pkgs = listpkgs($host,$user,$accesshash,$usessl);


foreach($pkgs as $key =& $value) {
print_r($key);
echo &&br&&;
}
that will list just the names
if you want the package details just use the following:-


$pkgs = listpkgs($host,$user,$accesshash,1);


$plan = &user_Basic&;

echo &&h4&Hosting Package Details&;
echo &&br&Package: $plan&br&IP Address: &.$pkgs[$plan][0].& &br&&;
echo &CGI Access: &.$pkgs[$plan][1].& &br&&;
echo &Web Space: &.$pkgs[$plan][2].& &br&&;
echo &Frontpage Extensions: &.$pkgs[$plan][3].& &br&&;
echo &Control Panel Theme: &.$pkgs[$plan][4].& &br&&;
echo &FTP Accounts: &.$pkgs[$plan][5].& &br&&;
echo &Databases: &.$pkgs[$plan][6].& &br&&;
echo &E-mail Accounts: &.$pkgs[$plan][7].& &br&&;
echo &E-mail Lists: &.$pkgs[$plan][8].& &br&&;
echo &Subdomains: &.$pkgs[$plan][9].& &br&&;
echo &Bandwith: &.$pkgs[$plan][10].& &br&&;
echo &SSH Shell: &.$pkgs[$plan][11].& &br&&;
echo &Parked Domains: &.$pkgs[$plan][12].& &br&&;
echo &Addon Domains: &.$pkgs[$plan][13].& &br&&;
hope this helps :)
 

mort

Registered
Jun 26, 2002
4
0
151
Thanks Jim,
It does work if I use the predefined packages, but I need to be able to use it with package strings, maybe it's just not designed to accept package strings.

Thanks for the posts anyway.
 

xnull

Well-Known Member
Sep 9, 2001
156
0
316
How are you using this key to have the script allow you to use this php file for cpanel accounting? And where do you get this key from? I've looked in the SSL section of WHM but am a bit lost.
 

sav

Member
Oct 15, 2002
11
0
151
[quote:fb301e085c][i:fb301e085c]Originally posted by xnull[/i:fb301e085c]And where do you get this key from? I've looked in the SSL section of WHM but am a bit lost.[/quote:fb301e085c]

In WHM: [b:fb301e085c]Server Setup--&Setup Remote Access Key[/b:fb301e085c] ;)
 

anarckie

Member
Jul 10, 2002
13
0
151
displaying ip

How would you be able to display the creation in thsi format:


+===================================+
| New Account Info |
+===================================+
| Domain: domain.com
| Ip: 555.555.555.55 (n)
| HasCgi: y
| UserName: username
| PassWord: password
| CpanelMod: vopanel
| HomeRoot: /home
| Quota: 50 Meg
| NameServer1: name.domain.com
| NameServer2: name2.domain.com
+===================================+


I think i can get everything other then the IP.

Any suggestions?
 

sav

Member
Oct 15, 2002
11
0
151
[quote:add53383d4][i:add53383d4]Originally posted by anarckie[/i:add53383d4]
How would you be able to display the creation in thsi format:
+===================================+
| New Account Info |
+===================================+
| Domain: domain.com
| Ip: 555.555.555.55 (n)
[/quote:add53383d4]
'[b:add53383d4](n)[/b:add53383d4]' means you [b:add53383d4]have not[/b:add53383d4] dedicated IP for this domain, yes?
[quote:add53383d4]
I think i can get everything other then the IP.[/quote:add53383d4]
But why?
1. I mean you have some Array() of strings of that output
2. loop Array()
3. find IP string:

if (strstr($Array[$i], '| Ip')) {
$ip = substr($Array[$i], 6);
}
if (substr($ip, -1, 3) == '(n)') {
//Don't have [b:add53383d4]dedicated[/b:add53383d4] IP!!!
} else {
$ip = substr($ip, 0, strlen($ip) - 3);
}
4. You have (or not ;) ) your IP in $ip
 

anarckie

Member
Jul 10, 2002
13
0
151
Not sure you understood what i meant.

After creating a new account through the php script, how does the user know what their IP address is?

Like IF it was a dedicated IP, how does the user know what that is?

I need to know if theres a way to display the IP of the account just created.

Make sense? :)
 
Status
Not open for further replies.