langenf Posted January 10, 2009 Share Posted January 10, 2009 hi, im making an app that needs users to be logged in inorder to use it. The file structure of the app is like this. root /app //includes includes is in tha app folder which is in the root. includes folder has a file that login_check and moves the redirects the to app/index.php when the user is not logged in like this header("Location:../index.php?mesagge=$mesagge"). It works as expected within the application. Say for example when the user clicks the logout button or when user enters a wrong password trying to login . But when i try to access a file in the app folder say app/show_articles.php without logging in, it redirects the user to root folder index.php. Can you please say what is wrong here? Quote Link to comment Share on other sites More sharing options...
nuttycoder Posted January 10, 2009 Share Posted January 10, 2009 it could be the path is no longer correct from their current location as you using a relative path. Quote Link to comment Share on other sites More sharing options...
langenf Posted January 10, 2009 Author Share Posted January 10, 2009 it could be the path is no longer correct from their current location as you using a relative path. I dont want to use absolute path since relative paths are usually better. If it cannot be done with relative path, im willing to use absolute paths though Quote Link to comment Share on other sites More sharing options...
nuttycoder Posted January 10, 2009 Share Posted January 10, 2009 as a test try having the header redirect on the page then if it redirects to the right place you know it's the paths causing it. Quote Link to comment Share on other sites More sharing options...
langenf Posted January 10, 2009 Author Share Posted January 10, 2009 as a test try having the header redirect on the page then if it redirects to the right place you know it's the paths causing it. sorry, i dont understand. you mean ("Location:http:/server/app/index.php?mesagge=$mesagge") like this? Quote Link to comment Share on other sites More sharing options...
nuttycoder Posted January 10, 2009 Share Posted January 10, 2009 what i mean to test the header on a page you want the user to have to login first you could put the header code directly on that page with a relative path from that page in the header. Quote Link to comment Share on other sites More sharing options...
abdfahim Posted January 10, 2009 Share Posted January 10, 2009 I think the better procedure would be whenever use anylinnk, always use "/" as root .... for example header("location: /page1.php"); header("location: /app/page1.php"); header("location: /app/includes/page1.php"); etc ... 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.