| 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/citysuper/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';
if (strlen($_POST["loginpw"]) > 0) {
$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); exit;
$sth1 = $dbh->prepare("SELECT * FROM sys_cms_login where cmsloginname = ? AND cmsloginid<> ? ");
//$sth1 -> execute(array($_POST["loginname"],$_POST["cmsloginid"]));
if (!$sth1->execute(array($_POST["loginname"],$_POST["cmsloginid"])))
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;
}
// Modify
if (strlen($_POST["loginpw"]) > 0) {
$sql = "update sys_cms_login set cmsusername=?, cmsloginname=?, lastupdate=?, cmsloginpw=? where cmsloginid=?";
$sth2 = $dbh -> prepare($sql);
$parameter =array($_POST["username"],$_POST["loginname"], $nowdate, $loginpw, $_POST["cmsloginid"]);
if (!$sth2->execute($parameter))
throw new Exception('[' . $sth1->errorCode() . ']: ' . $sth1->errorInfo());
else{
unset($_SESSION['loginname']);
unset($_SESSION['password']);
unset($_SESSION['loginid']);
unset($_SESSION['cmsloginid']);
unset($_SESSION['role']);
unset($_SESSION['cmsrole']);
header("Location: login.php");
exit;
}
}else{
$sql = "update sys_cms_login set cmsusername=?, cmsloginname=?, lastupdate=? where cmsloginid=?";
$sth2 = $dbh -> prepare($sql);
$parameter = array($_POST["username"],$_POST["loginname"], $nowdate, $_POST["cmsloginid"]);
if (!$sth2->execute($parameter))
throw new Exception('[' . $sth1->errorCode() . ']: ' . $sth1->errorInfo());
else
header("Location: sys_cms_user_index.php?msg=Update Successfully");
}
$dbh = null;
?>