/[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.6 - (show annotations)
Sat Mar 1 08:43:28 2025 UTC (12 months, 2 weeks ago) by sysadm
Branch: MAIN
Changes since 1.5: +5 -5 lines
Convert GB2312 to UTF-8

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 include "./force_login.inc.php";
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=htmlspecialchars(trim($_POST["username"]), ENT_COMPAT | ENT_HTML401, 'UTF-8');
21 $username=addslashes($username);
22
23 if (!preg_match("/^[A-Za-z]{5,12}$/",$username))
24 {
25 error_msg ("用户名填写不正确!", true);
26 exit();
27 }
28 if (!check_str($username))
29 {
30 error_msg ("用户名含有系统保留词!", true);
31 exit();
32 }
33
34 $db_conn=include "./db_open.inc.php";
35
36 $rs=mysql_query("select UID from user_list where username='$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='$username'".
45 " where UID=".$_SESSION["BBS_uid"])
46 or die("Update error!");
47
48 mysql_close($db_conn);
49
50 $_SESSION["BBS_username"] = $username;
51
52 header ("Location: main.php");
53 ?>

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