[Cialug] Slightly OT: register_globals in PHP & sessions

Bailey, Jonathan C cialug@cialug.org
Wed, 5 Jan 2005 18:21:53 -0600


I need the register globals on for the bad practices of others.. I just
don't want variables like $_SESSION["whatever"] to get registered as
$whatever. I want session variables to stay in $_SESSION.


Jon


-----Original Message-----
From: cialug-admin@cialug.org [mailto:cialug-admin@cialug.org]On Behalf
Of Dave J. Hala Jr.
Sent: Wednesday, January 05, 2005 6:07 PM
To: Cialug
Subject: Re: [Cialug] Slightly OT: register_globals in PHP & sessions


You should turn register globals off, its not a "best practice".

Get your post/get variables using the $_POST[variable] or
$_GET[variable]

For your session varaible, I'm assuming you registered "whatever" by
doing a "session_register("whatever");" on your homepage.
=20
At the beginning of your script that wants access to the session
variable be sure you do a session_start();

it would look like this:
<?
session_start()

$_SESSION[whatever] =3D "value";

?>

:) Dave


On Wed, 2005-01-05 at 17:48, Bailey, Jonathan C wrote:
> I currently have register_globals on so that get and post elements can
be registered as variables. This has also set $_SESSION["whatever"] to
just $whatever. How do I get it to make get/post as global, but access
sessions through $_SESSION?
>=20
>=20
>=20
> --------------------
> Jonathan Bailey
> POS Analyst
> bailj0@bp.com
> (515) 226-5005
>=20
> _______________________________________________
> Cialug mailing list
> Cialug@cialug.org
> http://cialug.org/mailman/listinfo/cialug
--=20

Open Source Information Systems (OSIS)
Dave J. Hala Jr. <dave@osis.us>
641.485.1606

_______________________________________________
Cialug mailing list
Cialug@cialug.org
http://cialug.org/mailman/listinfo/cialug