/[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.7 - (show annotations)
Tue Mar 4 04:07:05 2025 UTC (12 months, 2 weeks ago) by sysadm
Branch: MAIN
Changes since 1.6: +2 -4 lines
Refine code

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

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