This commit is contained in:
doudoudzj 2019-06-23 22:53:09 +08:00
parent 7df2f9d986
commit 4894be8108
55 changed files with 1364 additions and 323 deletions

View file

@ -17,14 +17,14 @@ switch ($section) {
break;
}
include("include/header.php");
include("index/header.php");
if (in_array($section, $enable_section)) {
include("include/about_" . $section . ".php");
include("index/about_" . $section . ".php");
} else {
include("include/about_uiisc.php");
include("index/about_uiisc.php");
}
include("include/footer.php");
include("index/footer.php");

248
admin.php
View file

@ -1,222 +1,52 @@
<?php
// ini_set("display_errors", false);
session_start();
define("IN_SYS", true);
require_once("core.php");
// $INDEX = __FILE__;
include_once "{$ROOT}/library/common.php";
include_once "{$ROOT}/library/api.php";
include_once "{$ROOT}/library/functions.php";
include_once "{$ROOT}/admin/library.php";
// getVersion();
// if (!file_exists("{$ROOT}/data/installed") || !isset($config) || $config['apiUsername'] == '#getUsername#' || $config['apiPassword'] == '#getPassword#') {
// header('Location: ./install.php');
// }
// $session_name = session_name();
// if (!isset($_COOKIE[$session_name])) {
// foreach ($_COOKIE as $key => $val) {
// $key = strtoupper($key);
// if (strpos($key, $session_name)) {
// session_id($_COOKIE[$key]);
// }
// }
// }
include_once "{$ROOT}/include/common.php";
include_once "{$ROOT}/lib/api.php";
include_once "{$ROOT}/controllers/admin.php";
getVersion();
if (!file_exists("{$ROOT}/data/installed") || !isset($config) || $config['apiUsername'] == '#getUsername#' || $config['apiPassword'] == '#getPassword#') {
header('Location: ./install.php');
if (isAdminLoggedIn()) {
$section = (empty($_GET["s"]) ? "main" : $_GET["s"]);
} else {
$section = "login";
}
?>
$section_page = "{$ROOT}/admin/views/{$section}.php";
if (!is_file($section_page)) {
exit('Page Not Found!');
}
<?php include("include/admin_header.php"); ?>
$message = [];
<?php if (file_exists("{$ROOT}/install.php")) { ?>
<div class="container">
<div class="alert alert-dismissible alert-danger">Please delete the <b>install.php</b> file.</div>
</div>
<?php } ?>
$controller = "{$ROOT}/admin/controllers/{$section}.php";
if (is_file($controller)) {
include_once $controller;
}
<div class="container">
<?php if ($is_admin) { ?>
<div class="row">
<div class="col-md-12">
<a class="btn btn-default" href="admin.php?s=check_domain" role="button">Check Domain</a>
<a class="btn btn-default" href="admin.php?s=account_list" role="button">List</a>
<a class="btn btn-default" href="admin.php?s=account_add" role="button">Add</a>
<a class="btn btn-default" href="admin.php?s=account_password" role="button">Password</a>
<a class="btn btn-default" href="admin.php?s=account_disable" role="button">Suspend</a>
<a class="btn btn-default" href="admin.php?s=account_active" role="button">Activate</a>
<a class="btn btn-default" href="admin.php?s=account_status" role="button">Status</a>
<a class="btn btn-default" href="admin.php?s=account_domain" role="button">Domains</a>
</div>
</div>
<?php } ?>
<div class="row">
<div class="col-md-12 col-sm-12">
<?php if ($section == 'main') { ?>
<h1>Hosting Account Management System</h1>
<p class="lead">This is a simple script for WHM myownfreehost made to manage hosting accounts through the api assigned to users with free reseller accounts.</p>
<b>Available Functions:</b>
<ol>
<li>Verify if a domain is available.</li>
<li>Creation of account hosting from the panel.</li>
<li>Change password to hosting account.</li>
<li>Deactivate or disable a hosting account.</li>
<li>Activate or enable hosting account.</li>
<li>Verify how many domain and state of the hosting account.</li>
</ol>
<?php } else { ?>
<h2><?php echo $section_title; ?></h2>
<?php if ($section == 'check_domain') { ?>
<form action="" method="POST">
<p>Verify the domain is available for registration</p>
<label>
<!-- <span>Account:</span> -->
<input type="text" name="domain" class="form-control" maxlength="50" placeholder="Enter a domain or sub-domain">
</label>
<button type="submit" name="do_check_domain" class="btn btn-primary">Verify domain</button>
</form>
<?php } elseif ($section == 'account_list') {; ?>
<div class="table-responsive">
<table class="table table-bordered table-hover">
<thead>
<tr>
<th>#</th>
<th>Branch</th>
<th>Account</th>
<th>Username</th>
<th>Email</th>
<th>Domain</th>
<th>Plan</th>
<th>Password</th>
<th>Nameserver</th>
<th>Operate</th>
</tr>
</thead>
<tbody>
<?php foreach ($member as $key => $value) { ?>
<tr>
<th><?php echo $key + 1; ?></th>
<td><?php echo $value["branch"]; ?></td>
<td><?php echo $value["account"]; ?></td>
<td><?php echo $value["username"]; ?></td>
<td><?php echo $value["email"]; ?></td>
<td><?php echo implode(",", $value["domain"]); ?></td>
<td><?php echo $value["plan"]; ?></td>
<td><?php echo $value["password"]; ?></td>
<td><?php echo implode(",", $value["nameserver"]); ?></td>
<td style="width: 206px;">
<a class="btn btn-default btn-xs" href="#" role="button"><?php echo $LANG['login']; ?></a>
<button class="btn btn-default btn-xs" type="submit">View</button>
<button class="btn btn-default btn-xs" type="submit">Active</button>
<button class="btn btn-default btn-xs" type="submit">Disable</button>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<?php } elseif ($section == 'account_add') {; ?>
<form action="" method="POST">
<label>
<span>Account:</span>
<input type="text" name="username" value="" class="form-control" maxlength="8" placeholder="Account of 8 characters">
</label>
<label>
<span>Password:</span>
<input type="password" name="password" value="" class="form-control" maxlength="35" placeholder="Password">
</label>
<label>
<span>Domain or Sub-domain:</span>
<input type="text" name="domain" value="" class="form-control" maxlength="35" placeholder="example.com">
</label>
<label>
<span>Email Address:</span>
<input type="text" name="email" value="" class="form-control" maxlength="35" placeholder="email@example.com">
</label>
<label>
<span>Select a Hosting Plan:</span>
<select name="plan" class="form-control">
<?php foreach ($config['plan'] as $key => $value) { ?>
<option value="<?php echo $key; ?>"><?php echo $value; ?></option>
<?php } ?>
</select>
</label>
<button type="submit" name="do_reg_account" class="btn btn-primary">Register Account</button>
</form>
<?php } elseif ($section == 'account_password') {; ?>
<form action="" method="POST">
<!-- Reset Password -->
<label>
<span>Account: <small>(It is the 8 characters)</small></span>
<input type="text" name="username" class="form-control" maxlength="8" placeholder="Account: (It is the 8 characters)">
</label>
<label>
<span>New Password:</span>
<input type="password" name="password" class="form-control" maxlength="35" placeholder="Password">
</label>
<button type="submit" name="do_set_password" class="btn btn-primary">Set Password</button>
</form>
<?php } elseif ($section == 'account_disable') {; ?>
<form action="" method="POST">
<label>
<span>Account: <small>(It is the 8 characters)</small></span>
<input type="text" name="username" class="form-control" maxlength="8" placeholder="Account: (It is the 8 characters)">
</label>
<label>
<span>Reason for deactivation:</span>
<input type="text" name="reason" class="form-control" maxlength="60" placeholder="Reason or some message">
</label>
<button type="submit" name="do_disable_account" class="btn btn-primary">Save Settings</button>
</form>
<?php } elseif ($section == 'account_active') {; ?>
<form action="" method="POST">
<label>
<span>Account: <small>(It is the 8 characters)</small></span>
<input type="text" name="username" class="form-control" maxlength="8" placeholder="Account: (It is the 8 characters)">
</label>
<button type="submit" name="do_activate_account" class="btn btn-primary">Save Settings</button>
</form>
<?php } elseif ($section == 'account_status') {; ?>
<form action="" method="POST">
<label>
<span>VistaPanel Username: <small>(Example: uii_12345678)</small></span>
<input type="text" name="username" class="form-control" maxlength="18" placeholder="VPanel Username (Example: uii_12345678)">
</label>
<button type="submit" name="do_check_status" class="btn btn-primary">Check Status</button>
</form>
<?php } elseif ($section == 'account_domain') {; ?>
<form action="" method="POST">
<label>
<span>VistaPanel Username: <small>(Example: uii_12345678)</small></span>
<input type="text" name="username" class="form-control" maxlength="18" placeholder="VPanel Username (Example: uii_12345678)">
</label>
<button type="submit" name="do_get_domains" class="btn btn-primary">View Domain</button>
</form>
<?php } elseif ($section == 'login') {; ?>
<?php if (!$is_admin) { ?>
<form action="" method="POST" class="form-horizontal">
<label>
<span>Admin:</span>
<input type="text" name="username" class="form-control" maxlength="18" placeholder="Admin Username" autofocus required>
</label>
<label>
<span>Password:</span>
<input type="password" name="password" class="form-control" maxlength="35" placeholder="Admin Password" required>
</label>
<label>
<span>Captcha:</span>
<input type="text" name="captcha" class="form-control" maxlength="18" placeholder="CAPTCHA" required autocomplete="off">
</label>
<button type="submit" name="do_login" class="btn btn-primary"><?php echo $LANG['login']; ?></button>
</form>
<?php } elseif ($is_admin && !isset($message[0])) { ?>
<div class="alert alert-success">You have logged in</div>
<?php } ?>
<?php }
if ($message) { ?>
<hr/>
<div class="alert <?php echo empty($message[0]) ? 'alert-danger' : 'alert-success'; ?>">
<p><?php echo $message[1]; ?></p>
<?php if (isset($message[2]) && ($message[2])) {
echo "<p>response data:</p><pre>";
print_r($message[2]);
echo "</pre>";
} ?>
</div>
<?php }
} ?>
</div>
</div>
</div>
include("{$ROOT}/admin/views/header.php");
include("{$ROOT}/admin/views/navbar.php");
<?php include("include/admin_footer.php"); ?>
if (file_exists("{$ROOT}/install.php")) {
require_once("{$ROOT}/admin/views/install_tips.php");
}
require_once $section_page;
include("{$ROOT}/admin/views/footer.php");

View file

@ -0,0 +1,24 @@
<?php
if (!defined('IN_SYS')) {
// exit('禁止访问');
header("Location: ../../admin.php");
exit;
}
if (isset($_POST["do_activate_account"])) {
$tsData = array(
"username" => setProtect(strtolower($_POST["username"])),
);
if (!isset($tsData["username"]) || empty($tsData["username"])) {
$message = [0, "The username is required."];
} elseif (strlen($tsData["username"]) < 4 || strlen($tsData["username"]) > 8) {
$message = [0, "The username is invalid (8 characters maximum)."];
} elseif (!preg_match("/^[a-zA-Z0-9]{4,16}$/", $tsData["username"])) {
$message = [0, "The username does not allow strange characters.."];
} else {
$client = Api::init($config);
$client->unsuspend(["username" => setProtect(strtolower($tsData["username"]))]);
$message = $client->message;
}
}

View file

@ -0,0 +1,52 @@
<?php
if (!defined('IN_SYS')) {
// exit('禁止访问');
header("Location: ../../admin.php");
exit;
}
if (isset($_POST["do_reg_account"])) {
$tsData = [
"username" => setProtect(strtolower($_POST["username"])),
"password" => setProtect($_POST["password"]),
"domain" => setProtect(strtolower($_POST["domain"])),
"email" => setProtect(strtolower($_POST["email"])),
"plan" => setProtect($_POST["plan"]),
];
if (!isset($tsData["username"]) || empty($tsData["username"])) {
$message = [0, "The Username is required"];
} elseif (strlen($tsData["username"]) < 8 || strlen($tsData["username"]) > 12) {
$message = [0, "The username must be 8 characters."];
} elseif (!preg_match("/^[a-zA-Z0-9]{4,16}$/", $tsData["username"])) {
$message = [0, "The username does not allow strange characters."];
} elseif (strlen($tsData["password"]) < 6 || strlen($tsData["password"]) > 35) {
$message = [0, "Enter a minimum password of 6 to 35 characters."];
} elseif (strlen($tsData["domain"]) < 4) {
$message = [0, "Enter a domain name or sub-domain."];
} elseif (strlen($tsData["domain"]) > 35) {
$message = [0, "The domain can not exceed 35 characters."];
} elseif (!mb_ereg("^([a-zA-Z0-9]+).([a-zA-Z0-9-]+).([a-zA-Z]{2,4})$", $tsData["domain"])) {
$message = [0, "The domain does not have a valid extension. Check it."];
} elseif (preg_match("/(^.*)\.(tk)$/i", $tsData["domain"])) {
// To not allow domains.tk
$message = [0, "Domain extension is not allowed on this server."];
} elseif (!mb_ereg("^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,3})$", $tsData["email"])) {
$message = [0, "The email does not have a valid format, check it."];
} elseif (strlen($tsData["email"]) > 35) {
$message = [0, "The email can not exceed 35 characters."];
} elseif (empty($tsData["plan"])) {
$message = [0, "You must select a hosting plan."];
} else {
$client = Api::init($config);
$client->createAccount([
"username" => $tsData["username"], // A unique, 8 character identifier of the account.
"password" => $tsData["password"], // A password to login to the control panel, FTP MySQL and cPanel.
"domain" => $tsData["domain"], // Can be a subdomain or a custom domain.
"email" => $tsData["email"], // The email address of the user.
"plan" => $tsData["plan"], // A hosting plan for the account.
]);
$message = $client->message;
}
}

View file

@ -0,0 +1,30 @@
<?php
if (!defined('IN_SYS')) {
// exit('禁止访问');
header("Location: ../../admin.php");
exit;
}
if (isset($_POST["do_disable_account"])) {
$tsData = array(
"username" => setProtect(strtolower($_POST["username"])),
"reason" => setProtect($_POST["reason"]),
);
if (!isset($tsData["username"]) || empty($tsData["username"])) {
$message = [0, "The username is required."];
} elseif (strlen($tsData["username"]) < 4 || strlen($tsData["username"]) > 8) {
$message = [0, "The Username must be 8 characters"];
} elseif (!preg_match("/^[a-zA-Z0-9]{4,16}$/", $tsData["username"])) {
$message = [0, "The Username does not allow strange characters"];
} elseif (strlen($tsData["reason"]) < 10 || strlen($tsData["reason"]) > 60) {
$message = [0, "You must enter a reason with a maximum of 60 characters"];
} else {
$client = Api::init($config);
$client->suspend([
"username" => setProtect(strtolower($tsData["username"])),
"reason" => setProtect($tsData["reason"]),
]);
$message = $client->message;
}
}

View file

@ -0,0 +1,24 @@
<?php
if (!defined('IN_SYS')) {
// exit('禁止访问');
header("Location: ../../admin.php");
exit;
}
if (isset($_POST["do_get_domains"])) {
$tsData = array(
"username" => setProtect(strtolower($_POST["username"])),
);
if (!isset($tsData["username"]) || empty($tsData["username"])) {
$message = [0, "The username is required."];
} elseif (strlen($tsData["username"]) < 4 || strlen($tsData["username"]) > 18) {
$message = [0, "Enter a username that is valid."];
} elseif (!preg_match("/^[a-zA-Z0-9-_]{4,16}$/", $tsData["username"])) {
$message = [0, "The username does not allow strange characters."];
} else {
$client = Api::init($config);
$client->getUserDomains(["username" => $tsData["username"]]);
$message = $client->message;
}
}

View file

@ -1,10 +1,10 @@
<?php
if (!defined('IN_SYS')) {
// exit('禁止访问');
header("Location: ../index.php");
header("Location: ../../admin.php");
exit;
}
// test data
$member = [
[

View file

@ -0,0 +1,31 @@
<?php
if (!defined('IN_SYS')) {
// exit('禁止访问');
header("Location: ../admin.php");
exit;
}
if (isset($_POST["do_set_password"])) {
$tsData = array(
"username" => setProtect(strtolower($_POST["username"])),
"password" => setProtect($_POST["password"]),
);
if (!isset($tsData["username"]) || empty($tsData["username"])) {
$message = [0, "The username is required"];
} elseif (strlen($tsData["username"]) < 4 || strlen($tsData["username"]) > 8) {
$message = [0, "The username must be 8 characters."];
} elseif (!preg_match("/^[a-zA-Z0-9]{4,16}$/", $tsData["username"])) {
$message = [0, "The username does not allow strange characters."];
} elseif (strlen($tsData["password"]) < 6 || strlen($tsData["password"]) > 35) {
$message = [0, "Enter a minimum password of 6 to 35 characters."];
} else {
$client = Api::init($config);
$client->password([
"username" => $tsData["username"],
"password" => $tsData["password"],
"enabledigest" => 1, // [enabledigest] Change the password in cPanel - FTP - MySQL
]);
$message = $client->message;
}
}

View file

@ -0,0 +1,47 @@
<?php
if (!defined('IN_SYS')) {
// exit('禁止访问');
header("Location: ../../admin.php");
exit;
}
if (isset($_POST["do_check_status"])) {
$tsData = array(
"username" => setProtect(strtolower($_POST["username"])),
);
if (!isset($tsData["username"]) || empty($tsData["username"])) {
$message = [0, "The username is required."];
} elseif (strlen($tsData["username"]) < 4 || strlen($tsData["username"]) > 18) {
$message = [0, "Enter a username that is valid."];
} elseif (!preg_match("/^[a-zA-Z0-9-_]{4,16}$/", $tsData["username"])) {
$message = [0, "The username does not allow strange characters."];
} else {
$client = Api::init($config);
$client->getUserDomains(["username" => $tsData["username"]]);
// if ($this->data != "null" && strpos($this->response, '[[') === 0) {
// $statuses = array_unique(array_map(function ($item) {
// return strtolower($item["status"]);
// }, $this->domain));
// // print_r($statuses);
// if (count($statuses) == 1) {
// return $statuses[0];
// } elseif (count($statuses) > 1) {
// return "The account domains have different statuses <b>" . $this->getUserName() . "</b>." . $this->data;
// } else {
// return null;
// }
// } else {
// return null;
// }
if ($client->getStatus() === "active") {
$message = [1, "<b>The account </b> " . $tsData["username"] . " is Actived"];
} elseif ($client->getStatus() === "suspend") {
$message = [1, "<b>The account </b> " . $tsData["username"] . " is Suspend"];
} else {
"Cannot find the specified associated account";
$message = [0, "The account <b>" . $tsData["username"] . "</b> does not have associated accounts."];
}
}
}

View file

@ -5,27 +5,6 @@ if (!defined('IN_SYS')) {
header("Location: ../admin.php");
exit;
}
$session_name = session_name();
if (!isset($_COOKIE[$session_name])) {
foreach ($_COOKIE as $key => $val) {
$key = strtoupper($key);
if (strpos($key, $session_name)) {
session_id($_COOKIE[$key]);
}
}
}
session_start();
$is_admin = isset($_SESSION["is_login"]) && $_SESSION["is_login"] == true;
$section = !$is_admin ? "login" : (empty($_GET["s"]) ? "main" : $_GET["s"]);
// print(session_id());
// echo $_COOKIE["session_id"];
// print($_COOKIE(["session_id"]));
// print($is_admin);
$message = [];
$section_title = "Main";
switch ($section) {
case "main":

View file

@ -0,0 +1,29 @@
<?php
if (!defined('IN_SYS')) {
// exit('禁止访问');
header("Location: ../../admin.php");
exit;
}
if (isset($_POST["do_check_domain"])) {
$tsData = array(
"domain" => setProtect(strtolower($_POST["domain"])),
);
if (!isset($tsData["domain"]) || empty($tsData["domain"])) {
$message = [0, "The domain is required."];
} elseif (strlen($tsData["domain"]) < 4) {
$message = [0, "Enter a domain name or sub-domain."];
} elseif (strlen($tsData["domain"]) > 50) {
$message = [0, "The domain can not exceed 50 characters."];
} elseif (!mb_ereg("^([a-zA-Z0-9]+).([a-zA-Z0-9-]+).([a-zA-Z]{2,4})$", $tsData["domain"])) {
$message = [0, "The domain does not have a valid extension. Check it."];
} elseif (preg_match("/(^.*)\.(tk)$/i", $tsData["domain"])) {
// To not allow domains.tk
$message = [0, "The domain extension is not allowed on this server."];
} else {
$client = Api::init($config);
$client->availability(["domain" => $tsData["domain"]]);
$message = $client->message;
}
}

View file

@ -0,0 +1,30 @@
<?php
if (!defined('IN_SYS')) {
// exit('禁止访问');
header("Location: ../../admin.php");
exit;
}
if (isset($_POST["do_login"])) {
$username = setProtect(strtolower(trim($_POST["username"])));
$password = setProtect(strtolower(trim($_POST["password"])));
$captcha = setProtect(strtolower($_POST["captcha"]));
if (!isset($username) || empty($username)) {
$message = [0, "The username is required."];
} elseif (!isset($password) || empty($password)) {
$message = [0, "The password is required."];
} elseif (!isset($captcha) || empty($captcha)) {
$message = [0, "The captcha code is required."];
} else {
if (!isset($_SESSION["admincaptchacode"]) || $captcha != strtolower($_SESSION["admincaptchacode"])) {
$message = [0, "The captcha code is invalid."];
} elseif ($username == $admin["username"] && $password == $admin["password"]) {
$_SESSION["isAdminLoggedIn"] = true;
$message = [1, "Login successfully. 2 seconds later redirect to the main page"];
header("refresh:2;url=admin.php");
} else {
$message = [0, "Login failed.Please check if the account or password is correct."];
}
}
}

View file

@ -0,0 +1,12 @@
<?php
if (!defined('IN_SYS')) {
// exit('禁止访问');
header("Location: ../../admin.php");
exit;
}
unset($_SESSION);
// session_destroy();
setMsg("msg", "Logout successfully. 2 seconds later redirect to the login page.");
header("refresh:2;url=admin.php");

View file

@ -0,0 +1,8 @@
<?php
if (!defined('IN_SYS')) {
// exit('禁止访问');
header("Location: ../../admin.php");
exit;
}

11
admin/library.php Normal file
View file

@ -0,0 +1,11 @@
<?php
function isAdminLoggedIn()
{
if (isset($_SESSION["isAdminLoggedIn"]) && $_SESSION["isAdminLoggedIn"] == true) {
return true;
} else {
return false;
}
}

16
admin/views/aaa.php Normal file
View file

@ -0,0 +1,16 @@
<?php
if (!defined('IN_SYS')) {
// exit('禁止访问');
header("Location: ../../admin.php");
exit;
}
?>
<div class="container">
<div class="row">
<div class="col-md-12 col-sm-12">
<h2><?php echo $section_title; ?></h2>
</div>
</div>
</div>

View file

@ -0,0 +1,33 @@
<?php
if (!defined('IN_SYS')) {
// exit('禁止访问');
header("Location: ../../admin.php");
exit;
}
?>
<div class="container">
<div class="row">
<div class="col-md-12 col-sm-12">
<h2>Account Activate</h2>
<form action="" method="POST">
<label>
<span>Account: <small>(It is the 8 characters)</small></span>
<input type="text" name="username" class="form-control" maxlength="8" placeholder="Account: (It is the 8 characters)">
</label>
<button type="submit" name="do_activate_account" class="btn btn-primary">Save Settings</button>
</form>
<?php if ($message) { ?>
<hr />
<div class="alert <?php echo empty($message[0]) ? 'alert-danger' : 'alert-success'; ?>">
<p><?php echo $message[1]; ?></p>
<?php if (isset($message[2]) && ($message[2])) {
echo "<p>response data:</p><pre>";
print_r($message[2]);
echo "</pre>";
} ?>
</div>
<?php } ?>
</div>
</div>
</div>

View file

@ -0,0 +1,53 @@
<?php
if (!defined('IN_SYS')) {
// exit('禁止访问');
header("Location: ../../admin.php");
exit;
}
?>
<div class="container">
<div class="row">
<div class="col-md-12 col-sm-12">
<h2>Account Add</h2>
<form action="" method="POST">
<label>
<span>Account:</span>
<input type="text" name="username" value="" class="form-control" maxlength="8" placeholder="Account of 8 characters">
</label>
<label>
<span>Password:</span>
<input type="password" name="password" value="" class="form-control" maxlength="35" placeholder="Password">
</label>
<label>
<span>Domain or Sub-domain:</span>
<input type="text" name="domain" value="" class="form-control" maxlength="35" placeholder="example.com">
</label>
<label>
<span>Email Address:</span>
<input type="text" name="email" value="" class="form-control" maxlength="35" placeholder="email@example.com">
</label>
<label>
<span>Select a Hosting Plan:</span>
<select name="plan" class="form-control">
<?php foreach ($config['plan'] as $key => $value) { ?>
<option value="<?php echo $key; ?>"><?php echo $value; ?></option>
<?php } ?>
</select>
</label>
<button type="submit" name="do_reg_account" class="btn btn-primary">Register Account</button>
</form>
<?php if ($message) { ?>
<hr />
<div class="alert <?php echo empty($message[0]) ? 'alert-danger' : 'alert-success'; ?>">
<p><?php echo $message[1]; ?></p>
<?php if (isset($message[2]) && ($message[2])) {
echo "<p>response data:</p><pre>";
print_r($message[2]);
echo "</pre>";
} ?>
</div>
<?php } ?>
</div>
</div>
</div>

View file

@ -0,0 +1,37 @@
<?php
if (!defined('IN_SYS')) {
// exit('禁止访问');
header("Location: ../../admin.php");
exit;
}
?>
<div class="container">
<div class="row">
<div class="col-md-12 col-sm-12">
<h2>Account Suspend</h2>
<form action="" method="POST">
<label>
<span>Account: <small>(It is the 8 characters)</small></span>
<input type="text" name="username" class="form-control" maxlength="8" placeholder="Account: (It is the 8 characters)">
</label>
<label>
<span>Reason for deactivation:</span>
<input type="text" name="reason" class="form-control" maxlength="60" placeholder="Reason or some message">
</label>
<button type="submit" name="do_disable_account" class="btn btn-primary">Save Settings</button>
</form>
<?php if ($message) { ?>
<hr />
<div class="alert <?php echo empty($message[0]) ? 'alert-danger' : 'alert-success'; ?>">
<p><?php echo $message[1]; ?></p>
<?php if (isset($message[2]) && ($message[2])) {
echo "<p>response data:</p><pre>";
print_r($message[2]);
echo "</pre>";
} ?>
</div>
<?php } ?>
</div>
</div>
</div>

View file

@ -0,0 +1,33 @@
<?php
if (!defined('IN_SYS')) {
// exit('禁止访问');
header("Location: ../../admin.php");
exit;
}
?>
<div class="container">
<div class="row">
<div class="col-md-12 col-sm-12">
<h2>Account Domains</h2>
<form action="" method="POST">
<label>
<span>VistaPanel Username: <small>(Example: uii_12345678)</small></span>
<input type="text" name="username" class="form-control" maxlength="18" placeholder="VPanel Username (Example: uii_12345678)">
</label>
<button type="submit" name="do_get_domains" class="btn btn-primary">View Domain</button>
</form>
<?php if ($message) { ?>
<hr />
<div class="alert <?php echo empty($message[0]) ? 'alert-danger' : 'alert-success'; ?>">
<p><?php echo $message[1]; ?></p>
<?php if (isset($message[2]) && ($message[2])) {
echo "<p>response data:</p><pre>";
print_r($message[2]);
echo "</pre>";
} ?>
</div>
<?php } ?>
</div>
</div>
</div>

View file

@ -0,0 +1,65 @@
<?php
if (!defined('IN_SYS')) {
// exit('禁止访问');
header("Location: ../../admin.php");
exit;
}
?>
<div class="container">
<div class="row">
<div class="col-md-12 col-sm-12">
<h2>Account List</h2>
<div class="table-responsive">
<table class="table table-bordered table-hover">
<thead>
<tr>
<th>#</th>
<th>Branch</th>
<th>Account</th>
<th>Username</th>
<th>Email</th>
<th>Domain</th>
<th>Plan</th>
<th>Password</th>
<th>Nameserver</th>
<th>Operate</th>
</tr>
</thead>
<tbody>
<?php foreach ($member as $key => $value) { ?>
<tr>
<th><?php echo $key + 1; ?></th>
<td><?php echo $value["branch"]; ?></td>
<td><?php echo $value["account"]; ?></td>
<td><?php echo $value["username"]; ?></td>
<td><?php echo $value["email"]; ?></td>
<td><?php echo implode(",", $value["domain"]); ?></td>
<td><?php echo $value["plan"]; ?></td>
<td><?php echo $value["password"]; ?></td>
<td><?php echo implode(",", $value["nameserver"]); ?></td>
<td style="width: 206px;">
<a class="btn btn-default btn-xs" href="#" role="button"><?php echo $LANG['login']; ?></a>
<button class="btn btn-default btn-xs" type="submit">View</button>
<button class="btn btn-default btn-xs" type="submit">Active</button>
<button class="btn btn-default btn-xs" type="submit">Disable</button>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<?php if ($message) { ?>
<hr />
<div class="alert <?php echo empty($message[0]) ? 'alert-danger' : 'alert-success'; ?>">
<p><?php echo $message[1]; ?></p>
<?php if (isset($message[2]) && ($message[2])) {
echo "<p>response data:</p><pre>";
print_r($message[2]);
echo "</pre>";
} ?>
</div>
<?php } ?>
</div>
</div>
</div>

View file

@ -0,0 +1,38 @@
<?php
if (!defined('IN_SYS')) {
// exit('禁止访问');
header("Location: ../../admin.php");
exit;
}
?>
<div class="container">
<div class="row">
<div class="col-md-12 col-sm-12">
<h2>Account Password</h2>
<form action="" method="POST">
<!-- Reset Password -->
<label>
<span>Account: <small>(It is the 8 characters)</small></span>
<input type="text" name="username" class="form-control" maxlength="8" placeholder="Account: (It is the 8 characters)">
</label>
<label>
<span>New Password:</span>
<input type="password" name="password" class="form-control" maxlength="35" placeholder="Password">
</label>
<button type="submit" name="do_set_password" class="btn btn-primary">Set Password</button>
</form>
<?php if ($message) { ?>
<hr />
<div class="alert <?php echo empty($message[0]) ? 'alert-danger' : 'alert-success'; ?>">
<p><?php echo $message[1]; ?></p>
<?php if (isset($message[2]) && ($message[2])) {
echo "<p>response data:</p><pre>";
print_r($message[2]);
echo "</pre>";
} ?>
</div>
<?php } ?>
</div>
</div>
</div>

View file

@ -0,0 +1,33 @@
<?php
if (!defined('IN_SYS')) {
// exit('禁止访问');
header("Location: ../../admin.php");
exit;
}
?>
<div class="container">
<div class="row">
<div class="col-md-12 col-sm-12">
<h2>Account Status</h2>
<form action="" method="POST">
<label>
<span>VistaPanel Username: <small>(Example: uii_12345678)</small></span>
<input type="text" name="username" class="form-control" maxlength="18" placeholder="VPanel Username (Example: uii_12345678)">
</label>
<button type="submit" name="do_check_status" class="btn btn-primary">Check Status</button>
</form>
<?php if ($message) { ?>
<hr />
<div class="alert <?php echo empty($message[0]) ? 'alert-danger' : 'alert-success'; ?>">
<p><?php echo $message[1]; ?></p>
<?php if (isset($message[2]) && ($message[2])) {
echo "<p>response data:</p><pre>";
print_r($message[2]);
echo "</pre>";
} ?>
</div>
<?php } ?>
</div>
</div>
</div>

View file

@ -0,0 +1,45 @@
<?php
if (!defined('IN_SYS')) {
// exit('禁止访问');
header("Location: ../../admin.php");
exit;
}
?>
<?php echo getMsg("msg_notify"); ?>
<div class="container">
<div class="row">
<div class="col-md-12 col-sm-12">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Check Domain</h3>
</div>
<div class="panel-body">
<h2>Check Domain</h2>
<form action="" method="POST">
<p>Verify the domain is available for registration</p>
<label>
<!-- <span>Account:</span> -->
<input type="text" name="domain" class="form-control" maxlength="50" placeholder="Enter a domain or sub-domain">
</label>
<button type="submit" name="do_check_domain" class="btn btn-primary">Verify domain</button>
</form>
<?php if ($message) { ?>
<hr />
<div class="alert <?php echo empty($message[0]) ? 'alert-danger' : 'alert-success'; ?>">
<p><?php echo $message[1]; ?></p>
<?php if (isset($message[2]) && ($message[2])) {
echo "<p>response data:</p><pre>";
print_r($message[2]);
echo "</pre>";
} ?>
</div>
<?php } ?>
</div>
<div class="panel-footer">
<a href="<?php echo setRouter('clientarea', 'forget_password'); ?>" class="btn btn-link">Forget Passsword?</a>
<a href="<?php echo setRouter('clientarea', 'register'); ?>" class="btn btn-link">No account? Register</a>
</div>
</div>
</div>
</div>
</div>

View file

@ -1,7 +1,7 @@
<?php
if (!defined('IN_SYS')) {
// exit('禁止访问');
header("Location: ../admin.php");
header("Location: ../../admin.php");
exit;
}
?>

34
admin/views/header.php Normal file
View file

@ -0,0 +1,34 @@
<?php
if (!defined('IN_SYS')) {
// exit('禁止访问');
header("Location: ../../admin.php");
exit;
}
?>
<!DOCTYPE html>
<html lang="<?php echo $current_lang; ?>">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
<meta name="description" content="<?php echo $description; ?>">
<meta name="author" content="<?php echo $author; ?>">
<title><?php echo $title; ?> - Content Management System for Reseller of MyOwnFreeHost</title>
<link href="assets/bootstrap/css/bootstrap.min.css?_=<?php echo $static_release; ?>" rel="stylesheet" />
<link href="assets/css/style.css?_=<?php echo $static_release; ?>" rel="stylesheet" />
<link href="assets/css/admin.css?_=<?php echo $static_release; ?>" rel="stylesheet" />
<link href="favicon.ico?_=<?php echo $static_release; ?>" type="image/x-icon" rel="icon" />
<link href="favicon.ico?_=<?php echo $static_release; ?>" type="image/x-icon" rel="shortcut icon" />
<!--[if lt IE 9]>
<script src="assets/html5shiv/html5shiv.min.js"></script>
<script src="assets/respond/respond.min.js"></script>
<![endif]-->
<script type="text/javascript">
var domain = "<?php echo $lang->getDomain(); ?>";
var cur_lang = "<?php echo $current_lang; ?>";
var ifastnet_aff = <?php echo $iFastNetAff; ?>;
</script>
</head>
<body>

View file

@ -0,0 +1,11 @@
<?php
if (!defined('IN_SYS')) {
// exit('禁止访问');
header("Location: ../../admin.php");
exit;
}
?>
<div class="container">
<div class="alert alert-dismissible alert-danger">Please delete the <b>install.php</b> file.</div>
</div>

54
admin/views/login.php Normal file
View file

@ -0,0 +1,54 @@
<?php
if (!defined('IN_SYS')) {
// exit('禁止访问');
header("Location: ../../admin.php");
exit;
}
?>
<div class="container">
<div class="row">
<div class="col-md-6 col-sm-6 margin-auto">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Admin Login</h3>
</div>
<div class="panel-body">
<?php if (!isAdminLoggedIn()) { ?>
<form action="" method="POST" class="form-horizontal">
<label>
<span>Admin:</span>
<input type="text" name="username" class="form-control" maxlength="18" placeholder="Admin Username" autofocus required>
</label>
<label>
<span>Password:</span>
<input type="password" name="password" class="form-control" maxlength="35" placeholder="Admin Password" required>
</label>
<label>
<span>Captcha:</span>
<input type="text" name="captcha" class="form-control" maxlength="18" placeholder="CAPTCHA" required autocomplete="off">
</label>
<button type="submit" name="do_login" class="btn btn-primary"><?php echo $LANG['login']; ?></button>
</form>
<?php } elseif (isAdminLoggedIn() && !isset($message[0])) { ?>
<div class="alert alert-success">You have logged in</div>
<?php } ?>
<?php if ($message) { ?>
<hr />
<div class="alert <?php echo empty($message[0]) ? 'alert-danger' : 'alert-success'; ?>">
<p><?php echo $message[1]; ?></p>
<?php if (isset($message[2]) && ($message[2])) {
echo "<p>response data:</p><pre>";
print_r($message[2]);
echo "</pre>";
} ?>
</div>
<?php } ?>
</div>
<div class="panel-footer text-right">
<a href="<?php echo setRouter('admin', 'forget_password'); ?>">Forget Passsword?</a>
</div>
</div>
</div>
</div>
</div>

22
admin/views/logout.php Normal file
View file

@ -0,0 +1,22 @@
<?php
if (!defined('IN_SYS')) {
// exit('禁止访问');
header("Location: ../../admin.php");
exit;
}
?>
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Admin Logout</h3>
</div>
<div class="panel-body">
<?php echo getMsg("msg"); ?>
</div>
</div>
</div>
</div>
</div>

37
admin/views/main.php Normal file
View file

@ -0,0 +1,37 @@
<?php
if (!defined('IN_SYS')) {
// exit('禁止访问');
header("Location: ../../admin.php");
exit;
}
?>
<div class="container">
<div class="row">
<div class="col-md-12">
<?php echo getMsg("msg_notify"); ?>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Hosting Account Management System</h3>
</div>
<div class="panel-body">
<h1>Hosting Account Management System</h1>
<p class="lead">This is a simple script for WHM myownfreehost made to manage hosting accounts through the api assigned to users with free reseller accounts.</p>
<b>Available Functions:</b>
<ol>
<li>Verify if a domain is available.</li>
<li>Creation of account hosting from the panel.</li>
<li>Change password to hosting account.</li>
<li>Deactivate or disable a hosting account.</li>
<li>Activate or enable hosting account.</li>
<li>Verify how many domain and state of the hosting account.</li>
</ol>
</div>
<div class="panel-footer">
<a href="<?php echo setRouter('clientarea', 'forget_password'); ?>" class="btn btn-link">Forget Passsword?</a>
<a href="<?php echo setRouter('clientarea', 'register'); ?>" class="btn btn-link">No account? Register</a>
</div>
</div>
</div>
</div>
</div>

59
admin/views/navbar.php Normal file
View file

@ -0,0 +1,59 @@
<?php
if (!defined('IN_SYS')) {
// exit('禁止访问');
header("Location: ../../admin.php");
exit;
}
?>
<div class="container">
<nav class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="<?php echo setRouter('index'); ?>"><?php echo $brandName; ?></a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="<?php echo setRouter('admin'); ?>"><?php echo I18N('home'); ?></a></li>
<?php if (isAdminLoggedIn()) { ?>
<li class="dropdown">
<a href="javascript:void(0)" class="dropdown-toggle" data-toggle="dropdown">Account&nbsp;<span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li class="dropdown-header">Account Management</li>
<li><a href="<?php echo setRouter('admin', 'check_domain'); ?>">Check Domain</a></li>
<li><a href="<?php echo setRouter('admin', 'account_list'); ?>">Account List</a></li>
<li><a href="<?php echo setRouter('admin', 'account_add'); ?>">Account Add</a></li>
<li><a href="<?php echo setRouter('admin', 'account_password'); ?>">Account Password</a></li>
<li><a href="<?php echo setRouter('admin', 'account_active'); ?>">Account Activate</a></li>
<li><a href="<?php echo setRouter('admin', 'account_status'); ?>">Account Status</a></li>
<li><a href="<?php echo setRouter('admin', 'account_domain'); ?>">Account Domains</a></li>
<li class="divider"></li>
<li><a href="<?php echo setRouter('admin', 'account_disable'); ?>">Account Suspend</a></li>
</ul>
</li>
<?php } ?>
</ul>
<ul class="nav navbar-nav navbar-right">
<?php if (isAdminLoggedIn()) { ?>
<li><a href="<?php echo setRouter('admin', 'logout'); ?>">Logout</a></li>
<?php } else { ?>
<li><a href="<?php echo setRouter('admin', 'login'); ?>"><?php echo I18N('login'); ?></a></li>
<?php } ?>
<li><a href="<?php echo setRouter('clientarea'); ?>"><?php echo I18N('ClientArea'); ?></a></li>
</ul>
</div>
</div>
<a class="hidden-xs" href="https://github.com/uiisc/uiisc.com" title="Source on Github" target="_blank">
<svg class="octocat" viewBox="0 0 250 250" style="border: 0;color: #f4f5f6;fill: #5e6772;height: 5.2rem;width: 5.2rem;position: fixed;right: 0;top: 0;z-index: 1">
<path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path>
<path class="octocat-arm" d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2"></path>
<path class="octocat-body" d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z"></path>
</svg></a>
</nav>
</div>

222
adminbak.php Normal file
View file

@ -0,0 +1,222 @@
<?php
// ini_set("display_errors", false);
define("IN_SYS", true);
require_once("core.php");
// $INDEX = __FILE__;
include_once "{$ROOT}/include/common.php";
include_once "{$ROOT}/lib/api.php";
include_once "{$ROOT}/controllers/admin.php";
getVersion();
if (!file_exists("{$ROOT}/data/installed") || !isset($config) || $config['apiUsername'] == '#getUsername#' || $config['apiPassword'] == '#getPassword#') {
header('Location: ./install.php');
}
?>
<?php include("include/admin_header.php"); ?>
<?php if (file_exists("{$ROOT}/install.php")) { ?>
<div class="container">
<div class="alert alert-dismissible alert-danger">Please delete the <b>install.php</b> file.</div>
</div>
<?php } ?>
<div class="container">
<?php if ($is_admin) { ?>
<div class="row">
<div class="col-md-12">
<a class="btn btn-default" href="admin.php?s=check_domain" role="button">Check Domain</a>
<a class="btn btn-default" href="admin.php?s=account_list" role="button">List</a>
<a class="btn btn-default" href="admin.php?s=account_add" role="button">Add</a>
<a class="btn btn-default" href="admin.php?s=account_password" role="button">Password</a>
<a class="btn btn-default" href="admin.php?s=account_disable" role="button">Suspend</a>
<a class="btn btn-default" href="admin.php?s=account_active" role="button">Activate</a>
<a class="btn btn-default" href="admin.php?s=account_status" role="button">Status</a>
<a class="btn btn-default" href="admin.php?s=account_domain" role="button">Domains</a>
</div>
</div>
<?php } ?>
<div class="row">
<div class="col-md-12 col-sm-12">
<?php if ($section == 'main') { ?>
<h1>Hosting Account Management System</h1>
<p class="lead">This is a simple script for WHM myownfreehost made to manage hosting accounts through the api assigned to users with free reseller accounts.</p>
<b>Available Functions:</b>
<ol>
<li>Verify if a domain is available.</li>
<li>Creation of account hosting from the panel.</li>
<li>Change password to hosting account.</li>
<li>Deactivate or disable a hosting account.</li>
<li>Activate or enable hosting account.</li>
<li>Verify how many domain and state of the hosting account.</li>
</ol>
<?php } else { ?>
<h2><?php echo $section_title; ?></h2>
<?php if ($section == 'check_domain') { ?>
<form action="" method="POST">
<p>Verify the domain is available for registration</p>
<label>
<!-- <span>Account:</span> -->
<input type="text" name="domain" class="form-control" maxlength="50" placeholder="Enter a domain or sub-domain">
</label>
<button type="submit" name="do_check_domain" class="btn btn-primary">Verify domain</button>
</form>
<?php } elseif ($section == 'account_list') {; ?>
<div class="table-responsive">
<table class="table table-bordered table-hover">
<thead>
<tr>
<th>#</th>
<th>Branch</th>
<th>Account</th>
<th>Username</th>
<th>Email</th>
<th>Domain</th>
<th>Plan</th>
<th>Password</th>
<th>Nameserver</th>
<th>Operate</th>
</tr>
</thead>
<tbody>
<?php foreach ($member as $key => $value) { ?>
<tr>
<th><?php echo $key + 1; ?></th>
<td><?php echo $value["branch"]; ?></td>
<td><?php echo $value["account"]; ?></td>
<td><?php echo $value["username"]; ?></td>
<td><?php echo $value["email"]; ?></td>
<td><?php echo implode(",", $value["domain"]); ?></td>
<td><?php echo $value["plan"]; ?></td>
<td><?php echo $value["password"]; ?></td>
<td><?php echo implode(",", $value["nameserver"]); ?></td>
<td style="width: 206px;">
<a class="btn btn-default btn-xs" href="#" role="button"><?php echo $LANG['login']; ?></a>
<button class="btn btn-default btn-xs" type="submit">View</button>
<button class="btn btn-default btn-xs" type="submit">Active</button>
<button class="btn btn-default btn-xs" type="submit">Disable</button>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<?php } elseif ($section == 'account_add') {; ?>
<form action="" method="POST">
<label>
<span>Account:</span>
<input type="text" name="username" value="" class="form-control" maxlength="8" placeholder="Account of 8 characters">
</label>
<label>
<span>Password:</span>
<input type="password" name="password" value="" class="form-control" maxlength="35" placeholder="Password">
</label>
<label>
<span>Domain or Sub-domain:</span>
<input type="text" name="domain" value="" class="form-control" maxlength="35" placeholder="example.com">
</label>
<label>
<span>Email Address:</span>
<input type="text" name="email" value="" class="form-control" maxlength="35" placeholder="email@example.com">
</label>
<label>
<span>Select a Hosting Plan:</span>
<select name="plan" class="form-control">
<?php foreach ($config['plan'] as $key => $value) { ?>
<option value="<?php echo $key; ?>"><?php echo $value; ?></option>
<?php } ?>
</select>
</label>
<button type="submit" name="do_reg_account" class="btn btn-primary">Register Account</button>
</form>
<?php } elseif ($section == 'account_password') {; ?>
<form action="" method="POST">
<!-- Reset Password -->
<label>
<span>Account: <small>(It is the 8 characters)</small></span>
<input type="text" name="username" class="form-control" maxlength="8" placeholder="Account: (It is the 8 characters)">
</label>
<label>
<span>New Password:</span>
<input type="password" name="password" class="form-control" maxlength="35" placeholder="Password">
</label>
<button type="submit" name="do_set_password" class="btn btn-primary">Set Password</button>
</form>
<?php } elseif ($section == 'account_disable') {; ?>
<form action="" method="POST">
<label>
<span>Account: <small>(It is the 8 characters)</small></span>
<input type="text" name="username" class="form-control" maxlength="8" placeholder="Account: (It is the 8 characters)">
</label>
<label>
<span>Reason for deactivation:</span>
<input type="text" name="reason" class="form-control" maxlength="60" placeholder="Reason or some message">
</label>
<button type="submit" name="do_disable_account" class="btn btn-primary">Save Settings</button>
</form>
<?php } elseif ($section == 'account_active') {; ?>
<form action="" method="POST">
<label>
<span>Account: <small>(It is the 8 characters)</small></span>
<input type="text" name="username" class="form-control" maxlength="8" placeholder="Account: (It is the 8 characters)">
</label>
<button type="submit" name="do_activate_account" class="btn btn-primary">Save Settings</button>
</form>
<?php } elseif ($section == 'account_status') {; ?>
<form action="" method="POST">
<label>
<span>VistaPanel Username: <small>(Example: uii_12345678)</small></span>
<input type="text" name="username" class="form-control" maxlength="18" placeholder="VPanel Username (Example: uii_12345678)">
</label>
<button type="submit" name="do_check_status" class="btn btn-primary">Check Status</button>
</form>
<?php } elseif ($section == 'account_domain') {; ?>
<form action="" method="POST">
<label>
<span>VistaPanel Username: <small>(Example: uii_12345678)</small></span>
<input type="text" name="username" class="form-control" maxlength="18" placeholder="VPanel Username (Example: uii_12345678)">
</label>
<button type="submit" name="do_get_domains" class="btn btn-primary">View Domain</button>
</form>
<?php } elseif ($section == 'login') {; ?>
<?php if (!$is_admin) { ?>
<form action="" method="POST" class="form-horizontal">
<label>
<span>Admin:</span>
<input type="text" name="username" class="form-control" maxlength="18" placeholder="Admin Username" autofocus required>
</label>
<label>
<span>Password:</span>
<input type="password" name="password" class="form-control" maxlength="35" placeholder="Admin Password" required>
</label>
<label>
<span>Captcha:</span>
<input type="text" name="captcha" class="form-control" maxlength="18" placeholder="CAPTCHA" required autocomplete="off">
</label>
<button type="submit" name="do_login" class="btn btn-primary"><?php echo $LANG['login']; ?></button>
</form>
<?php } elseif ($is_admin && !isset($message[0])) { ?>
<div class="alert alert-success">You have logged in</div>
<?php } ?>
<?php }
if ($message) { ?>
<hr/>
<div class="alert <?php echo empty($message[0]) ? 'alert-danger' : 'alert-success'; ?>">
<p><?php echo $message[1]; ?></p>
<?php if (isset($message[2]) && ($message[2])) {
echo "<p>response data:</p><pre>";
print_r($message[2]);
echo "</pre>";
} ?>
</div>
<?php }
} ?>
</div>
</div>
</div>
<?php include("include/admin_footer.php"); ?>

View file

@ -25,6 +25,12 @@ button {
padding: 10px 0;
}
.margin-auto {
float: unset;
margin-left: auto;
margin-right: auto;
}
.home {
width: 100%;
height: 100%;

View file

@ -6,7 +6,7 @@ if (!defined('IN_SYS')) {
}
$ROOT = __DIR__;
include_once "{$ROOT}/data/config.php";
include_once "{$ROOT}/lib/language.php";
include_once "{$ROOT}/library/language.php";
$rooturl = $_SERVER['HTTP_HOST'];
$domain = preg_replace('/^www\./', '', $rooturl);

View file

@ -1,81 +0,0 @@
<?php
if (!defined('IN_SYS')) {
// exit('禁止访问');
header("Location: ../admin.php");
exit;
}
?>
<!DOCTYPE html>
<html lang="<?php echo $current_lang; ?>">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
<meta name="description" content="<?php echo $description; ?>">
<meta name="author" content="<?php echo $author; ?>">
<title><?php echo $title; ?> - Hosting Account Management System - <?php echo $section_title; ?></title>
<link href="assets/bootstrap/css/bootstrap.min.css?_=<?php echo $static_release; ?>" rel="stylesheet" />
<link href="assets/css/style.css?_=<?php echo $static_release; ?>" rel="stylesheet" />
<link href="assets/css/admin.css?_=<?php echo $static_release; ?>" rel="stylesheet" />
<link href="favicon.ico?_=<?php echo $static_release; ?>" type="image/x-icon" rel="icon" />
<link href="favicon.ico?_=<?php echo $static_release; ?>" type="image/x-icon" rel="shortcut icon" />
<!--[if lt IE 9]>
<script src="assets/html5shiv/html5shiv.min.js"></script>
<script src="assets/respond/respond.min.js"></script>
<![endif]-->
<script type="text/javascript">
var domain = "<?php echo $lang->getDomain(); ?>";
var cur_lang = "<?php echo $current_lang; ?>";
var ifastnet_aff = <?php echo $iFastNetAff; ?>;
</script>
</head>
<body>
<div class="container">
<nav class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="admin.php"><?php echo $brandName; ?></a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="index.php"><?php echo I18N('home'); ?></a></li>
<?php if ($is_admin) { ?>
<li class="dropdown">
<a href="javascript:void(0)" class="dropdown-toggle" data-toggle="dropdown">Account&nbsp;<span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li class="dropdown-header">Account Management</li>
<li><a href="admin.php?s=check_domain">Check Domain</a></li>
<li><a href="admin.php?s=account_list">Account List</a></li>
<li><a href="admin.php?s=account_add">Account Add</a></li>
<li><a href="admin.php?s=account_password">Account Password</a></li>
<li><a href="admin.php?s=account_active">Account Activate</a></li>
<li><a href="admin.php?s=account_status">Account Status</a></li>
<li><a href="admin.php?s=account_domain">Account Domains</a></li>
<li class="divider"></li>
<li><a href="admin.php?s=account_disable">Account Suspend</a></li>
</ul>
</li>
<?php } ?>
</ul>
<ul class="nav navbar-nav navbar-right">
<?php if ($is_admin) { ?>
<li><a href="admin.php?s=logout">Logout</a></li>
<?php } else { ?>
<li><a href="admin.php?s=login"><?php echo I18N('login'); ?></a></li>
<?php } ?>
<li><a href="index.php"><?php echo I18N('home'); ?></a></li>
</ul>
</div>
</div>
<a class="hidden-xs" href="https://github.com/uiisc/uiisc.com" title="Source on Github" target="_blank"><svg class="octocat" viewBox="0 0 250 250" style="border: 0;color: #f4f5f6;fill: #5e6772;height: 5.2rem;width: 5.2rem;position: fixed;right: 0;top: 0;z-index: 1"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path class="octocat-arm" d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2"></path><path class="octocat-body" d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z"></path></svg></a>
</nav>
</div>

View file

@ -4,15 +4,15 @@ require_once "core.php";
// $title = 'About UIISC';
$section = empty($_GET["s"]) ? "terms" : $_GET["s"];
include("include/header.php");
include("index/header.php");
switch ($section) {
case "privacy":
include("include/legal_privacy.php");
include("index/legal_privacy.php");
break;
case "terms":
default:
include("include/legal_terms.php");
include("index/legal_terms.php");
}
include("include/footer.php");
include("index/footer.php");

217
library/functions.php Normal file
View file

@ -0,0 +1,217 @@
<?php
function objDB()
{
$objDB = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
if ($objDB->connect_error) {
die("Connection not established");
}
return $objDB;
}
function upload_image($image)
{
if (!is_dir(APPROOT . "/images")) {
mkdir(APPROOT . "/images");
}
if ($image["error"] == 4) {
die("image file not uploaded");
}
if ($image["type"] != "image/png") {
die("Only, png image files are allowed");
}
$image_info = pathinfo($image["name"]);
extract($image_info);
$image_convention = $filename . time() . ".$extension";
if (move_uploaded_file($image["tmp_name"], APPROOT . "/images/" . $imageConvention)) {
return $image_convention;
} else {
return false;
}
}
function cTime($timestamp)
{
return date("Y-m-d H:i:s", $timestamp);
}
function checkUserByEmail($email)
{
$objDB = objDB();
$stmt = $objDB->prepare(
"SELECT * FROM users WHERE email=?"
);
$stmt->bind_param("s", $email);
$stmt->execute();
$stmt->store_result();
return $stmt->num_rows;
}
function checkUserByUsername($username)
{
$objDB = objDB();
$stmt = $objDB->prepare(
"SELECT * FROM users WHERE username=?"
);
$stmt->bind_param("s", $username);
$stmt->execute();
$stmt->store_result();
return $stmt->num_rows;
}
function checkUserActivation($username)
{
$objDB = objDB();
$stmt = $objDB->prepare(
"SELECT * FROM users WHERE username=? AND is_active=1"
);
$stmt->bind_param("s", $username);
$stmt->execute();
$stmt->store_result();
return $stmt->num_rows;
}
function setMsg($name, $value, $class = "success")
{
if (is_array($value)) {
$_SESSION[$name] = $value;
} else {
$_SESSION[$name] = "<div class='alert alert-$class text-center'>$value</div>";
}
}
function getMsg($name)
{
if (isset($_SESSION[$name])) {
$session = $_SESSION[$name];
unset($_SESSION[$name]);
return $session;
}
}
function getUserById($user_id)
{
$objDB = objDB();
$stmt = $objDB->prepare(
"SELECT * FROM users WHERE id=?"
);
$stmt->bind_param("i", $user_id);
$stmt->execute();
$result = $stmt->get_result();
return $result->fetch_object();
}
function verifyUserAccount($code)
{
$objDB = objDB();
$stmt = $objDB->prepare(
"UPDATE users SET is_active = 1 , reset_code = '' WHERE reset_code = ?"
);
$stmt->bind_param("s", $code);
$stmt->execute();
$stmt->store_result();
return $stmt->affected_rows;
}
function checkUserByCode($code)
{
$objDB = objDB();
$stmt = $objDB->prepare(
"SELECT * FROM users WHERE reset_code = ?"
);
$stmt->bind_param("s", $code);
$stmt->execute();
$stmt->store_result();
return $stmt->num_rows;
}
function isUserLoggedIn()
{
if (isset($_SESSION["user"]) || isset($_COOKIE["user"])) {
return true;
} else {
return false;
}
}
function get_userinfo()
{
return isUserLoggedIn() ? isset($_COOKIE["user"]) ? unserialize($_COOKIE["user"]) : $_SESSION["user"] : "";
}
function send_mail($detail = array())
{
if (!empty($detail["to"]) && !empty($detail["message"]) && !empty($detail["subject"])) {
$to = $detail["to"];
$totitle = isset($detail["totitle"]) ? $detail["totitle"] : "";
$from = SMTP_MAILADDR;
$fromtitle = isset($detail["fromtitle"]) ? $detail["fromtitle"] : "";
$subject = $detail["subject"];
$body = $detail["message"];
$mailtype = "HTML"; // HTML/TXT
$smtp = new MailSMTP(SMTP_SERVER, SMTP_PORT, true, SMTP_USERNAME, SMTP_PASSWORD);
$smtp->debug = false;
$res = $smtp->sendmail($to, $totitle, $from, $fromtitle, $subject, $body, $mailtype);
if (!$res) {
return false;
} else {
return true;
}
} else {
die("Your Mail Handler requires four main paramters");
}
}
/**
* redirect to functions URL
*/
function redirect($module, $section = "", $param = [])
{
$url = $param ? setRouter($module, $section) . "&" . http_build_query($param) : setRouter($module, $section);
// $param = $param ? http_build_query($param) : "";
// $url = $section ? setRouter($module, $section) . "&" . $param : setRouter($module) . "?" . $param;
header("Location: {$url}");
exit;
}
/** make router URL
* @param mixed $module
* @param mixed $section
* @return string
*/
function setRouter($module, $section = "")
{
return empty($section) ? "{$module}.php" : "{$module}.php?s=$section";
}
/** make a full path http URL
* @param mixed $module
* @param mixed $section
* @return string
*/
function setURL($module, $section = "")
{
return empty($section) ? URLROOT . "/{$module}.php" : URLROOT . "/{$module}.php?s=$section";
}
/** Determine if a variable is an email address
*
* @param string $email
* @return bool
*/
function is_email($email = "")
{
return preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,})$/", $email);
}