From 516a1f59bcf1a93498da3397acfa878f932632ab Mon Sep 17 00:00:00 2001 From: Andrew Gioia Date: Fri, 31 Oct 2025 15:03:49 -0400 Subject: [PATCH] Adds new _GET variable to automatically go to the end URL; cleans up search.php to be tidier; allows both GET and POST urls --- inc/class.php | 16 ++++++++-------- inc/search.php | 31 ++++++++++++++++++++++++------- 2 files changed, 32 insertions(+), 15 deletions(-) diff --git a/inc/class.php b/inc/class.php index e55b00e..8496e23 100644 --- a/inc/class.php +++ b/inc/class.php @@ -159,14 +159,14 @@ class Follow // start the next path $this->step++; $this->addPath( - $this->step, - [ - 'step' => $this->step, - 'url' => $this->next, - 'code' => null, - 'header' => '', - 'next' => null - ]); + $this->step, + [ + 'step' => $this->step, + 'url' => $this->next, + 'code' => null, + 'header' => '', + 'next' => null + ]); return true; } diff --git a/inc/search.php b/inc/search.php index 3faa96c..a2f186b 100644 --- a/inc/search.php +++ b/inc/search.php @@ -1,19 +1,26 @@ url = $url; @@ -29,12 +36,22 @@ if (isset($_POST['url'])) } // if we have a redirect to follow, update our working $url - $url = ($request->next) ? $request->next : false; + $url = $request->next ?? false; // update our code - $code = ($request->code) ? $request->code : false; + $code = $request->code ?? false; - } while (substr($code, 0, 1) == 3); // continue while we have a 3XX code + // increment our number of requests + $hops++; + + } while ($hops < $max && $code && substr((string) $code, 0, 1) === '3'); // continue while we have a 3XX code + + // if we got a GET to automatically redirect to the url, do that now + if (isset($_GET['go']) && $url) + { + header("Location: ".$url); + exit; + } } else {