Advertisement
Guest User

zby

a guest
Aug 19th, 2018
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.47 KB | None | 0 0
  1.  
  2. <?php
  3.  
  4. // YOUR WHM LOGIN DATA, CHANGE AS APPROPRIATE
  5.  
  6. $whm_user = "root"; // reseller username
  7. $whm_pass = "password"; // the password you use to login to WHM
  8.  
  9. // DO NOT EDIT BELOW THIS
  10.  
  11. $whm_host = $_SERVER['HTTP_HOST'];
  12.  
  13. function getVar($name, $def = ''){
  14. if (isset($_REQUEST[$name])){
  15. return $_REQUEST[$name];
  16. } else{
  17. return $def;
  18. }
  19. }
  20.  
  21. // Domain name of new hosting account
  22. // To create subdomain just pass full subdomain name
  23. // Example: newuser.jabalisites.com
  24.  
  25. if (!isset($user_domain)){
  26. $user_domain = getVar('domain');
  27. }
  28.  
  29. // Username of the new hosting account
  30.  
  31. if (!isset($user_name)){
  32. $user_name = getVar('user');
  33. }
  34.  
  35. // Password for the new hosting account
  36.  
  37. if (!isset($user_pass)){
  38. $user_pass = getVar('password');
  39. }
  40.  
  41. // New hosting account Package
  42.  
  43. if (!isset($user_plan)){
  44. $user_plan = getVar('package');
  45. }
  46.  
  47. // Contact email
  48.  
  49. if (!isset($user_email)){
  50. $user_email = getVar('email');
  51. }
  52.  
  53. // if parameters passed then create account
  54.  
  55. if (!empty($user_name)){
  56.  
  57. // create account on the cPanel server
  58.  
  59. $script = "http://{$whm_user}:{$whm_pass}@{$whm_host}:2086/scripts/www";
  60. $params = "?plan={$user_plan}&domain={$user_domain}&username={$user_name}&password={$user_pass}&contactemail={$user_email}";
  61. $result = file_get_contents($script . $params);
  62.  
  63. // output result
  64.  
  65. echo "RESULT: " . $result;
  66. }
  67.  
  68. // otherwise show input form
  69.  
  70. //
  71. else {
  72. $frm = <<<EOD
  73. <html>
  74. <head>
  75. <title>cPanel/WHM Account Creator</title>
  76. <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
  77. <META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
  78. </head>
  79. <body>
  80. <style>
  81. input { border: 1px solid black; }
  82. </style>
  83. <form method="post">
  84. <h3>cPanel/WHM Account Creator</h3>
  85. <table border="0">
  86. <tr><td>Domain:</td><td><input name="domain" size="30"></td><td>Subdomain or domain, without www</td></tr>
  87. <tr><td>Username:</td><td><input name="user" size="30"></td><td>Username to be created</td></tr>
  88. <tr><td>Password:</td><td><input name="password" size="30"></td><td></td></tr>
  89. <tr><td>Package:</td><td><input name="package" size="30"></td><td>Package (hosting plan) name. Make sure you specify existing package</td></tr>
  90. <tr><td>Contact Email:</td><td><input name="email" size="30"></td><td></td></tr>
  91. <tr><td colspan="3"><br /><input type="submit" value="Create Account"></td></tr>
  92. </table>
  93. </form>
  94. </body>
  95. </html>
  96. EOD;
  97. echo $frm;
  98. }
  99.  
  100. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement