I have a page that I want to be limited to specific users. If the user at interest does not have the permission to access the link, I prevent access by using "exit;" as seen below.
if (!in_array($_SESSION['id'], $ACL)){
echo "<script>alert('Wrong Account')</script>";
exit;
header("Location: link.com");
} else {
echo "<script>alert('Correct Account')</script>";
}
Once the user is rejected from the link, I want it to jump to the main homepage so that they can sign in again. For this, I think that header();
should work, however does not seem to be working after exit;
ing.
I feel like even without the exit;
, just the link jump will prevent access. However, I'm not really sure if this is safe from a security perspective. Is there an alternative method? or is just the link jump enough?
Thanks in advance.