// 当前页面已提交,现在处理提交的数据 $dbo = new dbex($dbServs); $err_msg = array(); $e = $dbo->real_escape_string($email); $n = trim($_POST['name']); if (check_nickname_fail($n)) { $err_msg[] = "请填写符合规定的用户昵称"; } else { if ($dbo->checkExist($n, 'nick_name')) { $err_msg[] = "这个昵称太热门,已经被使用了,您换一个试试"; } } $n = $dbo->real_escape_string($n); $p1 = trim($_POST['pass1']); $p2 = trim($_POST['pass2']); if (check_password_fail($p1)) { $err_msg[] = "请设置符合规定的密码"; } else { if ($p1 !== $p2) { $err_msg[] = "两次密码输入不一致"; } else { $ency_p = md5($p1); } } if (empty($_POST['role'])) { $err_msg[] = '请选择账户类型'; } else { $role_type = 'ader' === $_POST['role'] ? '2' : '1'; // 数据库里要写数字类型 $role = $role_type == 2 ? 'ader' : 'user'; // session中写字符串
* 一些检测函数尚未完善 */ include_once "../config.php"; include_once $webRoot . "foundation/check.func.php"; include_once $webRoot . "foundation/switch.php"; include_once $webRoot . "foundation/price.php"; if (isset($_SEEEION['uid']) && isset($_SEISSION['name'])) { // 已经登录,跳转 header('Location:' . $siteRoot . 'my.php'); exit; } // 尚未登录,进行登录 if (isset($_POST['submitted']) && isset($_POST['email']) && isset($_POST['pass'])) { $e = trim($_POST['email']); $p = trim($_POST['pass']); if (check_email_fail($e) || check_password_fail($p)) { // 邮箱或密码格式不对 header('Location:' . $siteRoot . 'index.php?login_error=wrong_format'); exit; } include_once $webRoot . "lib/dbo.class.php"; include_once $dbConfFile; $dbo = new dbex($dbServs); $e = $dbo->real_escape_string($e); $ency_p = md5($p); $sql = "select user_id, nick_name, role, level, realtime_money from user where email = '{$e}' and pass = sha1('{$ency_p}') limit 1"; $res = $dbo->query($sql); if (1 != $res->num_rows) { // 邮箱与密码不匹配 header('Location:' . $siteRoot . 'index.php?login_error=mismatch'); exit;