[Cialug] Slightly OT: register_globals in PHP & sessions

Dave J. Hala Jr. cialug@cialug.org
Wed, 05 Jan 2005 21:55:58 -0600


If you're hosting an application for someone, you shouldn't let them do
bad things. 


On Wed, 2005-01-05 at 18:21, Bailey, Jonathan C wrote:
> 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.
>  
> 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] = "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?
> > 
> > 
> > 
> > --------------------
> > Jonathan Bailey
> > POS Analyst
> > bailj0@bp.com
> > (515) 226-5005
> > 
> > _______________________________________________
> > Cialug mailing list
> > Cialug@cialug.org
> > http://cialug.org/mailman/listinfo/cialug
-- 

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