MAIN ACTIONS ====================*/ // ログアウト処理 if (isset($_GET['logout']) && $_GET['logout'] == 'logout') { $_SESSION = array(); if (!empty($_GET['return_uri'])) { header('Location: ' . $_GET['return_uri']); exit; } } // ログイン処理 if (isset($_POST['mode'])) { if ($_POST['mode'] == 'login') { $_username = strval($_POST['username']); $_password = strval($_POST['password']); $_hashedPassword = hashconv($_password, false, SECURE_SALT); $loginValue = $login->login($_username, $_hashedPassword); $assets['result'] = $loginValue; if ($loginValue > 0) { $_SESSION['login'] = '******'; if ($loginValue == 9) { $_SESSION['managerlogin'] = 1; } else { $_SESSION['managerlogin'] = 0; } if (!empty($_POST['return_uri'])) { header('Location: ' . $_POST['return_uri']); exit; } else { header('Location: top.php'); exit;
// 対象のユーザー if (isset($_GET['user_id'])) { $user_id = intval($_GET['user_id']); $userInfo = $login->view("`id` = {$user_id}", "`id`", "0,1"); $assets['user'] = $userInfo[0]; } // 更新処理 if (isset($_POST['mode']) && $_POST['mode'] == 'update') { $login_id = intval($_POST['user_id']); $tableData = array(); if (!empty($_POST['username'])) { $username = trim($_POST['username']); $tableData[] = array('fieldName' => 'username', 'value' => $username, 'type' => 'string'); } if (!empty($_POST['password'])) { $password = hashconv($_POST['password']); $tableData[] = array('fieldName' => 'password', 'value' => $password, 'type' => 'string'); } if (!empty($_POST['status'])) { $status = intval($_POST['status']); $tableData[] = array('fieldName' => 'status', 'value' => $status, 'type' => 'integer'); } $login->update($tableData, $login_id); $msg[] = array('value' => '更新しました', 'style' => 'success'); } // 更新処理 if (isset($_POST['mode']) && $_POST['mode'] == 'delete') { $login_id = intval($_POST['user_id']); $login->delete($login_id); $msg[] = array('value' => '削除しました', 'style' => 'danger'); }