KI114 Posted July 29, 2008 Share Posted July 29, 2008 I'm having a problem with sessions, they don't appear to be working. My site is built like this. index.php -> Pages Class (displays the page) | Uses login class to see whether user is logged in | | If logged in, display home page. If not logged in, display login. | Once user has filled in form, log them in using Login Class to set the session | Redirect to index.php and start over again It comes up with these errors: Warning: displaypage() [function.displaypage]: Circular redirect, aborting. in /home/galactic/public_html/code/includes/Pages.php on line 43 Warning: displaypage(http://code.tms.galacticdominance.com/pages/login.php?action=login) [function.displaypage]: failed to open stream: Permission denied in /home/galactic/public_html/code/includes/Pages.php on line 43 Warning: displaypage() [function.displaypage]: Circular redirect, aborting. in /home/galactic/public_html/code/includes/Pages.php on line 43 Warning: displaypage(http://code.tms.galacticdominance.com/pages/login.php?action=login) [function.displaypage]: failed to open stream: Permission denied in /home/galactic/public_html/code/includes/Pages.php on line 43 Fatal error: displaypage() [function.require]: Failed opening required 'http://code.tms.galacticdominance.com/pages/login.php?action=login' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/galactic/public_html/code/includes/Pages.php on line 43 Thanks for any help Link to comment https://forums.phpfreaks.com/topic/117201-sessions-help/ Share on other sites More sharing options...
lemmin Posted July 29, 2008 Share Posted July 29, 2008 What version of PHP do you have? Take a look at this bug: http://bugs.php.net/bug.php?id=27383 Link to comment https://forums.phpfreaks.com/topic/117201-sessions-help/#findComment-602892 Share on other sites More sharing options...
KI114 Posted July 29, 2008 Author Share Posted July 29, 2008 I'm using PHP 4.4.6 and I can't patch PHP as I'm on shared hosting. Link to comment https://forums.phpfreaks.com/topic/117201-sessions-help/#findComment-602908 Share on other sites More sharing options...
d.shankar Posted July 29, 2008 Share Posted July 29, 2008 You have got some premission problems too :-\ Link to comment https://forums.phpfreaks.com/topic/117201-sessions-help/#findComment-602913 Share on other sites More sharing options...
KI114 Posted July 29, 2008 Author Share Posted July 29, 2008 I've just tried moving login.php to my root directory, and the errors have gone. However, the login still doesn't work. It just goes back to the login page... Just to make sure. Should session_start(); only be on index.php? Link to comment https://forums.phpfreaks.com/topic/117201-sessions-help/#findComment-602978 Share on other sites More sharing options...
revraz Posted July 29, 2008 Share Posted July 29, 2008 session_start() needs to be on everypage that uses sessions, and should be the first line of code. Link to comment https://forums.phpfreaks.com/topic/117201-sessions-help/#findComment-602987 Share on other sites More sharing options...
KI114 Posted July 29, 2008 Author Share Posted July 29, 2008 Thats what I did originally, but it still won't work. Can sessions be set in a class on another file? Link to comment https://forums.phpfreaks.com/topic/117201-sessions-help/#findComment-603179 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.