FWDrew Posted June 6, 2009 Share Posted June 6, 2009 Hi everyone, I have a quick question for anyone who has time to explain something to me. I was recently reading a php article that basically suggested: If you do employ this method, don’t forget that the script may continue executing after the user has gone. Always follow up your header redirects with a die(); header("Location: http://www.mysite.com/login.php"); die(); I've never really gotten into the practice of doing this, as my headers are usually wrapped in a conditional statement at the top (if condition is not meet, redirect, or else execute script). Is this a practice I should start implementing? Thanks for your time. Link to comment https://forums.phpfreaks.com/topic/161212-solved-header-re-direct-and-using-die/ Share on other sites More sharing options...
Maq Posted June 6, 2009 Share Posted June 6, 2009 Yes, this is good practice. If you look in the manual, it's recommended. You should probably use exit rather than die. The point of this is to ensure the code after the header redirect is not executed. Link to comment https://forums.phpfreaks.com/topic/161212-solved-header-re-direct-and-using-die/#findComment-850662 Share on other sites More sharing options...
FWDrew Posted June 6, 2009 Author Share Posted June 6, 2009 Thanks a lot, that's all I needed to hear, I really appreciate you quick response Link to comment https://forums.phpfreaks.com/topic/161212-solved-header-re-direct-and-using-die/#findComment-850696 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.