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

Diff of /fenglin/bbs/preference_service.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.1 by sysadm, Mon Apr 7 06:33:07 2025 UTC Revision 1.2 by sysadm, Tue Apr 8 01:58:33 2025 UTC
# Line 8  Line 8 
8    
9          $data = json_decode(file_get_contents("php://input"), true);          $data = json_decode(file_get_contents("php://input"), true);
10    
11            $user_tz = (isset($data["user_tz"]) ? $data["user_tz"] : "");
12          $photo = (isset($data["photo"]) ? intval($data["photo"]) : 0);          $photo = (isset($data["photo"]) ? intval($data["photo"]) : 0);
13          $introduction = (isset($data["introduction"]) ? $data["introduction"] : "");          $introduction = (isset($data["introduction"]) ? $data["introduction"] : "");
14          $sign_1 = (isset($data["sign_1"]) ? $data["sign_1"] : "");          $sign_1 = (isset($data["sign_1"]) ? $data["sign_1"] : "");
# Line 25  Line 26 
26          header("Content-Type:application/json; charset=utf-8");          header("Content-Type:application/json; charset=utf-8");
27    
28          // Validate input data          // Validate input data
29            $timezone_identifiers = DateTimeZone::listIdentifiers();
30            if (!in_array($user_tz, $timezone_identifiers, true))
31            {
32                    $result_set["return"]["code"] = -1;
33                    array_push($result_set["return"]["errorFields"], array(
34                            "id" => "user_tz",
35                            "errMsg" => "不存在的时区",
36                    ));
37            }
38    
39          $r_introduction = check_badwords(split_line($introduction, "", 80, 10), "****");          $r_introduction = check_badwords(split_line($introduction, "", 80, 10), "****");
40          if ($introduction != $r_introduction)          if ($introduction != $r_introduction)
41          {          {
# Line 102  Line 113 
113                  exit(json_encode($result_set));                  exit(json_encode($result_set));
114          }          }
115    
116          $sql = "UPDATE user_pubinfo SET introduction = '$introduction', ".          $sql = "UPDATE user_pubinfo SET user_timezone = '$user_tz', introduction = '$introduction', ".
117                  "photo = $photo, sign_1 = '$sign_1', sign_2 = '$sign_2', sign_3 = '$sign_3'".                  "photo = $photo, sign_1 = '$sign_1', sign_2 = '$sign_2', sign_3 = '$sign_3'".
118                  " WHERE UID=" . $_SESSION["BBS_uid"];                  " WHERE UID=" . $_SESSION["BBS_uid"];
119    
# Line 124  Line 135 
135                  exit(json_encode($result_set));                  exit(json_encode($result_set));
136          }          }
137    
138            // Update user_tz in session data
139            $_SESSION["BBS_user_tz"] = new DateTimeZone($user_tz);
140    
141          mysqli_close($db_conn);          mysqli_close($db_conn);
142          exit(json_encode($result_set));          exit(json_encode($result_set));
143  ?>  ?>


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

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