| Server IP : 210.245.233.93 / Your IP : 216.73.216.226 Web Server : Apache/2.2.15 (CentOS) System : Linux webserver2.onesolution.com.hk 2.6.32-754.35.1.el6.x86_64 #1 SMP Sat Nov 7 12:42:14 UTC 2020 x86_64 User : apache ( 48) PHP Version : 5.3.3 Disable Function : exec, shell_exec, system, passthru, popen, proc_open, pcntl_exec MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/hkosl.com/dashboard/webadmin/ |
Upload File : |
<?php
include 'config.php';
// Check if the user is logged in
if ((!isSet($_SESSION['loginname'])) || ($loggin <> '1')) {
header("Location: login.php");
exit;
}
require("configure.php");
require_once 'function_auth.php';
$strength = Password::strength($_POST["loginpw"], $_POST["username"]);
if (!$strength) {
exit('Insufficient password strength');
}
$loginpw = Password::hash($_POST["loginpw"]);
$nowdate = date("Y-m-d H:i:s");
//print_r($_POST);
$sth1 = $dbh->prepare("SELECT * FROM sys_cms_login where cmsloginname = ?");
//$sth1->execute(array($_POST["loginname"]));
if (!$sth1->execute(array($_POST["loginname"])))
throw new Exception('[' . $sth1->errorCode() . ']: ' . $sth1->errorInfo());
if ($sth1->fetchColumn() > 0) {
header("Location: sys_cms_user_index.php?msg=You have already been assigned a login name. ");
exit;
}
$sth2 = $dbh->prepare("select max(cmsloginid) as maxid from sys_cms_login ");
$sth2->execute();
$row2 = $sth2->fetch(PDO::FETCH_ASSOC);
$loginid = $row2{"maxid"} + 1;
$sth3 = $dbh->prepare("insert into sys_cms_login (cmsloginid, cmsusername, cmsloginname, cmsloginpw, cmsrole, cmsstatus, createdate, lastupdate) values (?, ?, ?, ?, ?, ?, ?, ?)");
//$sth3->execute(array($loginid, $_POST["username"], $_POST["loginname"], $loginpw, $_POST["role"], "1", $nowdate, $nowdate));
if (!$sth3->execute(array($loginid, $_POST["username"], $_POST["loginname"], $loginpw, $_POST["role"], "1", $nowdate, $nowdate)))
throw new Exception('[' . $sth3->errorCode() . ']: ' . $sth3->errorInfo());
$dbh = null;
header("Location: sys_cms_user_index.php?msg=Add Successful");
?>