| 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/survey_demo/webadmin/ |
Upload File : |
<?php
require_once('check_login.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"]);
}
$sth1 = $dbh->prepare("SELECT * FROM sys_cms_login where cmsloginname = ? AND 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=5");
exit;
}
// Modify
if (strlen($_POST["loginpw"]) > 0) {
$password_expirydate = date('Y-m-d H:i:s', strtotime("+1 year")); //extend 1 year
$sql = "update sys_cms_login set cmsusername=?, cmsloginname=?, lastupdate=?, cmsloginpw=?, password_expirydate=? where cmsloginid=?";
$sth2 = $dbh->prepare($sql);
$parameter = array($_POST["username"], $_POST["loginname"], $nowdate, $loginpw, $password_expirydate, $_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=2");
}