phpknight Posted August 13, 2007 Share Posted August 13, 2007 I have a series of redirect tests so only a logged in user can see certain pages. I was getting a few odd behaviors from the script. Then I tested it using something like this: header("Location: blah"); mail("test@test.com", "you shouldn't be here", "eom"); I assumed that once the redirect occurs the PHP page stops executing immediately in mid-script. Is this false? Should I really be receiving this email? If so, when does the execution of the script actually stop? The redirects are happening correctly, but I would assume I would never get this email at all. Quote Link to comment https://forums.phpfreaks.com/topic/64609-solved-is-this-header-behavior-normal/ Share on other sites More sharing options...
gurroa Posted August 13, 2007 Share Posted August 13, 2007 PHP page stops executing only at the end of the script, on the errors occure or you can stop the process by calling die() or exit() command. Quote Link to comment https://forums.phpfreaks.com/topic/64609-solved-is-this-header-behavior-normal/#findComment-322134 Share on other sites More sharing options...
phpknight Posted August 13, 2007 Author Share Posted August 13, 2007 So, you are saying that I should go like this: //redirect exit; Is that what you mean? Quote Link to comment https://forums.phpfreaks.com/topic/64609-solved-is-this-header-behavior-normal/#findComment-322141 Share on other sites More sharing options...
phpknight Posted August 13, 2007 Author Share Posted August 13, 2007 Yes, that is what you meant. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/64609-solved-is-this-header-behavior-normal/#findComment-322146 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.