[UPHPU] PHP Session and Comment Question

Walt Haas haas at xmission.com
Fri May 5 16:47:54 MDT 2006


> My trouble with the login and session propagation is that all the tutorials
> I`ve seen online, I`ve looked at codemonkey and phpfreaks, seem to be based
> on php that is before PHP4 and uses global variables that are depreciated,
> the $HTTP_XXX_VARS variables. I was hoping someone could point me to a more
> up to date tutorial, using the new globals ($_GET, $_POST) and or cookies.

There's less to it than meets the eye :-)

At the top of every page code:

  session_start()

When you want information to be available later in the session, store
it in $_SESSION with a suitable key, then retrieve it with that key
later.

Getting rid of a session is a little more work, you need to kill the
cookie with the session id then call:

  session_destroy()

As far as frameworks that simplify sessions goes, you might want to
look at Trax:

  http://www.phpontrax.com

One advantage of using Trax is that if the documentation is unclear
you can tell the author about it at the next UPHPU meeting :-)

-- Walt
-------
Walt Haas          The Web Site Doctor - Cures Sick Web Sites
(801) 534-1262     http://thewebsitedoctor.net


More information about the UPHPU mailing list