diff --git a/.htaccess b/.htaccess deleted file mode 100644 index ce70a3b..0000000 --- a/.htaccess +++ /dev/null @@ -1,5 +0,0 @@ -php_value display_errors Off -php_flag magic_quotes 1 -php_flag magic_quotes_gpc 1 -php_value mbstring.http_input auto -php_value date.timezone Asia/Shanghai diff --git a/admin/views/login.php b/admin/views/login.php index b3fe6d3..b39f098 100644 --- a/admin/views/login.php +++ b/admin/views/login.php @@ -11,22 +11,22 @@ if (!defined('IN_SYS')) {
-

Admin Login

+

Login

diff --git a/assets/css/admin.css b/assets/css/admin.css index 79ef638..0627ffe 100644 --- a/assets/css/admin.css +++ b/assets/css/admin.css @@ -24,7 +24,7 @@ label select { } input[name="captcha"] { - background: url(/include/captcha.php) no-repeat; + background-repeat: no-repeat; background-size: 160px 30px; background-position-x: right; background-position-y: center; diff --git a/clientarea.php b/clientarea.php index cbd6e16..b7f7e1d 100644 --- a/clientarea.php +++ b/clientarea.php @@ -2,14 +2,9 @@ session_start(); define('IN_SYS', true); +require_once("core.php"); -$ROOT = __DIR__; - -// include_once "{$ROOT}/lib/language.php"; -include_once "{$ROOT}/clientarea/data/config.php"; -include_once "{$ROOT}/clientarea/library/email.class.php"; -include_once "{$ROOT}/clientarea/library/functions.php"; - +include_once "{$ROOT}/library/email.class.php"; $section = empty($_GET["s"]) ? "main" : $_GET["s"]; $section_page = "{$ROOT}/clientarea/views/{$section}.php"; if (!is_file($section_page)) { diff --git a/clientarea/controllers/edit_details.php b/clientarea/controllers/edit_details.php index 1dbc9f6..ec54bab 100644 --- a/clientarea/controllers/edit_details.php +++ b/clientarea/controllers/edit_details.php @@ -35,7 +35,7 @@ if (isset($_POST["edit"])) { $errors["username_err"] = "Username min limit is 5 & max is 15 characters"; } - if (!isemail($email)) { + if (!is_email($email)) { $errors["email_err"] = "The email address is invalid."; } diff --git a/clientarea/controllers/forget_password.php b/clientarea/controllers/forget_password.php index a510cb2..90cb77b 100644 --- a/clientarea/controllers/forget_password.php +++ b/clientarea/controllers/forget_password.php @@ -19,7 +19,7 @@ if (isset($_POST["reset_request"])) { $email = filter_input(INPUT_POST, "email", FILTER_SANITIZE_EMAIL); if (empty($email)) { $errors["email_err"] = "The email address is empty."; - } elseif (!isemail($email)) { + } elseif (!is_email($email)) { $errors["email_err"] = "The email address is invalid."; } elseif (!checkUserByEmail($email)) { $errors["email_err"] = "The email address not found in system."; diff --git a/clientarea/controllers/register.php b/clientarea/controllers/register.php index 7d6856f..7556144 100644 --- a/clientarea/controllers/register.php +++ b/clientarea/controllers/register.php @@ -32,7 +32,7 @@ if (isset($_POST["register"])) { $errors["username_err"] = "Username already exists"; } - if (!isemail($email)) { + if (!is_email($email)) { $errors["email_err"] = "The email address is invalid."; } elseif (checkUserByEmail($email)) { $errors["email_err"] = "The email address already exists in system."; diff --git a/clientarea/controllers/request-account-activate.php b/clientarea/controllers/request-account-activate.php index cc1c9f7..11273a9 100644 --- a/clientarea/controllers/request-account-activate.php +++ b/clientarea/controllers/request-account-activate.php @@ -12,7 +12,7 @@ $data = getMsg("form_data"); if (isset($_POST["request-activate-account"])) { $errors = array(); $email = filter_input(INPUT_POST, "email", FILTER_SANITIZE_EMAIL); - if (!isemail($email)) { + if (!is_email($email)) { $errors["email_err"] = "The email address is invalid."; } elseif (!checkUserByEmail($email)) { $errors["email_err"] = "The email address not found in system."; diff --git a/clientarea/data/config.php b/clientarea/data/config.php deleted file mode 100644 index 85460d6..0000000 --- a/clientarea/data/config.php +++ /dev/null @@ -1,26 +0,0 @@ -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] = "
$value
"; - } -} - -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 isemail($email = "") -{ - return preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,})$/", $email); -} diff --git a/data/config.php b/data/config.php index ab751ea..ebea12a 100644 --- a/data/config.php +++ b/data/config.php @@ -5,6 +5,18 @@ if (!defined('IN_SYS')) { exit; } +define("URLROOT", "http://crogroup.cn"); +define("APPROOT", dirname(__FILE__)); +define("DB_HOST", "bv2g0ksp.hk1027lan.dnstoo.com:3306"); +define("DB_USER", "gcop2h_f"); +define("DB_PASSWORD", "gdwst6ob"); +define("DB_NAME", "gcop2h"); +define("SMTP_SERVER", "smtp.u-id.cn"); +define("SMTP_PORT", 25); +define("SMTP_MAILADDR", "croidc@u-id.cn"); +define("SMTP_USERNAME", "croidc@u-id.cn"); +define("SMTP_PASSWORD", "cro@IDC521"); + $static_release = '1559728996134'; $brandName = "UIISC"; $iFastNetAff = 19474; @@ -14,6 +26,7 @@ $title_s = "UIISC"; $author = 'Crogram Inc.'; $description = "uiisc, freewebhost, webhost, Crogram, iFastNet"; $google_site_verification = "5O6Wxt0gIyGb7btMuXiQqddZJ516n-xBOW_9RLMBeSY"; +$siteURL = "http://crogroup.cn"; $admin = [ "name" => "管理员", diff --git a/clientarea/data/demo.sql b/data/demo.sql similarity index 100% rename from clientarea/data/demo.sql rename to data/demo.sql diff --git a/include/index.php b/include/index.php deleted file mode 100644 index e88dc9e..0000000 --- a/include/index.php +++ /dev/null @@ -1,2 +0,0 @@ -