if ($_system['needcode'] == 1) {
        _check_code($_SESSION['code'], $_POST['code']);
    }
    $clean = array();
    $clean['username'] = _check_username($_POST['username']);
    $clean['num'] = _check_num($_POST['num']);
    $clean['sex'] = _check_sex($_POST['sex']);
    _checkdate($_POST['birth_m'], $_POST['birth_d'], $_POST['birth_y']);
    _checkdate($_POST['start_time_m'], $_POST['start_time_d'], $_POST['start_time_y']);
    $clean['birth'] = $_POST['birth_y'] . '-' . $_POST['birth_m'] . '-' . $_POST['birth_d'];
    $clean['start_time'] = $_POST['start_time_y'] . '-' . $_POST['start_time_m'] . '-' . $_POST['start_time_d'];
    $clean['gm_grade'] = _time_to_grade($_POST['start_time_y'], $_POST['start_time_m']);
    $clean['contact'] = _check_contact($_POST['contact']);
    $clean['address'] = _check_address_ex($_POST['address']);
    $clean['subject'] = _check_subject($_POST['subject']);
    $clean['type'] = _check_type($_POST['type']);
    $clean['photoname'] = _check_photo();
    //判断是否已经注册
    _is_repeat("SELECT gm_num FROM gm_user WHERE gm_num = '{$clean['num']}'", '该学号已经被注册!如有问题请咨询管理员!');
    $newpassword = _check_password($_system['initial_password']);
    if (_query("INSERT INTO gm_user(\r\n\t\t\t\t\t\t\t\t\tgm_username,\r\n\t\t\t\t\t\t\t\t\tgm_num,\r\n\t\t\t\t\t\t\t\t\tgm_password,\r\n\t\t\t\t\t\t\t\t\tgm_reg_time,\r\n\t\t\t\t\t\t\t\t\tgm_last_time,\r\n\t\t\t\t\t\t\t\t\tgm_last_ip) \r\n\t\t\t\t\t\t\t\tVALUES(\r\n\t\t\t\t\t\t\t\t\t'{$clean['username']}',\r\n\t\t\t\t\t\t\t\t\t'{$clean['num']}',\r\n\t\t\t\t\t\t\t\t\t'{$newpassword}',\r\n\t\t\t\t\t\t\t\t\tNOW(),\r\n\t\t\t\t\t\t\t\t\tNOW(),\r\n\t\t\t\t\t\t\t\t\t'{$_SERVER["REMOTE_ADDR"]}')") and _query("INSERT INTO gm_stuinfo(\r\n\t\t\t\t\t\t\t\t\tgm_username,\r\n\t\t\t\t\t\t\t\t\tgm_num,\r\n\t\t\t\t\t\t\t\t\tgm_sex,\r\n\t\t\t\t\t\t\t\t\tgm_birth,\r\n\t\t\t\t\t\t\t\t\tgm_start_time,\r\n\t\t\t\t\t\t\t\t\tgm_grade,\r\n\t\t\t\t\t\t\t\t\tgm_contact,\r\n\t\t\t\t\t\t\t\t\tgm_address,\r\n\t\t\t\t\t\t\t\t\tgm_subject,\r\n\t\t\t\t\t\t\t\t\tgm_type,\r\n\t\t\t\t\t\t\t\t\tgm_photoname) \r\n\t\t\t\t\t\t\t\tVALUES(\r\n\t\t\t\t\t\t\t\t\t'{$clean['username']}',\r\n\t\t\t\t\t\t\t\t\t'{$clean['num']}',\r\n\t\t\t\t\t\t\t\t\t'{$clean['sex']}',\r\n\t\t\t\t\t\t\t\t\t'{$clean['birth']}',\r\n\t\t\t\t\t\t\t\t\t'{$clean['start_time']}',\r\n\t\t\t\t\t\t\t\t\t'{$clean['gm_grade']}',\r\n\t\t\t\t\t\t\t\t\t'{$clean['contact']}',\r\n\t\t\t\t\t\t\t\t\t'{$clean['address']}',\r\n\t\t\t\t\t\t\t\t\t'{$clean['subject']}',\r\n\t\t\t\t\t\t\t\t\t'{$clean['type']}',\r\n\t\t\t\t\t\t\t\t\t'{$clean['photoname']}')")) {
        _location('你的信息已经提交,请耐心等待审核!', 'login.php');
    } else {
        _alert_back('注册失败!有问题请咨询管理员!');
    }
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
Example #2
0
/**
 * openpne_forward
 *
 * @param string $module a requested module name.
 * @param string $type request type. 'page' or 'do'
 * @param string $action requested page/command name.
 * @param array  $errors error message strings.
 */
function openpne_forward($module, $type = '', $action = '', $errors = array())
{
    /// module ///
    if (!($module = _check_module($module))) {
        openpne_display_error('モジュールが見つかりません', true);
    }
    $GLOBALS['__Framework']['current_module'] = $module;
    // disable modules
    if (in_array($module, (array) $GLOBALS['_OPENPNE_DISABLE_MODULES'])) {
        openpne_display_error('モジュールが無効になっています', true);
    }
    // init
    if ($init = openpne_ext_search("{$module}/init.inc")) {
        require_once $init;
    }
    /// type ///
    if (!$type) {
        $type = $GLOBALS['__Framework']['default_type'];
    }
    if (!_check_type($type)) {
        openpne_display_error('リクエストの種類が正しくありません', true);
    }
    $GLOBALS['__Framework']['current_type'] = $type;
    /// action ///
    if (!($action = _check_action($action))) {
        openpne_display_error('アクションの指定が正しくありません', true);
    }
    if (!($file = openpne_ext_search("{$module}/{$type}/{$action}.php"))) {
        openpne_display_error('アクションファイルが見つかりません', true);
    }
    require_once $file;
    $class_name = "{$module}_{$type}_{$action}";
    if (!class_exists($class_name)) {
        openpne_display_error('アクションが見つかりません', true);
    }
    $action_obj = new $class_name();
    $GLOBALS['__Framework']['current_action'] = $action;
    // maintenace mode
    if (OPENPNE_UNDER_MAINTENANCE) {
        if (!in_array($module, (array) $GLOBALS['_OPENPNE_MAINTENANCE_MODULES']) || in_array($type . '_' . $action, (array) $GLOBALS['_OPENPNE_MAINTENANCE_EXCLUDED_ACTION'][$module])) {
            openpne_display_error();
        }
    }
    // auth
    if ($GLOBALS['__Framework']['is_secure'] = $action_obj->isSecure()) {
        if ($auth = openpne_ext_search("{$module}/auth.inc")) {
            require_once $auth;
        } else {
            require_once 'auth.inc';
        }
    }
    // ---------- リクエストバリデーション ----------
    require_once 'OpenPNE/Validator.php';
    require_once 'OpenPNE/Validator/Common.php';
    $validator = new OpenPNE_Validator_Common();
    $files = array();
    if ($ini = openpne_ext_search("{$module}/validate/{$type}/{$action}.ini")) {
        $files[] = $ini;
    }
    list($result, $requests) = $validator->common_validate($files);
    $action_obj->requests = $requests;
    if ($result === false) {
        $errors = $validator->getErrors();
        $action_obj->handleError($errors);
    }
    // ----------------------------------------------
    switch ($type) {
        case 'page':
            $smarty = new OpenPNE_Smarty($GLOBALS['SMARTY']);
            $smarty->templates_dir = $module . '/templates';
            $smarty->assign('requests', $requests);
            $smarty->assign('msg', $requests['msg']);
            $smarty->assign('msg1', $requests['msg1']);
            $smarty->assign('msg2', $requests['msg2']);
            $smarty->assign('msg3', $requests['msg3']);
            if ($errors) {
                $smarty->assign('errors', $errors);
            }
            if (OPENPNE_USE_PARTIAL_SSL) {
                $a = "{$type}_{$action}";
                if ($_SERVER['REQUEST_METHOD'] == 'POST') {
                    $p = $_POST;
                } else {
                    $p = $_GET;
                }
                switch (openpne_ssl_type($module, $a)) {
                    case 'SSL_REQUIRED':
                        if (!is_ssl()) {
                            openpne_redirect($module, $a, $p);
                        }
                        break;
                    case 'SSL_DISABLED':
                        if (is_ssl()) {
                            openpne_redirect($module, $a, $p);
                        }
                        break;
                    case 'SSL_SELECTABLE':
                        if ($https = is_ssl()) {
                            $url = openpne_gen_url($module, $a, $p, true, 'nonssl');
                        } else {
                            $url = openpne_gen_url($module, $a, $p, true, 'ssl');
                        }
                        $smarty->assign('HTTPS', $https);
                        $smarty->assign('SSL_SELECT_URL', $url);
                        break;
                }
            }
            $action_obj->view =& $smarty;
            break;
    }
    // init function
    $init_func = "init_{$module}_{$type}";
    if (function_exists($init_func)) {
        if (isset($smarty)) {
            $init_func($smarty);
        } else {
            $init_func();
        }
    }
    $result = $action_obj->execute($requests);
    if ($result == 'success') {
        send_nocache_headers();
        if ($smarty->ext_search($smarty->templates_dir . '/common/layout.tpl', $place)) {
            $smarty->assign('op_content', $smarty->ext_fetch("{$action}.tpl"));
            $smarty->ext_display('common/layout.tpl');
        } else {
            $smarty->ext_display("{$action}.tpl");
        }
    }
    // ----------------------------------------------
    // c_access_log
    if (LOG_C_ACCESS_LOG) {
        if ($GLOBALS['__Framework']['is_secure'] && $type == 'page') {
            if ($module == 'pc') {
                p_access_log($GLOBALS['AUTH']->uid(), $action);
            } elseif ($module == 'ktai') {
                p_access_log($GLOBALS['KTAI_C_MEMBER_ID'], $action, 1);
            }
        }
    }
    // カスタムログ用関数の呼び出し
    if (OPENPNE_LOG_FUNCTION && is_callable(OPENPNE_LOG_FUNCTION)) {
        // c_member_id を取得
        $c_member_id = 0;
        if ($GLOBALS['__Framework']['is_secure']) {
            if ($module == 'pc') {
                $c_member_id = $GLOBALS['AUTH']->uid();
            } else {
                if ($module == 'ktai') {
                    $c_member_id = $GLOBALS['KTAI_C_MEMBER_ID'];
                }
            }
        }
        $params = array('module' => $module, 'type' => $type, 'action' => $action, 'c_member_id' => $c_member_id, 'is_secure' => $GLOBALS['__Framework']['is_secure']);
        call_user_func(OPENPNE_LOG_FUNCTION, $params);
    }
    return true;
}