Ejemplo n.º 1
0
}
//开始处理提交内容
if ($_GET['action'] == register) {
    include ROOT_PATH . 'includes/register.func.php';
    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('注册失败!有问题请咨询管理员!');
    }
}
?>
Ejemplo n.º 2
0
</head>
<body>
<?php 
require ROOT_PATH . 'includes/header_admin.inc.php';
?>
<div id="main">
<?php 
$sql = "SELECT gm_username,gm_num,gm_start_time,gm_grade FROM gm_stuinfo";
$res = _query($sql);
$num = _num_rows($sql);
$fail = 0;
echo "准备更新(含未审核的同学信息)......<br />";
for ($i = 0; $i < $num; $i++) {
    $row = _fetch_array_list($res);
    $time = strtotime($row['gm_start_time']);
    $grade = _time_to_grade(date("Y", $time), date("m", $time));
    if (!_query("UPDATE gm_stuinfo SET gm_grade='{$grade}' WHERE gm_num='{$row['gm_num']}'")) {
        echo "<font color=red>" . $row['gm_username'] . $row['gm_num'] . "信息更新失败!</font><br />";
        $fail++;
    } else {
        echo $row['gm_username'] . "(" . $row['gm_num'] . ")信息更新成功!<br />";
    }
}
echo "<font color=blue>完毕!共更新" . $num . "位同学信息,成功:" . ($num - $fail) . "个,失败:" . $fail . "个</font>";
?>

</div>
<?php 
require ROOT_PATH . 'includes/footer_admin.inc.php';
?>
</body>