<?php
// This script will add a subdomain and ftp account
// Just change $login, $pass, and $domain - You shouldn't have to touch
// anything else (unless you want to change how it looks)
// Toph: I just added code so you can also add redirection to the subdomain and added some comments so you know whats going on
if (isset($create)) {
//EDIT THIS INFO
$login = "username";
$pass = "password";
$domain = "urldomain";
//DONT EDIT BELOW HERE UNLESS YOU KNOW WHAT YOUR DOING
//this code adds the subdomain
$output = fopen ("http://$login:$pass@www.$domain:2082/frontend/x2/subdomain/doadddomain.html?domain=$subdomain&rootdomain=$domain", "r");
//this code adds the ftp account
$output = fopen ("http://$login:$pass@www.$domain:2082/frontend/x2/ftp/doaddftp.html?login=$subdomain&password=$ftppass&homedir=$subdomain", "r");
//this code adds the redirection
$output = fopen ("http://$login:$pass@www.$domain:2082/frontend/x2/subdomain/saveredirect.html?domain=$subdomain_$domain&url=$redirecturl", "r");
//this is just the text that shows what happened in the end
print ("Subdomain Created.<br>\n");
print ("You can now access it at <a href=\"http://$subdomain.$domain\">http://$subdomain.$domain</a><br>\n");
print ("You also have ftp access. Log in at <a href=\"ftp://ftp.$domain\">ftp://ftp.$domain</a> with the username $subdomain@$domain and the password $ftppass\n")
;
} else {
?>
<html>
<head>
<title>Automatic Subdomain Creator</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<!--this is the form that does it all-->
<form method="post" action="<?php print($_SERVER['PHP_SELF']); ?>">
Subdomain: <input name="subdomain" type="text"><br>
Password: <input name="ftppass" type="password"><br>
Redirect: <input name="redirecturl" type"text"><br>
<input name="create" type=submit value="Create">
</form>
<?php
}
?>