Re: Register Globals Query

From: Date: Tue, 29 Apr 2003 14:42:27 +0000
Subject: Re: Register Globals Query
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-145665@lists.php.net to get a copy of this message
--- caspar kennerdale <caspar@thetuckshop.com> wrote: > I have a register globals query and apologise if I am going over > old ground, > but I have not been able to clarify my issue in the archives. > I am in the process of updating a CMS I had written (but havent > coded in 2 > years). > Please excuse whast may seem like basic questions > > I have two queries. > > Switch functions now work by using $_GET['action']. I thing I am > unclear > about is in order to refer to a case do you still refer to it in > the url? > > switch ($_GET['action']) { > default: > echo "<a href=\"admin.php?action=Test\">test</a>"; > break; > > case "Test": > echo "yep"; > break; > } > > (This works! I am not sure if I am missing the point about having > register > globals turned off) Yes, the way you have it is correct. The point about having globals turned off is documented in many places, but one point is to prevent people from injecting and setting variables you weren't expecting into your script. > > > > The next issue is how to refer to a second variable within this > scenario. > > My pre php 4.3 url would look like > admin.php?action=Test&variable=123 > > It would seem that I would want to use $GET for both 'action' and > 'variable', but all my attempts to call 'variable' in the above > example dont seem to work. That is the appropriate method - you would use $_GET{"variable"]. I'm having trouble searching php.net right now, but is it possible that "variable" is reserved? ===== Mark Weinstock mark_weinstock@yahoo.com *************************************** You can't demand something as a "right" unless you are willing to fight to death to defend everyone else's right to the same thing. *************************************** __________________________________ Do you Yahoo!? The New Yahoo! Search - Faster. Easier. Bingo. http://search.yahoo.com

« previous php.general (#145665) next »