[Phpwm] writing to superglobals

Phil Beynon phil at infolinkelectronics.co.uk
Fri Sep 25 17:23:16 UTC 2009


Hi all,

I've got a page that used to have register_globals on which is now off that
is controlled by a running variable flag called $action, this then triggers
a series of functions;


$siteurl		= $_POST[siteurl];
$short		= $_POST[short_p];
$refcode		= $_POST[refcode_p];
$ident		= $_POST[ident_p];
$availability	= $_POST[availability];
$shipping		= $_POST[shipping];
$country		= $_POST[country];
$name			= $_POST[name];
$emaila		= $_POST[emaila];
$phone		= $_POST[phone];
$comments		= $_POST[comments];
$action		= $_POST[action];
$q1			= $_POST[q1];
switch($action){// entry point
case "":
register_form();
break;}
switch($action){// processing form data
case "register":
create_account();
$action		= $_POST[action];
break;}

and so on.......

I can see that some $_post variables need to be operative in there to
essentially give them a global effect, but if the $action one isnt modified
at certain points either by the action of a submit button or explicitly
altering its value the script stops at that point.

The question is; is it considered bad practice to write directly to
superglobal arrays in this way and is it likely to bite me later in any way?
i.e. is there anything I should check for to make sure the array isn't read
only or anything suchlike?

Regards,

Phil Beynon
Sales & Operations Director

** Infolink Electronic Systems Ltd.
** S/W Birmingham's Longest Established ISV & VAR
** http://www.infolinkelectronics.co.uk
** Professional Web 2.0 Design & Advanced Hosting Platforms
** http://www.coeus-computica.co.uk
** Affordable Knowledgebase Solutions
** Contact: Sales at infolinkelectronics.co.uk
** Tel / Fax 0121 441 3558

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Phil Beynon.vcf
Type: text/x-vcard
Size: 636 bytes
Desc: not available
Url : http://mailman.lug.org.uk/pipermail/phpwm/attachments/20090925/7d8808d3/attachment.vcf 


More information about the Phpwm mailing list