From 70f0e02fa2185914ab0bfb171fe10ca2b51e58d6 Mon Sep 17 00:00:00 2001 From: Jacek Pyziak Date: Sun, 1 Mar 2026 22:07:27 +0100 Subject: [PATCH] feat: Add guest-only path handling to redirect logged-in users --- .vscode/ftp-kr.sync.cache.json | 56 +++++++++++++++++++--------------- index.php | 11 +++++++ 2 files changed, 42 insertions(+), 25 deletions(-) diff --git a/.vscode/ftp-kr.sync.cache.json b/.vscode/ftp-kr.sync.cache.json index 8d6c52b..bbacee3 100644 --- a/.vscode/ftp-kr.sync.cache.json +++ b/.vscode/ftp-kr.sync.cache.json @@ -125,8 +125,8 @@ }, "class.Products.php": { "type": "-", - "size": 47110, - "lmtime": 1772116324270, + "size": 47926, + "lmtime": 1772127837185, "modified": false }, "class.Site.php": { @@ -173,6 +173,12 @@ "lmtime": 0, "modified": false }, + "class.CronQueue.php": { + "type": "-", + "size": 2858, + "lmtime": 1772116301682, + "modified": false + }, "class.FacebookAds.php": { "type": "-", "size": 29620, @@ -187,9 +193,9 @@ }, "class.Products.php": { "type": "-", - "size": 34441, - "lmtime": 1771757529304, - "modified": true + "size": 34756, + "lmtime": 1772126750737, + "modified": false }, "class.Users.php": { "type": "-", @@ -202,12 +208,6 @@ "size": 1453, "lmtime": 0, "modified": true - }, - "class.CronQueue.php": { - "type": "-", - "size": 2858, - "lmtime": 1772116301682, - "modified": false } }, "services": { @@ -359,19 +359,19 @@ "supplemental_10.tsv": { "type": "-", "size": 573, - "lmtime": 0, + "lmtime": 1772126067385, "modified": false }, "supplemental_1.tsv": { "type": "-", "size": 45, - "lmtime": 0, + "lmtime": 1772126067465, "modified": false }, "supplemental_2.tsv": { "type": "-", "size": 1331, - "lmtime": 0, + "lmtime": 1772126067543, "modified": false }, "supplemental_3.tsv": { @@ -383,37 +383,37 @@ "supplemental_4.tsv": { "type": "-", "size": 385, - "lmtime": 0, + "lmtime": 1772126067628, "modified": false }, "supplemental_5.tsv": { "type": "-", "size": 436, - "lmtime": 0, + "lmtime": 1772126067716, "modified": false }, "supplemental_6.tsv": { "type": "-", "size": 45, - "lmtime": 0, + "lmtime": 1772126067798, "modified": false }, "supplemental_7.tsv": { "type": "-", "size": 297, - "lmtime": 0, + "lmtime": 1772126067881, "modified": false }, "supplemental_8.tsv": { "type": "-", "size": 449, - "lmtime": 0, + "lmtime": 1772126067984, "modified": false }, "supplemental_9.tsv": { "type": "-", "size": 45, - "lmtime": 0, + "lmtime": 1772126068068, "modified": false } }, @@ -451,13 +451,13 @@ "style.css": { "type": "-", "size": 60877, - "lmtime": 1772117956039, + "lmtime": 1772126786443, "modified": false }, "style.css.map": { "type": "-", "size": 162739, - "lmtime": 1772117956039, + "lmtime": 1772126786443, "modified": false }, "style-old.css": { @@ -475,7 +475,7 @@ "style.scss": { "type": "-", "size": 70931, - "lmtime": 1772117955600, + "lmtime": 1772126785868, "modified": false } }, @@ -550,6 +550,12 @@ "modified": false } }, + "MEMORY.md": { + "type": "-", + "size": 79, + "lmtime": 1772126214031, + "modified": false + }, "migrations": { "001_google_ads_settings.sql": { "type": "-", @@ -768,8 +774,8 @@ "products": { "main_view.php": { "type": "-", - "size": 68170, - "lmtime": 1771757685790, + "size": 70245, + "lmtime": 1772126874952, "modified": false }, "product_history.php": { diff --git a/index.php b/index.php index 9db58a0..c29f9d7 100644 --- a/index.php +++ b/index.php @@ -116,6 +116,17 @@ foreach ($public_prefixes as $prefix) { } } +// Strony tylko dla niezalogowanych (np. formularz logowania) +$guest_only_paths = ['login', 'logowanie', 'users/login', 'users/login_form']; +$is_guest_only = in_array($path, $guest_only_paths) + || in_array($path_first . '/' . ($segments[1] ?? ''), $guest_only_paths); + +if ($user && $is_guest_only) +{ + header('Location: /campaigns'); + exit; +} + if (!$user && !$is_public) { header( 'Location: /login' );