onlyican Posted December 11, 2006 Share Posted December 11, 2006 I am building the part of my website which checks if a user has the right access level to be on that pageIf there not, I will redirect them to a Log In PageI will do this by <?phpheader("Location: ".root.".login.php";?>BUTIf I am redirecting someone, dont I need some more headersWhats is the proper headers for redirecting someone to a diff page Quote Link to comment Share on other sites More sharing options...
gluck Posted December 11, 2006 Share Posted December 11, 2006 The manual will give you the format of the header function. You will redirect when the user has no access (no sessions) or when access level isn't what you expected. (The other info should be in your sessions)What other info are you talking about? Quote Link to comment Share on other sites More sharing options...
onlyican Posted December 11, 2006 Author Share Posted December 11, 2006 it states on the php.net site[quote]The second special case is the "Location:" header. Not only does it send this header back to the browser, but it also returns a REDIRECT (302) status code to the browser unless some 3xx status code has already been set.[/quote]I dont want a 302 RedirectSo I need some 3xx Status Code?? Quote Link to comment Share on other sites More sharing options...
marcus Posted December 11, 2006 Share Posted December 11, 2006 You shouldn't have any problems with redirecting them.[code]<?phpif(!isset($_SESSION['logged'])){header("Location: login.php");}else {echo "hi";}?>[/code] Quote Link to comment Share on other sites More sharing options...
onlyican Posted December 12, 2006 Author Share Posted December 12, 2006 I dont need any more headerslikeheader("HTTP/1.0 302 Redirect");or Anything? Quote Link to comment Share on other sites More sharing options...
TEENFRONT Posted December 12, 2006 Share Posted December 12, 2006 i dont think you do need a redirect header... i never use one, and never see any errors on my server. Quote Link to comment Share on other sites More sharing options...
onlyican Posted December 12, 2006 Author Share Posted December 12, 2006 I aint used one before, but I just wanted to check if I was doing it proper Quote Link to comment 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.