/[LeafOK_CVS]/fenglin/bbs/ch_username_sub.php
ViewVC logotype

Contents of /fenglin/bbs/ch_username_sub.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.9 - (show annotations)
Thu Mar 27 12:29:40 2025 UTC (11 months, 3 weeks ago) by sysadm
Branch: MAIN
CVS Tags: HEAD
Changes since 1.8: +0 -0 lines
FILE REMOVED
Remove legacy code

1 <?
2 require_once "./session_init.inc.php";
3 require_once "./reg_check.inc.php";
4 require_once "./common_lib.inc.php";
5 ?>
6 <?
7 if ($_SESSION["BBS_uid"]==0)
8 {
9 echo ("尚未登陆");
10 exit();
11 }
12
13 $permit = false;
14 if (preg_match("/^[A-Za-z]{3,12}$/",$_SESSION["BBS_username"]))
15 {
16 error_msg ("您无权修改用户名!", true);
17 exit();
18 }
19
20 $username=trim($_POST["username"]);
21
22 if (!preg_match("/^[A-Za-z]{5,12}$/",$username))
23 {
24 error_msg ("用户名填写不正确!", true);
25 exit();
26 }
27 if (!check_str($username))
28 {
29 error_msg ("用户名含有系统保留词!", true);
30 exit();
31 }
32
33 $db_conn=include "./db_open.inc.php";
34
35 $rs=mysql_query("select UID from user_list where username='" .
36 mysqli_real_escape_string($db_conn, $username) . "' limit 1");
37 if (mysql_num_rows($rs)>0)
38 {
39 error_msg ("用户名已存在!", true);
40 exit();
41 }
42 mysql_free_result($rs);
43
44 mysql_query("update user_list set username='" .
45 mysqli_real_escape_string($db_conn, $username) . "'".
46 " where UID=".$_SESSION["BBS_uid"])
47 or die("Update error!");
48
49 mysql_close($db_conn);
50
51 $_SESSION["BBS_username"] = $username;
52
53 header ("Location: main.php");
54 ?>

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1