session_start() trouble!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sk8erh4x0r
Forum Commoner
Posts: 43
Joined: Wed May 26, 2004 8:27 pm

session_start() trouble!

Post by sk8erh4x0r »

session_start(); is in a file named scripts.php which is included on every page of the site. I stay logged in on files in the root directory (ie. /index.php, /contact.php) but in subdirectories like /tutorials or /submit I am all the sudden logged out. :x

Does it matter if session_start is in an included file or not?
User avatar
itsmani1
Forum Regular
Posts: 791
Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:

Post by itsmani1 »

try session_start(); at the start of the pages which are in subdirectories like /tutorials
Thanx.
sk8erh4x0r
Forum Commoner
Posts: 43
Joined: Wed May 26, 2004 8:27 pm

Post by sk8erh4x0r »

scripts.php is included at the start of all the files in the subdirectories so session_start() is there.
theda
Forum Contributor
Posts: 332
Joined: Sat Feb 19, 2005 8:35 am
Location: USA

Post by theda »

You only need session_start(); at the beginning of the main file. As in, if you have an index.php file that runs the rest of your layout (all the content is loaded into the index.php file using includes or what-not).
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Post by josh »

No, it does not matter if session_start() is in an included file or not, and theda I don't think his web site is set up like that, he said he is including a file scripts.php that has session_start() at the beginning.

Are you getting any errors, sk8er? If not try putting error_reporting(E_ALL); at the top of tutorials/index.php, before you even try to include script.php, do you get any warnings, or notices? If so copy and paste them here so we can see them.

Last but not least, I'll need to see some code.
sk8erh4x0r
Forum Commoner
Posts: 43
Joined: Wed May 26, 2004 8:27 pm

Post by sk8erh4x0r »

It turns out that i stay logged in using IE, but with firefox and opera I don't stay logged in on all pages. Any idea why it works on IE, but not other browsers?
Post Reply