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.

Creating cPanel Access Script

Discussion in 'General Discussion' started by IMS, Oct 3, 2005.

  1. IMS

    IMS Member

    Joined:
    Mar 18, 2004
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    1
    I have a couple of questions. First, I'd like to make sure that it's possible to pass an array that I constructed as a package or if it has to be a package already created in cPanel and passed as just a string.

    (i.e. build the following array:
    $Advanced[0] => n
    $Advanced[1] => y
    $Advanced[2] => 100
    $Advanced[3] => n
    $Advanced[4] => x
    $Advanced[5] => unlimited
    $Advanced[6] => 5
    $Advanced[7] => 50
    $Advanced[8] => unlimited
    $Advanced[9] => unlimited
    $Advanced[10] => 2048
    $Advanced[11] => n
    $Advanced[12] => 0
    $Advanced[13] => 0
    $Advanced[14] => default

    And pass it to cPanel from a php script with:

    createacct($host, $user, $access_hash, 1, "domain.com", "user", "pass", $Advanced)

    )


    And if I can pass an array similar to the one above, can someone help me out with each individual value? There are 22 things listed in the image below, of those I know that Domain, Username, Password, and Contact Email are all passed outside of the package, and that the Package dropdown its a part of it either. So that takes 5 of the things out. 2 more aren't passed via the array, and I'm not sure which order the rest of the information goes in inside of the array.

    [​IMG]

    Thanks for any and all help. If I didn't explain it well enough, please let me know, and I'll try to clarify.

    Michael
     
  2. fwwebs

    fwwebs Well-Known Member

    Joined:
    Feb 16, 2004
    Messages:
    329
    Likes Received:
    0
    Trophy Points:
    16
    This is a start. You should find some information in the documentation.
    PHP:
     ip=??&cgi=??&quota=??&frontpage=??&cp=??&maxftp=??&maxsql=??&maxpop=??&maxlst=??&maxsub=??&bwlimit=??&hasshell=??&maxpark=??&maxaddon=??&plan=??
    PHP:
    http://yourdomain.tld:2086/scripts/wwwacct
     
  3. IMS

    IMS Member

    Joined:
    Mar 18, 2004
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    1
    I'll go check the documentation again and look for what you were talking about, but the thing is, I was trying to use the Accounting.php.inc functions so that I wouldn't have to actually log in to WHM (which the "PHP Code" would make you do).
     
  4. fwwebs

    fwwebs Well-Known Member

    Joined:
    Feb 16, 2004
    Messages:
    329
    Likes Received:
    0
    Trophy Points:
    16
  5. IMS

    IMS Member

    Joined:
    Mar 18, 2004
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    1
    I know. Those are the functions I was using, even as stated in my first post. My original question was just about that packages, which I couldn't figure out how to get the names of the packages from cPanel, but I've since figured that out, making this topic irrelevant for my original purpose.

    Thank you for the help though, and the quick responses.

    Michael
     
  6. fwwebs

    fwwebs Well-Known Member

    Joined:
    Feb 16, 2004
    Messages:
    329
    Likes Received:
    0
    Trophy Points:
    16
    Well I guess I mis-undersood. In any event, do you mind posting your solution for others?
     
  7. IMS

    IMS Member

    Joined:
    Mar 18, 2004
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    1
    I found the 'each' statement in PHP which actually gave me the array key string instead of just the value. I used that to populate a combobox with the current cPanel packages to be used in the application I'm putting together.

    PHP:
    <select name="cPanel_package" id="cPanel_package">
    <?
    include("inc/Accounting.php.inc");
    $pkgs = listpkgs($cpanel_host, $cpanel_user, $cpanel_access_string, 0);
    while(list($key, $value) = each($pkgs)){
        echo "<option value=\"$key\">$key</option>\n";
    }
    ?>
    </select>
    And that value is saved as another (easier to use) string within my application.
     
  8. paysite-cash

    paysite-cash Active Member

    Joined:
    Feb 3, 2005
    Messages:
    25
    Likes Received:
    0
    Trophy Points:
    1
    interesseting post..how do you manage with reseller to setup the properties of the reseller ?
     
  9. IMS

    IMS Member

    Joined:
    Mar 18, 2004
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    1
    It's all based on the Access Hash created by cPanel. A reseller using his or her access hash would see only things available to their account.

    Root, of course, sees everything.
     
  10. paysite-cash

    paysite-cash Active Member

    Joined:
    Feb 3, 2005
    Messages:
    25
    Likes Received:
    0
    Trophy Points:
    1
    I don't understant what you mean..

    I'm searching for a solution to setup in resellerlist, Edit Privileges/Nameservers....you understand ? as far as I know if I create through a script a reseller account I have to setup also manually the reseller's privileges
     
  11. fwwebs

    fwwebs Well-Known Member

    Joined:
    Feb 16, 2004
    Messages:
    329
    Likes Received:
    0
    Trophy Points:
    16
    If your asking: How would a reseller add privileges to another reseller? The answer is using the root hash in the script.
     
  12. paysite-cash

    paysite-cash Active Member

    Joined:
    Feb 3, 2005
    Messages:
    25
    Likes Received:
    0
    Trophy Points:
    1

    I still don't understand
     
  13. fwwebs

    fwwebs Well-Known Member

    Joined:
    Feb 16, 2004
    Messages:
    329
    Likes Received:
    0
    Trophy Points:
    16
    Do you want to:
    Edit reseller permissions outside of WHM (without using WHM)?
    Add resellers outside of WHM?

    Do you have root access?
     
Loading...

Share This Page