zgkhoo Posted December 19, 2007 Share Posted December 19, 2007 <?php session_start(); if(!($_SESSION['UserID'])){ session_destroy(); header('Location: ../../../plslogin.php'); exit(); } ?> how to make if header('Location: ../../../plslogin.php'); not found then go to header('Location: ../../plslogin.php'); ?? Quote Link to comment Share on other sites More sharing options...
rajivgonsalves Posted December 19, 2007 Share Posted December 19, 2007 you should learn some php this is the second time you asked the same question <?php session_start(); if(!($_SESSION['UserID'])){ session_destroy(); if (file_exists("../../../plslogin.php")) { header('Location: ../../../plslogin.php'); } else { header('Location: ../../plslogin.php'); } exit(); } ?> Quote Link to comment Share on other sites More sharing options...
chigley Posted December 19, 2007 Share Posted December 19, 2007 file_exists() Quote Link to comment Share on other sites More sharing options...
adam291086 Posted December 19, 2007 Share Posted December 19, 2007 beat me to it Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted December 19, 2007 Share Posted December 19, 2007 You and your code should know where the files are relative to each other. It is not necessary to use conditional logic and try multiple include paths to find and include a file. If you are asking this question because you are having problems getting the include() function to work and find the files, I recommend that you start using absolute file system paths in the include statements that will work no matter which file is including one of you include files - include($_SERVER['DOCUMENT_ROOT'] . "/path_from_doc_root_to_your_file/plslogin.php"); 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.