From 7bb7d42eee7938ee779f981ca4074547df031ef3 Mon Sep 17 00:00:00 2001 From: ghost Date: Thu, 24 Aug 2023 11:15:18 +0300 Subject: [PATCH] set remote address as value for empty search request, remove redirect to peer page --- src/public/search.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/public/search.php b/src/public/search.php index 26eecee..794ed09 100644 --- a/src/public/search.php +++ b/src/public/search.php @@ -49,9 +49,10 @@ $requestPage = !empty($_GET['page']) && $_GET['page'] > 1 ? (int) $_GET['page'] // Redirect visitor to it peer page on empty search request if ($requestQuery == '*' && !empty($_SERVER['REMOTE_ADDR'])) { - if ($peer = $db->findPeer($_SERVER['REMOTE_ADDR'])) { + if (filter_var($_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) || + filter_var($_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) { - header(sprintf('Location: %s/peer.php?peerId=%s', WEBSITE_URL, $peer->peerId)); + $requestQuery = $_SERVER['REMOTE_ADDR']; } }