I’m working on a site that I didn’t build. I’m trying to put an HTML redirect inside an if statement, Here’s the source:
<?php
if(!$usersClass->checkLoggedIn()) {
?>
// Stuff here
<?php } else { ?>
// More stuff here
<?php } ?>
I want to put a redirect within here: if the user isn’t logged in, they’re redirected to the homepage, I’ve tried the following with no luck. Can anybody see where I’m going wrong?
<?php
if(!$usersClass->checkLoggedIn()) {
header("Location: /index.php");
?>
You forgot to close the bracket
}should be: