torpedo91 Posted March 22, 2021 Share Posted March 22, 2021 I have this (display_items.php) script which should not be accessed directly . user will be directed to a login page, the login checked by a check_login.php file then successful authentication will direct the user to the display_items.php page. it works perfectly on windows server but not on linux. the display_items.php script can be accessed directly on the linux server. It may have something to do with sessions but i cannot pin point the issue at the moment . i have attaced the php script files. Grateful if someone could point me in the right direction check_login.txt display_items.txt login.txt Quote Link to comment https://forums.phpfreaks.com/topic/312357-sessions/ Share on other sites More sharing options...
mac_gyver Posted March 22, 2021 Share Posted March 22, 2021 41 minutes ago, torpedo91 said: but not on linux. the display_items.php script can be accessed directly on the linux server. does that mean that the 'protected' content is displayed or does it mean that the expected response of redirecting to the login form doesn't occur and the browser stays on the display_items.php page while displaying a blank page? Quote Link to comment https://forums.phpfreaks.com/topic/312357-sessions/#findComment-1585282 Share on other sites More sharing options...
Barand Posted March 22, 2021 Share Posted March 22, 2021 You need to call session_start() before any out put is sent to the browser. (Top of the script is best place). In check_login you hava an echo before the session_start(). Quote Link to comment https://forums.phpfreaks.com/topic/312357-sessions/#findComment-1585283 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.