|
Posted by user@example.com on 04/04/07 00:29
cwhite@theatomicmoose.ca wrote:
[snip]
>
> i have tried turning on register_globals but the problem persists
>
> any ideas on how i can fix this in php.ini without having to go and re-
> write all of my scripts (i'm kind of lazy today)
>
> thanks
>
Try popping a phpinfo() into the top of your script and checking
register_globals really is On, if not then something is not right in
configuration or its overridden somewhere (maybe a .htaccess)
OR
Do it properly and $id=$_GET["id"]; at the top of script
OR
Make your own function to create the vars and put this into an include
file to be included at top of your page, but a bit risky security
wise, something like (I write this straight into email so not tested):
autoreg.php
<?php
foreach($_GET AS $key=>$value) {
$$key=$value;
}
?>
test.php
<?php
require_once('autoreg.php');
if (isset($id)) echo "{$id}<br />";
if (isset($name)) echo "{$name}<br />";
?>
If you called this as myreg.php?id=1&name=Bob then it would print both
the $id value and $bob value, you'd need to amend autoreg.php to include
$_POST, $_SESSION etc. if you wanted and in the order you wanted as one
would override the other if the key existed in say $_GET and $_SESSION etc.
Personally, I'd write your code correctly for the newer PHP 5 standard
if you can ;-)
[Back to original message]
|