/[LeafOK_CVS]/fenglin/bbs/common_lib.inc.php
ViewVC logotype

Annotation of /fenglin/bbs/common_lib.inc.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.6 - (hide annotations)
Sat Apr 5 15:19:16 2025 UTC (11 months, 1 week ago) by sysadm
Branch: MAIN
Changes since 1.5: +1 -0 lines
Refine

1 sysadm 1.1 <?
2     //Log article operation into table bbs_article_log
3 sysadm 1.5 function article_op_log(int $aid, int $uid, string $op_type, string $ip_addr, mysqli $db_conn = null) : mysqli_result | bool
4 sysadm 1.1 {
5     /*
6     Type Description
7     A Add article
8     D Delete article
9 sysadm 1.6 X Delete article by Admin
10 sysadm 1.1 S Restore article
11     L Lock article
12     U Unlock article
13     M Modify article
14     T Move article
15     E Set article as excerption
16     O Unset article as excerption
17     F Set article on top
18     V Unset article on top
19     R Recommend article
20     N Unrecommend article
21     Z Set article as trnasship
22     */
23 sysadm 1.5
24     $sql = "INSERT INTO bbs_article_op(AID, UID, type, op_dt, op_ip)
25     VALUES($aid, $uid, '$op_type', NOW(), '$ip_addr')";
26    
27     $ret = mysqli_query($db_conn, $sql);
28    
29 sysadm 1.1 return $ret;
30     }
31    
32     //Add/Subtract user exp
33 sysadm 1.5 function user_exp_change(int $uid, int $exp_change, mysqli $db_conn = null) : mysqli_result | bool
34 sysadm 1.1 {
35 sysadm 1.5 $sql = "UPDATE user_pubinfo SET exp = exp + $exp_change WHERE UID = $uid";
36    
37     $ret = mysqli_query($db_conn, $sql);
38 sysadm 1.1
39     return $ret;
40     }
41    
42     //Display error message in a pop-up window
43 sysadm 1.5 function error_msg($msg, $back=false, $close=false)
44 sysadm 1.1 {
45     $ret = "<script language=\"JavaScript\">\n".
46 sysadm 1.2 " alert(\"".str_replace("\n","\\\n",$msg)."\");\n".
47 sysadm 1.1 ($back?" history.go(-1);\n":"").
48     ($close?" self.close();\n":"").
49     "</script>";
50    
51     echo $ret;
52     }
53    
54     ?>

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