| 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/e-ims/file_manager/ |
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';
$index = $_POST["index"];
$loginid = $_POST["loginid"];
$companyid = $_POST["companyid"];
$roleid = $_POST["roleid"];
$username = htmlspecialchars($_POST["username"],ENT_QUOTES);
if (strlen($_POST["loginname"]) > 0) {
$loginname = htmlspecialchars($_POST["loginname"],ENT_QUOTES);
}
//$loginpw = md5(htmlspecialchars($_POST["loginpw"],ENT_QUOTES));
$strength = Password::strength($_POST["loginpw"], $_POST["username"]);
if(!empty($_POST["loginpw"]) && !$strength){
exit('Insufficient password strength');
}
$loginpw = Password::hash($_POST["loginpw"]);
$nowdate = date("Y-m-d H:i:s");
//print_r($_POST);
//exit;
$sql = "SELECT * FROM sys_login WHERE loginname = :loginname AND loginid <> '$loginid'";
$sth = Db::getDbh()->prepare($sql);
$sth->execute(array(":loginname" => $loginname));
if( $error = $sth->getError(array(":loginname" => $loginname)) ){
var_dump($error);
}
$colcount = $sth->rowCount();
if ($colcount > 0) {
echo"<script language='javascript'>
alert('Your login name has been assigned, Please choose another.');
history.back();
</script>";
} elseif($_POST["loginpw"] <> $_POST["loginpw_check"] ) {
echo"<script language='javascript'>
alert('Confirm Password Error');
history.back();
</script>";
} else {
// Modify
$sql = "update sys_login set username=:username, lastupby=:lastupby, lastupdate=:lastupdate";
$sql_param = array();
$sql_param[':username'] = $username;
$sql_param[':lastupby'] = $_SESSION['loginid'];
$sql_param[':lastupdate'] = $nowdate;
$sql_param[':loginid'] = $loginid;
if(strlen($_POST["loginname"]) > 0){
$sql_param[':loginname'] = $loginname;
$sql .= ", loginname=:loginname";
}
if(strlen($_POST["loginpw"]) > 0){
$sql_param[':loginpw'] = $loginpw;
$sql .= ", loginpw=:loginpw";
}
$sql .= " where loginid=:loginid";
$sth = Db::getDbh()->prepare($sql);
$sth->execute($sql_param);
if( $error = $sth->getError($sql_param) ){
var_dump($error);
}
//Role User
$sql = "update file_role_user set roleid=:roleid, lastupby=:lastupby, lastupdate=:lastupdate where userid=:userid";
$sth = Db::getDbh()->prepare($sql);
$sth->execute(array(":roleid" => $roleid, ":lastupby" => $_SESSION['loginid'], ":lastupdate" => $nowdate, ":userid" =>$loginid));
if( $error = $sth->getError(array(":roleid" => $roleid, ":lastupby" => $_SESSION['loginid'], ":lastupdate" => $nowdate, ":userid" =>$loginid)) ){
var_dump($error);
}
//Company User
$sql = "update file_company_user set companyid=:companyid, lastupby=:lastupby, lastupdate=:lastupdate where userid=:userid";
$sth = Db::getDbh()->prepare($sql);
$sth->execute(array(":companyid" => $companyid, ":lastupby" => $_SESSION['loginid'], ":lastupdate" => $nowdate, ":userid" =>$loginid));
if( $error = $sth->getError(array(":roleid" => $roleid, ":lastupby" => $_SESSION['loginid'], ":lastupdate" => $nowdate, ":userid" =>$loginid)) ){
var_dump($error);
}
$dbh = null;
header("Location: index.php?index=$index&companyid=$companyid");
}
?>