Re: Register_globals = off version of Manuel Lemos's form class?
| From: | Jason Wong | Date: | Wed, 13 Nov 2002 19:31:20 +0000 |
| Subject: | Re: Register_globals = off version of Manuel Lemos's form class? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-124288@lists.php.net to get a copy of this message | ||
On Wednesday 13 November 2002 23:57, Leif K-Brooks wrote:
> I am planning to use Manuel Lemos's form class for a web site I am
> working on. However, I need to have register_globals set to off. I was
> planning to rewrite the portions of the class that access submitted form
> values directly to use the suberglobal arrays. When I started, though,
> I saw how big the class was. I'm wondering if anyone else has already
> done this, and wouldn't mind sharing their code?
Here's what I use:
function InjectGlobalVars() {
$method = $this->METHOD;
switch (strtolower($method)) {
case "post" :
if (isset($_POST)) {
foreach ($this->inputs as $name => $value) {
if (isset($_POST[$name])) {
$GLOBALS[$name] = $_POST[$name];
}
}
}
break;
case "get" :
if (isset($_GET)) {
foreach ($this->inputs as $name => $value) {
if (isset($_GET[$name])) {
$GLOBALS[$name] = $_GET[$name];
}
}
}
break;
}
}
After I've defined all the form elements I just call the above function.
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
/*
My father, a good man, told me, "Never lose your ignorance; you cannot
replace it."
-- Erich Maria Remarque
*/