NYCPHP Meetup

NYPHP.org

[nycphp-talk] Designing without register_globals

felix zaslavskiy felix at students.poly.edu
Fri Feb 20 14:03:25 EST 2004


 I dont think that register_globals is your problem. register_globals
has to do weather you can access a variable from Query string in a
shortcut(possible insecure) way. You can alwasy get to Query string with
$_GET.

You want to keep state between requests but you dont watn to make a
Query string in the url.  You can use Sessions. I dont know how the ENV
works that you use, at first i thought that would not work because
apache may be running in deferent processes so not all php requests
would have access to the same environment.

I think you can potentialy do all kinds of stuff with mod_rewrite and
set ENV with the RewriteRules.  You can have different urls that all get
rewriten to the same php script and in the rewrite rule you can set the
original url into the ENV so the php script can access it.  I dont dont
have the code you would have to write it yourself or find it online.

> On my site (http://www.linuxnj.com) I've done this by passing the
> variable $newpage back and forth, e.g. the URL for the  "Services"
> link is "http://www.linuxnj.com/index.php?newpage=tech".  This
> requires register_globals be turned on. BTW, the entire left sidebar
> is in a separate file that is included().
> 
> I do NOT want register_globas on in my client's site. So I've
> registered a variable called $_ENV["newpage"].  MY problem is I can't
> figure out how to set the variable when a user clicks on the "FAQ"
> link.  On top of that, I'm afraid I need to put PHP code in the
> shortcuts.html file, which makes it more complicated for my end-user.





More information about the talk mailing list