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

Contents of /fenglin/bbs/set_life.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.6 - (show annotations)
Sat Mar 1 08:43:29 2025 UTC (12 months, 2 weeks ago) by sysadm
Branch: MAIN
Changes since 1.5: +7 -7 lines
Convert GB2312 to UTF-8

1 <?
2 require_once "./common_lib.inc.php";
3 require_once "./session_init.inc.php";
4 ?>
5 <?
6 if (isset($_POST["user_id"]))
7 $user_id=intval($_POST["user_id"]);
8 else
9 $user_id=0;
10
11 if (isset($_POST["life"]))
12 $life=intval($_POST["life"]);
13 else
14 {
15 echo ("未指定生命值!");
16 exit();
17 }
18
19 $db_conn=include "./db_open.inc.php";
20
21 if (!($_SESSION["BBS_priv"]->checkpriv(0,S_POST) && (
22 $_SESSION["BBS_priv"]->checklevel(P_ADMIN_M) ||
23 $_SESSION["BBS_priv"]->checklevel(P_ADMIN_S) ||
24 $_SESSION["BBS_priv"]->checklevel(P_MAN_C))))
25 {
26 error_msg("您无权修改用户生命值!",true);
27 exit();
28 }
29
30 switch($life)
31 {
32 case 999:
33 case 666:
34 case 365:
35 case 333:
36 case 150:
37 case 30:
38 break;
39 default:
40 echo ("非法生命值!");
41 exit();
42 }
43
44 $rs=mysql_query("select UID from user_list where UID=$user_id and enable")
45 or die("Query user error!");
46
47 if (!($row=mysql_fetch_array($rs)))
48 {
49 include "./error/user_not_found.htm";
50 exit();
51 }
52
53 $uid=$row["UID"];
54
55 mysql_free_result($rs);
56
57 mysql_query("update user_pubinfo set life=$life where UID=$uid")
58 or die("Update user_pubinfo error!");
59
60 mysql_query("insert delayed into user_life_log(UID,set_UID,life,dt,ip) ".
61 "values($uid,".$_SESSION["BBS_uid"].",$life,now(),'".
62 Client_Address()."')")
63 or die("Add log error!");
64
65 error_msg("设置用户生命值成功!");
66
67 mysql_query("update user_online set current_action='reload' where UID=".$uid)
68 or die("Update user_online error!");
69
70 mysql_close($db_conn);
71 ?>
72 <HTML>
73 <head>
74 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
75 <meta http-equiv="refresh" content="3;url=show_profile.php?user_id=<? echo $user_id; ?>">
76 <title>设置用户生命值</title>
77 <link rel="stylesheet" href="css/default.css" type="text/css">
78 </head>
79 <BODY>
80 <P align=center>用户生命值设置完成!</P>
81 </BODY>
82 </HTML>

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