Пример #1
0
<?php

import('libs/plugins/array.php');
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    // ワンタイムトークン
    if (!token('check')) {
        error('不正なアクセスです。');
    }
    // 入力データを整理
    $post = array('user' => normalize_users(array('id' => $_SESSION['auth']['user']['id'], 'username' => isset($_POST['username']) ? $_POST['username'] : '', 'password' => isset($_POST['password']) ? $_POST['password'] : '', 'password_confirm' => isset($_POST['password_confirm']) ? $_POST['password_confirm'] : '', 'email' => isset($_POST['email']) ? $_POST['email'] : '')), 'profile' => normalize_profiles(array('user_id' => $_SESSION['auth']['user']['id'], 'name' => isset($_POST['profile_name']) ? $_POST['profile_name'] : '', 'text' => isset($_POST['profile_text']) ? $_POST['profile_text'] : '')));
    // 入力データを検証&登録
    $warnings = validate_users($post['user']);
    $warnings += array_key_prefix(validate_profiles($post['profile']), 'profile_');
    if (isset($_POST['_type']) && $_POST['_type'] === 'json') {
        if (empty($warnings)) {
            ok();
        } else {
            warning($warnings);
        }
    } else {
        if (empty($warnings)) {
            $_SESSION['post']['user'] = $post['user'];
            $_SESSION['post']['profile'] = $post['profile'];
            // リダイレクト
            redirect('/user/modify_preview');
        } else {
            $_view['user'] = $post['user'];
            $_view['profile'] = $post['profile'];
            $_view['warnings'] = $warnings;
        }
    }
Пример #2
0
<?php

if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    // 入力データを整理
    $post = array('user' => normalize_users(array('id' => $_SESSION['auth']['user']['id'], 'twostep' => isset($_POST['twostep']) ? $_POST['twostep'] : '', 'twostep_email' => isset($_POST['twostep_email']) ? $_POST['twostep_email'] : '')));
    // 入力データを検証&登録
    $warnings = validate_users($post['user']);
    if (isset($_POST['_type']) && $_POST['_type'] === 'json') {
        if (empty($warnings)) {
            ok();
        } else {
            warning($warnings);
        }
    } else {
        if (empty($warnings)) {
            $_SESSION['post']['user'] = $post['user'];
            // フォワード
            forward('/user/twostep_post');
        } else {
            $_view['user'] = $post['user'];
            $_view['warnings'] = $warnings;
        }
    }
} else {
    // 初期データを取得
    $users = select_users(array('where' => array('id = :id', array('id' => $_SESSION['auth']['user']['id']))));
    if (empty($users)) {
        warning('編集データが見つかりません。');
    } else {
        $_view['user'] = $users[0];
    }
Пример #3
0
<?php

if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    // ワンタイムトークン
    if (!token('check')) {
        error('不正なアクセスです。');
    }
    // 入力データを整理
    $post = array('user' => normalize_users(array('id' => null, 'key' => isset($_POST['key']) ? $_POST['key'] : '', 'token_code' => isset($_POST['token_code']) ? $_POST['token_code'] : '', 'password' => isset($_POST['password']) ? $_POST['password'] : '', 'password_confirm' => isset($_POST['password_confirm']) ? $_POST['password_confirm'] : '')));
    // 入力データを検証&登録
    $warnings = validate_users($post['user']);
    if (isset($_POST['_type']) && $_POST['_type'] === 'json') {
        if (empty($warnings)) {
            ok();
        } else {
            warning($warnings);
        }
    } else {
        if (empty($warnings)) {
            $_SESSION['post']['user'] = $post['user'];
            // フォワード
            forward('/password/post');
        } else {
            $_view['user'] = $post['user'];
            $_view['key'] = $post['user']['key'];
            $_view['warnings'] = $warnings;
        }
    }
} else {
    // パスワード再発行用URLを検証
    $users = select_users(array('select' => 'token_expire', 'where' => array('email = :email AND token = :token', array('email' => $_GET['key'], 'token' => $_GET['token']))));
Пример #4
0
<?php

if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    // ワンタイムトークン
    if ((empty($_POST['view']) || $_POST['view'] !== 'preview') && !token('check')) {
        error('不正なアクセスです。');
    }
    // 入力データを整理
    $post = array('user' => normalize_users(array('id' => isset($_POST['id']) ? $_POST['id'] : '', 'username' => isset($_POST['username']) ? $_POST['username'] : '', 'password' => isset($_POST['password']) ? $_POST['password'] : '', 'password_confirm' => isset($_POST['password_confirm']) ? $_POST['password_confirm'] : '', 'email' => isset($_POST['email']) ? $_POST['email'] : '')));
    if (isset($_POST['view']) && $_POST['view'] === 'preview') {
        // プレビュー
        $_view['user'] = $post['user'];
    } else {
        // 入力データを検証&登録
        $warnings = validate_users($post['user']);
        if (isset($_POST['_type']) && $_POST['_type'] === 'json') {
            if (empty($warnings)) {
                ok();
            } else {
                warning($warnings);
            }
        } else {
            if (empty($warnings)) {
                $_SESSION['post']['user'] = $post['user'];
                // フォワード
                forward('/admin/user_post');
            } else {
                $_view['user'] = $post['user'];
                $_view['warnings'] = $warnings;
            }
        }