Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | APIエンドポイント time_out_user.php を実装 |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | feature/v25.05-1/ユーザータイムアウト機能の導入 |
| Files: | files | file ages | folders |
| SHA3-256: |
4681519161ae251a4de334619e32e321 |
| User & Date: | kazuma 2025-05-27 18:18:18 |
Context
|
2025-05-28
| ||
| 00:44 | APIエンドポイント time_out_ip_address.php を実装 check-in: a5daeb85be user: kazuma tags: feature/v25.05-1/ユーザータイムアウト機能の導入 | |
|
2025-05-27
| ||
| 18:18 | APIエンドポイント time_out_user.php を実装 check-in: 4681519161 user: kazuma tags: feature/v25.05-1/ユーザータイムアウト機能の導入 | |
| 17:00 | コマンドラインツールのモデレーションDB生成コードを更新 check-in: ab4f32a5ea user: kazuma tags: feature/v25.05-1/ユーザータイムアウト機能の導入 | |
Changes
Changes to documents/鉄道運用Hub_APIエンドポイント一覧.md.
| ︙ | ︙ | |||
617 618 619 620 621 622 623 | ユーザーをタイムアウトさせる ### 引数 **$_COOKIE["unyohub_login_token"]** : モデレーターユーザーのWakaranaのログイントークン **$_POST["railroad_id"]** : 路線系統識別名 **$_POST["user_id"]** :タイムアウト対象のユーザーID | | > | > | 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 | ユーザーをタイムアウトさせる ### 引数 **$_COOKIE["unyohub_login_token"]** : モデレーターユーザーのWakaranaのログイントークン **$_POST["railroad_id"]** : 路線系統識別名 **$_POST["user_id"]** :タイムアウト対象のユーザーID **$_POST["timed_out_days"]** : タイムアウト日数 **$_POST["one_time_token"]** : ワンタイムトークン ### 応答 **標識に成功した場合** : 文字列「SUCCEEDED」 **エラーの場合** : 文字列「ERROR: 」とそれに続くエラー内容文 ## time_out_ip_address.php IPアドレスをタイムアウトさせる ### 引数 **$_COOKIE["unyohub_login_token"]** : モデレーターユーザーのWakaranaのログイントークン **$_POST["railroad_id"]** : 路線系統識別名 **$_POST["ip_address"]** : タイムアウト対象のIPアドレス **$_POST["timed_out_days"]** : タイムアウト日数 **$_POST["one_time_token"]** : ワンタイムトークン ### 応答 **標識に成功した場合** : 文字列「SUCCEEDED」 **エラーの場合** : 文字列「ERROR: 」とそれに続くエラー内容文 |
Name change from unyohub/api/mark_user_suspect.php to unyohub/api/time_out_user.php.
1 2 3 | <?php include "__operation_data_functions.php"; | | | 1 2 3 4 5 6 7 8 9 10 11 |
<?php
include "__operation_data_functions.php";
if (!isset($_POST["railroad_id"], $_POST["user_id"], $_POST["timed_out_days"])) {
print "ERROR: 送信値が不正です";
exit;
}
$user = $wakarana->check();
if (is_object($user)) {
if ($user->check_one_time_token($_POST["one_time_token"])) {
|
| ︙ | ︙ | |||
20 21 22 23 24 25 26 |
} else {
print "ERROR: ログイン情報の有効期限が切れています。再ログインしてください";
exit;
}
connect_moderation_db();
| > > | > > > > > > > > > > > > > > > > > | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
} else {
print "ERROR: ログイン情報の有効期限が切れています。再ログインしてください";
exit;
}
connect_moderation_db();
$now_ts = time();
$now_datetime = date("Y-m-d h:i:s", $now_ts);
$moderation_db_obj->query("DELETE FROM `unyohub_moderation_timed_out_users` WHERE `expiration_datetime` < '".$now_datetime."'");
$user_id = $moderation_db_obj->escapeString($_POST["user_id"]);
if ($moderation_db_obj->querySingle("SELECT COUNT(`user_id`) FROM `unyohub_moderation_timed_out_users` WHERE `user_id` = '".$user_id."' AND `expiration_datetime` >= '".$now_datetime."'")) {
print "ERROR: 指定されたユーザーは既にタイムアウトが設定されています";
exit;
}
$timed_out_days = intval($_POST["timed_out_days"]);
if ($timed_out_days < 1 || $timed_out_days > 90) {
print "ERROR: タイムアウト日数が不正です";
exit;
}
$moderation_db_obj->query("INSERT INTO `unyohub_moderation_timed_out_users` (`user_id`, `expiration_datetime`) VALUES ('".$user_id."', '".date("Y-m-d h:i:s", $timed_out_days * 86400 + $now_ts)."')");
$moderation_db_obj->query("INSERT INTO `unyohub_moderation_user_timed_out_logs` (`user_id`, `timed_out_datetime`, `moderator_id`, `timed_out_days`) VALUES ('".$user_id."', '".$now_datetime."', '".$user->get_id()."', ".$timed_out_days.")");
print "SUCCEEDED";
|