| 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"] : ""); |
| 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 |
{ |
{ |
| 92 |
$sign_2 = mysqli_real_escape_string($db_conn, $sign_2); |
$sign_2 = mysqli_real_escape_string($db_conn, $sign_2); |
| 93 |
$sign_3 = mysqli_real_escape_string($db_conn, $sign_3); |
$sign_3 = mysqli_real_escape_string($db_conn, $sign_3); |
| 94 |
|
|
| 95 |
// Begin transaction |
$sql = "UPDATE user_pubinfo SET user_timezone = '$user_tz', introduction = '$introduction', ". |
|
$rs = mysqli_query($db_conn, "SET autocommit=0"); |
|
|
if ($rs == false) |
|
|
{ |
|
|
$result_set["return"]["code"] = -2; |
|
|
$result_set["return"]["message"] = "Mysqli error: " . mysqli_error($db_conn); |
|
|
|
|
|
mysqli_close($db_conn); |
|
|
exit(json_encode($result_set)); |
|
|
} |
|
|
|
|
|
$rs = mysqli_query($db_conn, "BEGIN"); |
|
|
if ($rs == false) |
|
|
{ |
|
|
$result_set["return"]["code"] = -2; |
|
|
$result_set["return"]["message"] = "Mysqli error: " . mysqli_error($db_conn); |
|
|
|
|
|
mysqli_close($db_conn); |
|
|
exit(json_encode($result_set)); |
|
|
} |
|
|
|
|
|
$sql = "UPDATE user_pubinfo SET introduction = '$introduction', ". |
|
| 96 |
"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'". |
| 97 |
" WHERE UID=" . $_SESSION["BBS_uid"]; |
" WHERE UID=" . $_SESSION["BBS_uid"]; |
| 98 |
|
|
| 103 |
exit(); |
exit(); |
| 104 |
} |
} |
| 105 |
|
|
| 106 |
// Commit transaction |
// Update user_tz in session data |
| 107 |
$rs = mysqli_query($db_conn, "COMMIT"); |
$_SESSION["BBS_user_tz"] = new DateTimeZone($user_tz); |
|
if ($rs == false) |
|
|
{ |
|
|
$result_set["return"]["code"] = -2; |
|
|
$result_set["return"]["message"] = "Mysqli error: " . mysqli_error($db_conn); |
|
|
|
|
|
mysqli_close($db_conn); |
|
|
exit(json_encode($result_set)); |
|
|
} |
|
| 108 |
|
|
| 109 |
mysqli_close($db_conn); |
mysqli_close($db_conn); |
| 110 |
exit(json_encode($result_set)); |
exit(json_encode($result_set)); |