|
28 | 28 | // カスタムパスがユニコードエスケープされた文字列である場合はエラーメッセージを出力して終了 |
29 | 29 | if (preg_match('/\\\\u([a-fA-F0-9]{4})/', $customPath)) { |
30 | 30 | $_SESSION['error'] = "エラー: ユニコードエスケープされた文字はカスタムパスで設定できません。"; |
31 | | - header("Location: index.php"); |
| 31 | + header("Location: /"); |
32 | 32 | exit; |
33 | 33 | } |
34 | 34 |
|
35 | 35 | // カスタムパスが 'dashboard' または 'login' の場合はエラーメッセージを出力して終了 |
36 | 36 | if ($customPath == 'dashboard' || $customPath == 'login') { |
37 | 37 | $_SESSION['error'] = "エラー: 'dashboard' または 'login' はカスタムパスとして使用できません。"; |
38 | | - header("Location: index.php"); |
| 38 | + header("Location: /"); |
39 | 39 | exit; |
40 | 40 | } |
41 | 41 |
|
|
48 | 48 |
|
49 | 49 | if ($checkCustomPathResult->num_rows > 0) { |
50 | 50 | $_SESSION['error'] = "エラー: そのカスタムパスは既に存在します。"; |
51 | | - header("Location: index.php"); |
| 51 | + header("Location: /"); |
52 | 52 | exit; |
53 | 53 | } else { |
54 | 54 | // カスタムパスをshort_urlとしてデータベースに保存 |
|
59 | 59 | $shortUrlMessage = $_SERVER['HTTP_HOST'] . "/" . $customPath; |
60 | 60 | $_SESSION['flash_message'] = "短縮URLの生成が完了しました。"; |
61 | 61 | $_SESSION['shortUrlMessage'] = $shortUrlMessage; |
62 | | - header("Location: index.php"); // リダイレクトを追加 |
| 62 | + header("Location: /"); // リダイレクトを追加 |
63 | 63 | exit; |
64 | 64 | } else { |
65 | 65 | echo "SQLエラー: " . $insertStmt->error; // SQLエラーを出力 |
|
83 | 83 |
|
84 | 84 | if ($checkResult->num_rows > 0) { |
85 | 85 | $_SESSION['error'] = "エラー: その短縮URLは既に存在します。"; |
86 | | - header("Location: index.php"); |
| 86 | + header("Location: /"); |
87 | 87 | exit; |
88 | 88 | } else { |
89 | 89 | $sql = "INSERT INTO short_urls (short_url, original_url, user_id) VALUES (?, ?, ?)"; |
|
94 | 94 | $shortUrlMessage = $_SERVER['HTTP_HOST'] . "/" . $shortUrl; |
95 | 95 | $_SESSION['flash_message'] = "短縮URLの生成が完了しました。"; |
96 | 96 | $_SESSION['shortUrlMessage'] = $shortUrlMessage; |
97 | | - header("Location: index.php"); // リダイレクトを追加 |
| 97 | + header("Location: /"); // リダイレクトを追加 |
98 | 98 | exit; |
99 | 99 | } else { |
100 | 100 | $shortUrlMessage = "エラー: " . $sql . "<br>" . $conn->error; |
101 | 101 | $_SESSION['error'] = $shortUrlMessage; |
102 | | - header("Location: index.php"); // リダイレクトを追加 |
| 102 | + header("Location: /"); // リダイレクトを追加 |
103 | 103 | exit; |
104 | 104 | } |
105 | 105 | } |
|
227 | 227 | navigator.clipboard.writeText(text).then(function() { |
228 | 228 | document.getElementById('copyMessage').textContent = 'コピーされました'; |
229 | 229 | $_SESSION['flash_message'] = "コピーしました。"; |
230 | | - header("Location: index.php"); |
| 230 | + header("Location: /"); |
231 | 231 | exit; |
232 | 232 | }, function(err) { |
233 | 233 | console.error('Could not copy text: ', err); |
|
0 commit comments