ACM eventYear page blank page routing bug fixed#356
Open
Siddharth-Pushkar wants to merge 3 commits intodevelopfrom
Open
ACM eventYear page blank page routing bug fixed#356Siddharth-Pushkar wants to merge 3 commits intodevelopfrom
Siddharth-Pushkar wants to merge 3 commits intodevelopfrom
Conversation
Restyling the newsletter
anur4ag
approved these changes
Jan 23, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
eventYear page routing bug fixed.
I shifted the whole header code out of the html tag because it was interfering with header.php.
In the original page header code,
$year = $_GET["year"];
only got the year from the database and did not specify what to do if it was empty.
it is replaced with,
$year = isset($_GET["year"]) ? $_GET["year"] : 2023;
this line decides whether there is a year parameter in the header or not, if not then it will be 2023.
then made an array validyears and added all the years when the events took place
then added an ' if ' statement to check whether the header has a valid year or not.
if it exceeds the valid year, the user will be redirected to the default 2023.
In the future, if there are more event years, we can just add more years and update the default header to the latest year.
$validYears = [2019, 2020, 2021, 2022, 2023];
if (!in_array($year, $validYears)) {
header("Location: eventYear.php?year=2023");
exit();
}
the previous code for this is still there, just commented
during my testing, it didn't affect anything.
22 Jan Commit
Kept this at the top to check whether there is ' year ' or not, if not it will redirect you to the latest year events
if (!isset($_GET["year"])) {
header("Location: eventYear.php?year=2023");
exit();
}
$year = $_GET["year"];
now to get the year for the header
then rest is the same
$validYears = [2019, 2020, 2021, 2022, 2023];
if (!in_array($year, $validYears)) {
// Handle invalid year (you can redirect to a default year or display an error)
header("Location: eventYear.php?year=2023");
exit();
}