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.

Custom index page for accounts under a reseller?

Discussion in 'cPanel Developers' started by jhyland87, May 22, 2009.

  1. jhyland87

    jhyland87 Well-Known Member

    Joined:
    Dec 8, 2008
    Messages:
    153
    Likes Received:
    0
    Trophy Points:
    16
    I am using this code to make accounts under a reseller.

    PHP:
    $acct = array( username => "someuser"password => "pass123"domain => "thisdomain.com");
    print 
    $xmlapi->createacct($acct);
    But how can i make it so when the account is created, it will have a custom index page?

    Keep in mind, its an account under a reseller, not under the root. The main host has its own custom default index page for new accounts.. This needs to be a script I make. Thanks!
     
  2. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    There are two ways I see of doing this:

    1. Making the index page a PHP script and storing that PHP script in the reseller's skeleton directory. PHP can then be used to customize the index page.

    2. If you're looking to do something a bit more complex, you could create a /scripts/postwwwacct shell script and based on the owner parameter (indicating which reseller owns the account - will be root if it's root) do what you need to do. You can find documentation on this at:

    ScriptHooks < AllDocumentation < TWiki
     
  3. jhyland87

    jhyland87 Well-Known Member

    Joined:
    Dec 8, 2008
    Messages:
    153
    Likes Received:
    0
    Trophy Points:
    16
    Where is the skeleton directory?

    Edit: ~/cpanel3-skel where

    Thanks :)
     
  4. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    ~/cpanel3-skel where ~ represents your reseller user's home directory.
     
  5. jhyland87

    jhyland87 Well-Known Member

    Joined:
    Dec 8, 2008
    Messages:
    153
    Likes Received:
    0
    Trophy Points:
    16
    Yup, I see that one.

    I have like 10 problems, and they would all be solved if somehow, the resellers website could modify its accounts via php....

    Example, if they could log into a custom control panel on websiteA.com, (where they went to sign up and get their account), and have it modify websiteB.com, which is their website. I would need to modify logs and .htaccess files and other stuff.. Any way to do this, or will permissions kill it?
     
  6. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Are you asking if you can have a PHP script on WebsiteA.com modifying the contents of WebsiteB.com?
     
  7. jhyland87

    jhyland87 Well-Known Member

    Joined:
    Dec 8, 2008
    Messages:
    153
    Likes Received:
    0
    Trophy Points:
    16
    Basically, or have it run a script that will do it... I need to have them be able to log into my CMS on websiteA and (for example), add an IP to block from the site, and have it edit their .htaccess file... get me?
     
  8. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    If you are using cPanel functionality like the IP Deny Manager, you can use API1/API2 via the XML API to avoid any permissions issues as long as you are a reseller or root user.
     
  9. jhyland87

    jhyland87 Well-Known Member

    Joined:
    Dec 8, 2008
    Messages:
    153
    Likes Received:
    0
    Trophy Points:
    16
    I would be the reseller, so that works good.

    How about this, (last question, this is the main one)...

    When the user signs up, he/she has an option between 3 scripts they can have installed in their directory, the raw scripts will be located in /home/Justin1/ (Justin1 is also the reseller, as well as the main site they sign up on), Lets say they pick Wordpress, once the account is created, how would I move /wordpress from /home/Justin1/wordpress to /home/NewGuy/public_html ?

    I tried a few things, all give me file permission issues.

    I tried to have the default page in the account that gets created download a zip and unzip it, and have the signup page on the main reseller account call to it to see if it will download it, but that fails every time... so im kinda stuck. (if what I just said confuses you, here is the exact code)

    PHP:
    $acctdomain "NewUser.Reseller.com";
    $app 'wordpress';
    $zip "http://$acctdomain/make.php?get=$app";
    $homepage file_get_contents($zip);
    echo 
    $homepage;
    And the contents of make.php (which is in the skeleton directory, so its put in theirs when its created), is below
    PHP:
    if(isset($_GET['get'])){
               
    $get_array = array('wordpress');
               
    $get $_GET['get'];
               if(
    in_array($get$get_array)){
                       switch(
    $get){
                               case 
    'wordpress':
                               
    exec("wget http://Reseller.com/wordpress.zip");
                               echo 
    "wget http://Reseller.com/wordpress.zip executed";
                               break;
                               default:
                               echo 
    "Default";
                               break;
                       }
               } else {
                       echo 
    "Error";
               }
    } else {
               echo 
    "Get not set";
    }
    So I know its confusing, but the above just wont work, it fails no matter what I do.. Is their a way in cpanel that I can determine what goes in the directory of their new site when its made? Kinda like the skeleton directory, only it will pick a different directory to copy depending on what they pick.

    Thank you so much for your help guys!
     
  10. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Is PHP running as DSO, SuPHP, CGI or FastCGI? That would be very important to know before addressing any PHP-related permissions questions. I recommend asking your hosting provider if you're not sure.
     
  11. jhyland87

    jhyland87 Well-Known Member

    Joined:
    Dec 8, 2008
    Messages:
    153
    Likes Received:
    0
    Trophy Points:
    16
    I am the hosting provider, but im trying to do this under JUST the reseller account I made, so I can move it later..
    phpinfo()
    I plan on getting suPHP soon. Im not an expert at this yet, but im getting the hang of it..

    Right now, i just have CGI
     
  12. jhyland87

    jhyland87 Well-Known Member

    Joined:
    Dec 8, 2008
    Messages:
    153
    Likes Received:
    0
    Trophy Points:
    16
    Also, whats the API command to view/edit the blocked IP's?
     
  13. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Do you mean the IPs blocked in the IP Deny Manager in cPanel or something else?
     
  14. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Okay, so at some point you changed the implementation of PHP from DSO to CGI via EasyApache?
     
  15. jhyland87

    jhyland87 Well-Known Member

    Joined:
    Dec 8, 2008
    Messages:
    153
    Likes Received:
    0
    Trophy Points:
    16
    yeah, I am trying to fetch AND modify, is this possible with API commands? I didnt see anything
    yes, i need to change to suphp. But I figured this out, I just made the postwwwacct file, which was a GREAT idea, thanks!!
     
  16. jhyland87

    jhyland87 Well-Known Member

    Joined:
    Dec 8, 2008
    Messages:
    153
    Likes Received:
    0
    Trophy Points:
    16
    Is it possible to modify those via api?
     
  17. jhyland87

    jhyland87 Well-Known Member

    Joined:
    Dec 8, 2008
    Messages:
    153
    Likes Received:
    0
    Trophy Points:
    16
  18. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Yes, here are the raw API 1 commands:

    To add an IP:
    Code:
    <cpanel DenyIp="adddenyip([COLOR="Red"]ip[/COLOR])">
    To remove an IP:
    Code:
    <cpanel DenyIp="deldenyip([COLOR="Red"]ip[/COLOR])">
    As for listing denied IPs, I'll have to get back to you on that.
     
  19. jhyland87

    jhyland87 Well-Known Member

    Joined:
    Dec 8, 2008
    Messages:
    153
    Likes Received:
    0
    Trophy Points:
    16
    I was actually trying to do this in PHP.. and to get a list of the blocked UIP's as well
     
  20. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    I'm still working with our QA team on determining an XML API call for getting a list of blocked IPs.

    As for calling cPanel APIs via the XML API in PHP, you may want to use Matt's PHP class for this posted at: http://forums.cpanel.net/f42/xmlapi-php-class-111897.html
     
Loading...

Share This Page