|
|||
|
Auto sub domain creation
Just wondering has anyone succesfully implemented such a feature in Control Panel
The feature would be web based using a simple form, connecting to either a php or perl script that would allow registered users to automatically create their own sub domain, after first checking that the sub domain was available cPanel.net Support Ticket Number:
__________________
"Eh...you never know what you're capable of. I never thought I could shoot down a German plane, but last year I proved myself wrong" - Abe Simpson |
|
|||
|
//Make sure to store the $cpaneluser and $cpanelpass in a secure directory, or outside of the public_html folder.
$socket = fsockopen("www.domain.com",2082); $authstr = "$cpaneluser:$cpanelpass"; $pass = base64_encode($authstr); //First, we add an FTP account with the username and home directory named to $ustring. $in = "GET /frontend/x2/ftp/doaddftp.html?login=$ustring&password=$password&ho medir=$ustring\r\n HTTP/1.0\r\nAuthorization: Basic $pass \r\n"; fputs($socket,$in); fclose($socket); //Next, we add a subdomain with $ustring which will give the user FTP access to /$ustring and the subdomain $ustring.domain.com will reference all files in the user's FTP account. $socket2 = fsockopen("www.domain.com",2082); $indom = "GET /frontend/x2/subdomain/doadddomain.html?domain=$ustring&rootdomain=domain .com\r\n HTTP/1.0\r\nAuthorization: Basic $pass \r\n"; fputs($socket2,$indom); fclose($socket2); //Finally, we create a mail account for the user. $socket3 = fsockopen("www.domain.com",2082); $inpop = "GET /frontend/x2/mail/doaddpop.html?domain=domain.com&email=$ustring&pas sword=$password"a=5\r\n HTTP/1.0\r\nAuthorization: Basic $pass \r\n"; fputs($socket3,$inpop); fclose($socket3); --- I use many modifications of this script to run chunks of my site. The trick is to go to cPanel and view the html source code for whatever you are trying to do (edit mail account, add, FTP, etc.) and then use the values (input type=text NAME="IMPORTANTVARIABLE" and action="dourl.htm") that are inside of the html form. Just replace the variable you find in the form within the GET statement. Study the script above to learn more. If you are going to check to see if the subdomain already exists, write a PHP script to first check if a user exists in a database, and if not add them to the database and create the account. Good luck! cPanel.net Support Ticket Number: |
|
|||
|
Quote:
I've been trying to use your above code (just the subdomain section), but it doesn't seem to work. I just get blank page, no subdomain is created? Do you know if this still works with current versions of cpanel? Have you had to change anything? |
|
|||
|
Quote:
http://forums.cpanel.net/showthread....253#post111253 Damion |
![]() |
| Thread Tools | |
| Display Modes | |
|
|