There are many similar question like php - Should I call exit() after calling Location: header? and do i need to use exit after header("Location: http://localhost/...");? in Stack Over Flow.
They have answers like below.
You definitely should. Otherwise the script execution is not terminated. Setting another header alone is not enough to redirect.
--
You should call exit() because a header() won't automatically stop the script from executing - or if it does (I'm honestly not 100% on that), it definitely doesn't stop the script instantly.
But I can't understand that how someone skip or bypass code like header('Location: http://www.example.com/login.php')
? How someone do it? Because this is a PHP code. This code runs in server. If someone can skip/bypass this code why they can't skip/bypass exit()
also?