Tuesday, December 5, 2006

Cpanel/WHM Account Creator PHP Script

I was searching for a php script to create run time new sub domain in php. On my website any user can select new template and I can display user's company name as subdomain like (www.mywebsite.com/usercom) on my site. While searching for this tool I got it at a website www.zubrag.com. The requirement for this script is CPanelWHM.
Features:
  • Quick and easy setup: just download it, unzip, open in your favorite plain text editor (like Notepad for Window, or vi for Unix, etc.), update script with your WHM account login data (YOUR WHM LOGIN DATA block), and save it somewhere on your server.
  • No need to login to your WHM each time you need to create new user account. You will provide only new user account settings.
  • Script can be executed either from browser, or run from your existing PHP script.
  • All options for new account can be tuned by passing parameters to the script.
  • You can password protect it from cPanel, or using simple password protection script.
Accepted parameters:
  • domain - domain or subdomain to be assigned to new account. Sample domain: reseller.com, Sample sub-domain: newuser.reseller.com
  • user - new account username
  • password - password for new account
  • package - hosting package (plan) for the user. Package needs to be setup already using WHM. Quota is controlled in package
Sample usage (3 possible options):
  • Enter script's url in the browser, fill the form data, and press Create Account button
  • Create account by passing all parameters via url.
    http://domain.com/auto/create-whm-account.php?domain=reseller.com&user=hosting&password=manager&package=unix2
  • If you want to execute it from existing php script then add following code
    $user_domain = "userdomain"; // new account domain
    $user_name = "username"; // new account username
    $user_pass = "password"; // new account password
    $user_plan = "hosting_plan"; // new account hosting package (plan)
    include ("create-whm-account.php"); // this will create domain / subdomain
You can download the script from http://www.zubrag.com/scripts/create-cpanel-whm-account.php

0 comments: