Esempio n. 1
0
  MAIN ACTIONS
  ====================*/
// ユーザー一覧
$perpage = PAGEMAX;
$filter = "1 = 1";
$allUserCounts = $login->countnum($filter);
$pageall = ceil($allUserCounts / $perpage);
$page_current = 0;
if (isset($_GET['p'])) {
    $page_current = intval($_GET['p']) - 1;
}
$pages = paginate($pageall, $page_current = 0);
$assets['pages'] = $pages;
$orderby = "`id` DESC";
$limit = $page_current . ", " . $perpage;
$users = $login->view($filter, $orderby, $limit);
foreach ($users as &$u) {
    switch ($u['status']) {
        case '9':
            $u['statusstr'] = '管理';
            break;
        case '1':
            $u['statusstr'] = '通常';
            break;
        case '0':
        default:
            $u['statusstr'] = '停止';
            break;
    }
}
unset($u);
Esempio n. 2
0
$msg = array();
/*====================
  BEFORE ACTIONS
  ====================*/
// ログインチェック
if (!isset($_SESSION['login'], $_SESSION['token'])) {
    header("Location: login.php");
    exit;
}
/*====================
  MAIN ACTIONS
  ====================*/
// 対象のユーザー
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'])) {