From 35565d90f63e6b5d12ef1a750f05a2e21f51ccba Mon Sep 17 00:00:00 2001 From: Alex Cabal Date: Sat, 20 Aug 2022 13:18:42 -0500 Subject: [PATCH] Redirect ended polls to the results page --- www/polls/get.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/www/polls/get.php b/www/polls/get.php index d3bdf39e..63f82378 100644 --- a/www/polls/get.php +++ b/www/polls/get.php @@ -9,6 +9,12 @@ $canVote = true; // Allow non-logged-in users to see the 'vote' button try{ $poll = Poll::GetByUrlName(HttpInput::Str(GET, 'pollurlname', false)); + if(!$poll->IsActive() && $poll->End !== null && $poll->End < new DateTime()){ + // If the poll ended, redirect to the results + header('Location: ' . $poll->Url . '/votes'); + exit(); + } + if(isset($GLOBALS['User'])){ $canVote = false; // User is logged in, hide the vote button unless they haven't voted yet try{