vinothini Posted April 6, 2009 Share Posted April 6, 2009 Hi, In my application i added session,so if session expired it ll go to logout page.. if i copy the url of any page in the application,and paste in new browser since the value is not there page is half loaded without any data.. so what i want is if i copy and paste tha page url in new browser it should automatically take to login page...can u pl tell me how to do that??? i can chk with session value and redirect the page but is any other method is there to do that???? Link to comment https://forums.phpfreaks.com/topic/152740-url-redirect-to-login-page/ Share on other sites More sharing options...
MasterACE14 Posted April 6, 2009 Share Posted April 6, 2009 not sure what you mean. I think you want something like this? <?php if(!isset($_SESSION['somevalue'])) { header("Location: login.php"); } ?> Regards, ACE Link to comment https://forums.phpfreaks.com/topic/152740-url-redirect-to-login-page/#findComment-802078 Share on other sites More sharing options...
vinothini Posted April 7, 2009 Author Share Posted April 7, 2009 yes. thanks for ur reply actually i have a banner page included in all my pages in application so i included this condition there...that time got an error saying header already sent because i had html text before this include page so i added this <?php if(!session_value){ echo "<meta http-equiv='refresh' content='0;url=http://localhost/../login.php'>"; } ?> now it worked... Link to comment https://forums.phpfreaks.com/topic/152740-url-redirect-to-login-page/#findComment-803183 Share on other sites More sharing options...
MasterACE14 Posted April 7, 2009 Share Posted April 7, 2009 you can only put this... <?php if(!isset($_SESSION['somevalue'])) { header("Location: login.php"); } ?> ...before any output So you would put that at the very top of the banner page before any HTML. Regards, ACE Link to comment https://forums.phpfreaks.com/topic/152740-url-redirect-to-login-page/#findComment-803189 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.