On Wed, Nov 4, 2009 at 9:49 PM, Tim Lieberman <tim_li...@o2group.com> wrote:

True.  You've just learned a valuable lesson: You should only ever call
> session_start() in one place.


It's funny; that just occurred to me as I was about to read your response.
"Why on earth," I started saying to myself, "would I have called this from
multiple places?"  Sure enough, my login.php script does exactly that.  What
I should really be doing is starting the session in one place (I call it
_header.inc), which I already include from every other script -- except a
couple of really old ones, like login.php, which I was too lazy to rewrite
when I re-engineered this project with PHP 5 compliance, jQuery, etc.

So, pilot error.  :)


> I suggest you do *both*.  If you're repeating configuration stuff
> (session_start()) all over the place, you should be refactoring anyway.
>
> Doing some fake namespacing in $_SESSION is a good idea, too.
>
> I'd do both, but I'd refactor all of your configuration/bootstrapping
> first.
>

That's exactly what I'm going to do.  I also started thinking about when I
roll this software out for other faculty to use; each instance should be
creating its own session variables.

Anyway, thanks Tim and list for helping me find my mistake.
-c
_______________________________________________
New York PHP Users Group Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

http://www.nyphp.org/Show-Participation

Reply via email to