Forum Moderators: coopster

Message Too Old, No Replies

session_start() on every page?

         

nuwanda

6:47 am on Aug 29, 2005 (gmt 0)

10+ Year Member



Hi

My host doesn't set session.auto_start=true so I've been putting session_start() at the top of each page. Everything works fine (as long as cookies are on).

Question: is there any downside to using session_start() on every page? It's only checking for a client-side $PHPSESSID, right?

Ross

DaButcher

9:07 am on Aug 29, 2005 (gmt 0)

10+ Year Member



You should always start the session at the very top of your pages, which use sessions.

If you are worrying about session cookies, firewalls, etc. you can parse the SID in the querystring like so:
<a href="foo.php?<?=SID?>">foo</a>

The same goes for forms:
<form action="?<?=SID?>" method="post">