The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

CPanel : Account Creation Module (Remote Access Key)

Discussion in 'General Discussion' started by rochen, Aug 6, 2002.

Thread Status:
Not open for further replies.
  1. rochen

    rochen Active Member
    PartnerNOC

    Joined:
    Mar 5, 2002
    Messages:
    33
    Likes Received:
    0
    Trophy Points:
    6
    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 :)
     
  2. jimcarter

    jimcarter Well-Known Member

    Joined:
    Jun 30, 2002
    Messages:
    152
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    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 :)
     
  3. rochen

    rochen Active Member
    PartnerNOC

    Joined:
    Mar 5, 2002
    Messages:
    33
    Likes Received:
    0
    Trophy Points:
    6
    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.
     
  4. jimcarter

    jimcarter Well-Known Member

    Joined:
    Jun 30, 2002
    Messages:
    152
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    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
     
  5. rochen

    rochen Active Member
    PartnerNOC

    Joined:
    Mar 5, 2002
    Messages:
    33
    Likes Received:
    0
    Trophy Points:
    6
    Yeah, I have done that, IP Address is set to &No&.
     
  6. jimcarter

    jimcarter Well-Known Member

    Joined:
    Jun 30, 2002
    Messages:
    152
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    UK
    really not sure then sorry, you will have to email your hosting company for support
     
  7. mort

    mort Registered

    Joined:
    Jun 26, 2002
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    [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
     
  8. rochen

    rochen Active Member
    PartnerNOC

    Joined:
    Mar 5, 2002
    Messages:
    33
    Likes Received:
    0
    Trophy Points:
    6
    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 :)
     
  9. mort

    mort Registered

    Joined:
    Jun 26, 2002
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    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.
     
  10. jimcarter

    jimcarter Well-Known Member

    Joined:
    Jun 30, 2002
    Messages:
    152
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    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 :)
     
  11. rochen

    rochen Active Member
    PartnerNOC

    Joined:
    Mar 5, 2002
    Messages:
    33
    Likes Received:
    0
    Trophy Points:
    6
    Jim - Does your script work for you?
     
  12. mort

    mort Registered

    Joined:
    Jun 26, 2002
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    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));
     
  13. rochen

    rochen Active Member
    PartnerNOC

    Joined:
    Mar 5, 2002
    Messages:
    33
    Likes Received:
    0
    Trophy Points:
    6
    How did you get round the problem of the &Unable to obtain IP& ?
     
  14. jimcarter

    jimcarter Well-Known Member

    Joined:
    Jun 30, 2002
    Messages:
    152
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    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 :)
     
  15. mort

    mort Registered

    Joined:
    Jun 26, 2002
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    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.
     
  16. xnull

    xnull Well-Known Member

    Joined:
    Sep 9, 2001
    Messages:
    156
    Likes Received:
    0
    Trophy Points:
    16
    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.
     
  17. sav

    sav Member

    Joined:
    Oct 15, 2002
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    [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] ;)
     
  18. anarckie

    anarckie Member

    Joined:
    Jul 10, 2002
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    1
    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?
     
  19. sav

    sav Member

    Joined:
    Oct 15, 2002
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    [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
     
  20. anarckie

    anarckie Member

    Joined:
    Jul 10, 2002
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    1
    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? :)
     
Loading...
Thread Status:
Not open for further replies.

Share This Page