[advanced search]
Results from the most recent live auction are here.
11 members in the live chat room. Join Chat!
Register Rules & FAQ NP$ Store Active Threads Mark Forums Read
Go Back   NamePros.Com > Design and Development > Programming > CODE
User Name
Password

Old 01-01-2007, 02:40 AM   · #1
DeViAnThans3
Spamzor.com
 
DeViAnThans3's Avatar
 
Name: Hans
Location: Belgium
Trader Rating: (35)
Join Date: Apr 2006
Posts: 442
NP$: 22.35 (Donate)
DeViAnThans3 is a name known to allDeViAnThans3 is a name known to allDeViAnThans3 is a name known to allDeViAnThans3 is a name known to allDeViAnThans3 is a name known to allDeViAnThans3 is a name known to all
Automated WHM account creation

A few days ago, when I got bored, I wrote this small bunch of code for automated WHM account creation.

It does works, but note that this is just a rough bunch of code; you'll have to change a lot of settings in order to get the script suit your needs.
There is also no checkup written into it to check if the account really is created

**NOTE 1: PHP Safe Mode must be turned off, in order to get this script working, else a few cURL options will issue an error.
**NOTE 2:cURL must be installed at your PHP server.
**NOTE 3:Create an empty cookie.txt file, upload it to your server, and make sure it is 777-CHMOD'ed

If you like the script, rep is appreciated

whm-create.php
PHP Code:
<?php
/* HOW TO INSTALL
1 - Save this code as a PHP file (or any file, as long as the server recognizes it as PHP)
2 - Change the configuration part in this file, save it, and upload to your server
3 - Create an empty .txt file in notepad, call it cookie.txt, upload it to your server.
4 - Is your server a unix-like server? CHMOD that file to 777.
    This is not need for windows servers.
*/

// Configure
define("WHM_USER", "your-username"); // WHM username
define("WHM_PASS", "your-password"); // WHM password
define("WHM_DOMAIN", "127.0.0.1");   // IP or hostname could be enterred here

// The new account settings!
// Go to line 75 in this file, and change everything to suit your needs.


// cURL class: Thanks to Sean Huber
class CURL {
   var
$callback = false;

function
setCallback($func_name) {
   
$this->callback = $func_name;
}

function
doRequest($method, $url, $vars) {
   
$ch = curl_init();
   
curl_setopt($ch, CURLOPT_URL, $url);
   
curl_setopt($ch, CURLOPT_HEADER, 1);
   
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
   
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
   
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
   
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
   
curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookie.txt');
   if (
$method == 'POST') {
       
curl_setopt($ch, CURLOPT_POST, 1);
       
curl_setopt($ch, CURLOPT_POSTFIELDS, $vars);
   }
   
$data = curl_exec($ch);
   
curl_close($ch);
   if (
$data) {
       if (
$this->callback)
       {
           
$callback = $this->callback;
           
$this->callback = false;
           return
call_user_func($callback, $data);
       } else {
           return
$data;
       }
   } else {
       return
curl_error($ch);
   }
}

function
get($url) {
   return
$this->doRequest('GET', $url, 'NULL');
}

function
post($url, $vars) {
   return
$this->doRequest('POST', $url, $vars);
}
}

// Initialize cURL library
$curl = new CURL;

$text = $curl->get("http://" . WHM_USER . ":" . WHM_PASS . "@" . WHM_DOMAIN .":2086/");

// Create account now
// First going to this form; required, else wont work
$text = $curl->get("http://" . WHM_USER . ":" . WHM_PASS . "@" . WHM_DOMAIN .":2086/scripts2/wwwacctform");

// Fine! Set the options now.
$options = "sign=&plan=hansvdp_tp&domain=tgz33.com&username=tg33&password=test&quota=6&ip=0&cgi=1&frontpage=1&maxftp=unlimited&maxpop=unlimited&maxlst=unlimited&maxsql=unlimited&maxsub=unlimited&maxpark=5&maxaddon=3&bwlimit=50&cpmod=x&msel=n,y,unlimited,y,unlimited,unlimited,unlimited  ,unlimited,unlimited,unlimited,unlimited,y,0,0&contactemail=hansvdp@gmail.com";

// And post it!
$text = $curl->post("http://" . WHM_USER . ":" . WHM_PASS . "@" . WHM_DOMAIN .":2086/scripts/wwwacct", $options);

// Eventually you can output the text here
echo $text;
?>


If you need any support with it, just reply to this topic, i'm watching it

Cheers,


Please register or log-in into NamePros to hide ads
__________________
Useless is cool!
Work From Home Opportunities -
1 link ... 1 month ... 5 NP$ ] Real bargain! Limited to 1 month.

Last edited by DeViAnThans3 : 01-01-2007 at 02:45 AM.
DeViAnThans3 is offline   Reply With Quote
Old 01-01-2007, 06:46 AM   · #2
beaver6813
NamePros Regular
 
beaver6813's Avatar
 
Name: Sam Cleaver
Location: England
Trader Rating: (11)
Join Date: May 2005
Posts: 346
NP$: 59.50 (Donate)
beaver6813 is a jewel in the roughbeaver6813 is a jewel in the roughbeaver6813 is a jewel in the rough
Great Script And Very Useful I'll test it out when i get a chance
__________________
-Beaver6813.com V5 Soon!
beaver6813 is offline   Reply With Quote
Old 01-01-2007, 11:38 AM   · #3
makroz
Account Closed
 
Name: Mario Guzman
Trader Rating: (4)
Join Date: Dec 2006
Posts: 187
NP$: 0.00 (Donate)
makroz is on a distinguished road
Yes very nice script, i will try too
makroz is offline   Reply With Quote
Old 01-01-2007, 11:49 AM   · #4
DeViAnThans3
Spamzor.com
 
DeViAnThans3's Avatar
 
Name: Hans
Location: Belgium
Trader Rating: (35)
Join Date: Apr 2006
Posts: 442
NP$: 22.35 (Donate)
DeViAnThans3 is a name known to allDeViAnThans3 is a name known to allDeViAnThans3 is a name known to allDeViAnThans3 is a name known to allDeViAnThans3 is a name known to allDeViAnThans3 is a name known to all
Okay, have fun with it
And if you have any problems with it, I'm here to help you lol
__________________
Useless is cool!
Work From Home Opportunities -
1 link ... 1 month ... 5 NP$ ] Real bargain! Limited to 1 month.
DeViAnThans3 is offline   Reply With Quote
Old 01-01-2007, 11:52 AM   · #5
Matthew.
Stud Sausage
 
Location: England
Trader Rating: (25)
Join Date: Dec 2006
Posts: 1,545
NP$: 32.41 (Donate)
Matthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud of
Adoption Breast Cancer Breast Cancer Cancer Survivorship
Nice little script, i have never used much of curl as i have never had a use for it but my upcoming project will so i will be sure to check it out Sounds like a powerful little package from what i hear.

+Rep added, i will try it when i get back onto WHM/Reseller.
Matthew. is offline   Reply With Quote
Old 01-18-2007, 01:57 AM   · #6
Dismounted
New Member
 
Trader Rating: (1)
Join Date: Jan 2007
Posts: 12
NP$: 0.00 (Donate)
Dismounted is an unknown quantity at this point
cPanel/WHM has its own functions to modify/create accounts, you know.
http://www.cpanel.net/support/docs/remoteaccess-php.htm
Dismounted is offline   Reply With Quote
Old 01-18-2007, 01:36 PM   · #7
NetworkTown.Net
Senior Member
 
Name: Soon....
Location: United Kingdom
Trader Rating: (27)
Join Date: Oct 2005
Posts: 1,554
NP$: 49.74 (Donate)
NetworkTown.Net is just really niceNetworkTown.Net is just really niceNetworkTown.Net is just really niceNetworkTown.Net is just really nice
Originally Posted by Dismounted
cPanel/WHM has its own functions to modify/create accounts, you know.
http://www.cpanel.net/support/docs/remoteaccess-php.htm


Yes but they hardly help you with it and dont explain it that much for n00bs this one is better.
NetworkTown.Net is offline   Reply With Quote
Old 01-18-2007, 01:46 PM   · #8
DeViAnThans3
Spamzor.com
 
DeViAnThans3's Avatar
 
Name: Hans
Location: Belgium
Trader Rating: (35)
Join Date: Apr 2006
Posts: 442
NP$: 22.35 (Donate)
DeViAnThans3 is a name known to allDeViAnThans3 is a name known to allDeViAnThans3 is a name known to allDeViAnThans3 is a name known to allDeViAnThans3 is a name known to allDeViAnThans3 is a name known to all
I could easily write with that code too, but I don't think it is necessary at this moment
The script works, and that's most important to me
__________________
Useless is cool!
Work From Home Opportunities -
1 link ... 1 month ... 5 NP$ ] Real bargain! Limited to 1 month.
DeViAnThans3 is offline   Reply With Quote
Old 01-20-2007, 08:03 AM   · #9
DJ
Senior Member
 
DJ's Avatar
 
Location: .be
Trader Rating: (45)
Join Date: Dec 2004
Posts: 1,298
NP$: 153.12 (Donate)
DJ is a splendid one to beholdDJ is a splendid one to beholdDJ is a splendid one to beholdDJ is a splendid one to beholdDJ is a splendid one to beholdDJ is a splendid one to beholdDJ is a splendid one to beholdDJ is a splendid one to behold
Save a Life
Very nice Hans, this will come in handy

Bedankt!
__________________
GETFireFox.NU | ImageUnload.com | SurfAnySite.com | UpLoads.cc | H.TL
NPEF.info - You can save someone's life
Online Portfolio | Names For Sale @ DOT.gd
DJ is offline  
  Reply With Quote
Old 01-21-2007, 03:30 AM   · #10
DeViAnThans3
Spamzor.com
 
DeViAnThans3's Avatar
 
Name: Hans
Location: Belgium
Trader Rating: (35)
Join Date: Apr 2006
Posts: 442
NP$: 22.35 (Donate)
DeViAnThans3 is a name known to allDeViAnThans3 is a name known to allDeViAnThans3 is a name known to allDeViAnThans3 is a name known to allDeViAnThans3 is a name known to allDeViAnThans3 is a name known to all
Geen probleem (No problem)

Have fun with it!
__________________
Useless is cool!
Work From Home Opportunities -
1 link ... 1 month ... 5 NP$ ] Real bargain! Limited to 1 month.
DeViAnThans3 is offline   Reply With Quote
Closed Thread

NamePros is a revenue sharing forum.

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


Site Sponsors
http://www.mobisitetrader.com/ Proof is in the Parking Hunting Moon
Advertise your business at NamePros
All times are GMT -7. The time now is 06:25 AM.


Powered by: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0