Page 1 of 1

session_start() trouble!

Posted: Tue Aug 02, 2005 9:01 am
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?

Posted: Tue Aug 02, 2005 9:16 am
by itsmani1
try session_start(); at the start of the pages which are in subdirectories like /tutorials
Thanx.

Posted: Tue Aug 02, 2005 9:20 am
by sk8erh4x0r
scripts.php is included at the start of all the files in the subdirectories so session_start() is there.

Posted: Tue Aug 02, 2005 10:29 am
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).

Posted: Tue Aug 02, 2005 12:27 pm
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.

Posted: Wed Aug 03, 2005 11:50 am
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?