'') { $error_bio = validate_bio($bio); if (!$error_bio) { $bio = sanitize_bio($bio); $error_bio = validate_bio($bio); } } $error_password = []; if ($password > '') { $error_password = validate_register_password($password, $password2); } $errors = array_merge($error_username, $error_bio, $error_password); if ($errors) { return on_error(400, $errors); } $trip = ''; if (!$notrip) { $trip = $_SESSION['user']['trip']; } if ($tripkey > '') { // $notrip == 1 かつ $tripkey > '' ならトリップを變更できる $trip = twochan_trip($tripkey); } $id = $_SESSION['user']['id']; $errors = update_user(compact('id', 'username', 'password', 'trip')); if ($errors) { return on_error(500, $errors); } $username_raw = $username; $username = $username . $trip; $_SESSION['user'] = compact('id', 'username', 'username_raw', 'trip'); $_SESSION['messages'] = ['設定完了。']; // ignore error (because it is rarecase) save_profile($id, ['bio' => $bio ]); http_response_code(301); header('Location: ' . sitebase('user/?id=' . $id)); }