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

Annotation of /fenglin/bbs/update_pref.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (hide annotations)
Fri Apr 25 07:28:58 2025 UTC (10 months, 3 weeks ago) by sysadm
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +1 -1 lines
Rename preference to update_pref

1 sysadm 1.1 <?php
2     require_once "../lib/db_open.inc.php";
3     require_once "./session_init.inc.php";
4     require_once "./theme.inc.php";
5    
6     force_login();
7    
8     $result_set = array(
9     "return" => array(
10     "code" => 0,
11     "message" => "",
12     "errorFields" => array(),
13     )
14     );
15    
16     $sql = "SELECT user_timezone, introduction, photo, sign_1, sign_2, sign_3 FROM user_pubinfo WHERE UID = " .
17     $_SESSION["BBS_uid"];
18    
19     $rs = mysqli_query($db_conn, $sql);
20     if ($rs == false)
21     {
22     $result_set["return"]["code"] = -2;
23     $result_set["return"]["message"] = "Query user data error: " . mysqli_error($db_conn);
24    
25     mysqli_close($db_conn);
26     exit(json_encode($result_set));
27     }
28    
29     if($row = mysqli_fetch_array($rs))
30     {
31     $result_set["data"] = array(
32     "user_tz" => ($row["user_timezone"] != "" ? $row["user_timezone"] : $BBS_timezone),
33     "introduction" => $row["introduction"],
34     "photo" => $row["photo"],
35     "sign_1" => $row["sign_1"],
36     "sign_2" => $row["sign_2"],
37     "sign_3" => $row["sign_3"],
38     );
39     }
40     else
41     {
42     $result_set["return"]["code"] = -1;
43     $result_set["return"]["message"] = "个人数据不存在!";
44    
45     mysqli_close($db_conn);
46     exit(json_encode($result_set));
47     }
48    
49     mysqli_free_result($rs);
50    
51     mysqli_close($db_conn);
52    
53     // Output with theme view
54 sysadm 1.2 $theme_view_file = get_theme_file("view/update_pref", $_SESSION["BBS_theme_name"]);
55 sysadm 1.1 if ($theme_view_file == null)
56     {
57     exit(json_encode($result_set)); // Output data in Json
58     }
59     include $theme_view_file;
60     ?>

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