For a site I’m working on I have a lot of different user access levels for different pages and wrote a function that is called near the top of each page that checks if a user is the correct level and if not, redirects them to a new page with a header redirect…
header(“Location: noaccess.php”);
I had always assumed this would mean the rest of the code on the page was not executed, but the code would still get executed which confused me. And recently I was (correctly?) informed that this is because header is not SUPPOSED to kill the code for the current page, it still executes everything on it.
Basically I’m trying to find some code that will essentially act in the manner of “you don’t belong here, GTFO” and send them elsewhere without even touching the rest of the page. Anyone know how I would do this?