1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
<?php require_once "check_login.php";
$row = SysCmsLogin::where('cmsloginid', '=', (int)$_POST["cmsloginid"])->first();
$page_settings = array( 'formid' => 'Sys_cms_user', // for permission 'section' => 'System Setting', // parent/page title 'subsection' => 'Admin Management', // page title 'domain' => 'sys_cms_user', // table/model name 'access' => 'GNr', // for permission );
require_once 'function_auth.php';
$cmsloginid = (int)$_POST["cmsloginid"]; $cms_user_info = SysCmsLogin::where('cmsloginid', '=', $_SESSION["cmsloginid"])->first(); $message = "";
if ($row['cmsrole'] != 'user') { /*if (empty($_POST["username"])) { $message .= _lang("Please enter User Name.") . "\\n\\n"; } */ if (empty($_POST["username"])) { $message .= _lang("Please enter Login Name.") . "\\n\\n"; }
if (!empty($message)) { echo "<script>alert('" . $message . "'); history.back();</script>"; exit; } }
if (strlen($_POST["loginpw"]) > 0) { $strength = Password::strength($_POST["loginpw"], $_POST["username"]); if (!$strength) { exit(_lang('Insufficient password strength')); } $cmsloginpw = Password::hash($_POST["loginpw"]); } $nowdate = date("Y-m-d H:i:s");
$sql = "SELECT * FROM sys_cms_login where cmsloginname = ? AND cmsloginid <> ? "; $parameters = array($_POST["loginname"], $_POST["cmsloginid"]); $result = bind_pdo($sql, $parameters, "selectone"); if (!empty($result)) { header("Location: sys_cms_user_index.php?msg=" . _lang("You have already been assigned a login name.")); exit; }
// Modify
if (strlen($_POST["loginpw"]) > 0) { if ($row['cmsrole'] == 'user') { $sql = "update sys_cms_login set lastupdate=?, lastupby=?, cmsloginpw=? where cmsloginid=?"; $parameters = array($nowdate, $_SESSION["cmsloginid"], $cmsloginpw, $_POST["cmsloginid"]); bind_pdo($sql, $parameters); } else { $sql = "update sys_cms_login set cmsusername=?, cmsloginname=?, cmsrole=?, lastupdate=?, lastupby=?, cmsloginpw=? where cmsloginid=?"; $parameters = array(aes_crypt($_POST["username"], 1), aes_crypt($_POST["username"], 1), $_POST["role_level"], $nowdate, $_SESSION["cmsloginid"], $cmsloginpw, $_POST["cmsloginid"]); bind_pdo($sql, $parameters);
} } else { if ($row['cmsrole'] == 'user') { $sql = "update sys_cms_login set lastupdate=?, lastupby=? where cmsloginid=?"; $parameters = array($nowdate, $_SESSION["cmsloginid"], $_POST["cmsloginid"]); } else { $sql = "update sys_cms_login set cmsusername=?, cmsloginname=?, cmsrole=?, lastupdate=?, lastupby=? where cmsloginid=?"; $parameters = array(aes_crypt($_POST["username"], 1), aes_crypt($_POST["username"], 1), $_POST["role_level"], $nowdate, $_SESSION["cmsloginid"], $_POST["cmsloginid"]); } bind_pdo($sql, $parameters); }
header("Location: sys_cms_user_modifyform.php?cmsloginid=" . $_POST["cmsloginid"] . "&msg=2");
|