<?php
/*---------------------------------------------------+
| cpanel creator
+----------------------------------------------------+
| Copyright 2009 - Neil Taylor
| http://studyhost.co.uk
+----------------------------------------------------+
| This program is free software: you can redistribute it and/or modify
| it under the terms of the GNU General Public License as published by
| the Free Software Foundation, either version 3 of the License, or
| (at your option) any later version.
|
| This program is distributed in the hope that it will be useful,
| but WITHOUT ANY WARRANTY; without even the implied warranty of
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
| GNU General Public License for more details.
|
| You should have received a copy of the GNU General Public License
| along with this program. If not, see <http://www.gnu.org/licenses/>
+----------------------------------------------------*/
session_start();
if(!$_SESSION['myusername']) {
header("Location:login.php");
}
if($_GET['logout'] == "yes") {
session_destroy();
header("Location: login.php");
}
?>
<?php
require('_adminbar.php');
function show_form() {
global $whoops;
global $statusprintout;
?>
<html>
<head>
<title>Create web account
</title>
<link rel="stylesheet" href="formstyle.css" type="text/css" media="screen" />
</head>
<body>
<div id="controlbar">
<?php adminbar(); ?>
</div>
<fieldset>
<legend>Web Account Creator</legend>
<form method="post" action="<?php echo $_SERVER['$PHP_SELF'];?>" id="grey">
<input type="hidden" name="_submit_check" value="1" />
<div>
<label>Domain:<span>Please enter a username</span></label><input type="text" name="domain" <?php print $whoops; ?>>
<label>Username:<span>Please enter a username</span></label><input type="text" name="user" <?php print $whoops; ?>>
<label>Password:<span>Please enter a password</span></label><input type="text" name="password" <?php print $whoops; ?>>
<label>Package:<span>Please select a package</span></label><select name="package" id="package">
<option value="domain_package" selected>package</option>
<option value="domain_package">package</option>
<option value="domain_package">package</option></select>
<br style="clear:both;">
<label>Contact Email:<span>Please enter a email</span></label><input type="text" name="email" <?php print $whoops; ?>>
</div>
<input type="submit" name="CreateAccount" value="Create Account" style="margin-left :165px; margin-bottom:0px;">
</form>
</fieldset>
<div class="company">
<a href="#">© company</a>
<?php echo($statusprintout); ?>
</body>
</html>
<?php } ?>
<?php
if (array_key_exists('_submit_check', $_POST)) {
if ($_POST["domain"] && $_POST["user"] && $_POST["password"] && $_POST["CreateAccount"]=="Create Account") {
include("_config.inc");
require '/usr/local/cpanel/Cpanel/Accounting.php.inc';
$acctdomain = $_POST['domain'];
$acctuser = $_POST['user'];
$acctpass = $_POST['password'];
$acctplan = $_POST['package'];
$acctemail = $_POST['email'];
$status = createacct($host,$user,$accesshash,0,$acctdomain,$acctuser,$acctpass,$acctplan);
$result = explode("+", $status);
$finalresult = $result[0];
$finalresult .= $result[1];
$finalresult .= $result[2];
$finalresult .= $result[3];
$finalresult .= $result[4];
$finalresult .= $result[5];
$finalresult_email = $result[1];
$finalresult_email .= $result[2];
$finalresult_email .= $result[3];
$finalresult_email .= $result[4];
$finalresult_email .= $result[5];
$finalemailresult = $finalresult_email;
$finalwebresult = nl2br($finalresult);
$finalwebresult = str_replace("1<br />
Account Creation Ok<br />
Checking input data...System has 2 free ips.<br />
...DoneWWWAcct 12.1.0 (c) 1997-2008 cPanel, Inc....<br />
<br />
Dns Zone check is enabled.<br />", " ", $finalwebresult);
$statusprintout = $finalwebresult;
$sendto = $acctemail.",".$emailfrom;
$subject = "New Website Account";
$headers = "From: ".$emailname."<".$emailfrom.">\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n".
mail($sendto, $subject, $finalemailresult, $headers);
show_form();
}
else {
$whoops = "style='border:1px solid red;'";
show_form();
}
}
else {show_form();}
?>