You are here: Re: Help with register_globals on « All PHP « IT news, forums, messages
Re: Help with register_globals on

Posted by J.O. Aho on 11/11/06 10:24

affiliateian@gmail.com wrote:
> Ooops, spoke too soon. The if statement works but now other varibles
> variables are not registering in MySQL once Global Register is turned
> off. In the VALUES line after INSERT, what should go in here?
>
> VALUES ('$name', '$email')
>

You have to do that with all the variable that has been passed from the form
to the script

$name=$_REQUEST['name'];
and so on...

Or if you aren't that concerned that someone would try to overwrite your
internal variables, you could just add the following code to the top of your
scripts



if(!get_cfg_var("register_globals")) {

if (!empty($_GET)) {
extract($_GET);
} else if (!empty($HTTP_GET_VARS)) {
extract($HTTP_GET_VARS);
}

if (!empty($_POST)) {
extract($_POST);
} else if (!empty($HTTP_POST_VARS)) {
extract($HTTP_POST_VARS);
}

if (!empty($_COOKIE)) {
extract($_COOKIE);
} else if (!empty($HTTP_COOKIE_VARS)) {
extract($HTTP_COOKIE_VARS);
}
}

What it does it translating all $_GET/$_POST/$_COOKIE to standard variables as
$name and $email.


//Aho

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация