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

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