[PHP] Register_globals = off version of Manuel Lemos's form class?

2002-11-13 Thread Leif K-Brooks
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?

--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Register_globals = off version of Manuel Lemos's form class?

2002-11-13 Thread Jason Wong
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
*/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Register_globals = off version of Manuel Lemos's form class?

2002-11-13 Thread Marek Kilimajer
Even if the method is post, you can have get variables, if the form has 
action=script.php?get_var=value

Jason Wong wrote:

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. 

 



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Register_globals = off version of Manuel Lemos's form class?

2002-11-13 Thread Jason Wong
On Thursday 14 November 2002 03:41, Marek Kilimajer wrote:
 Even if the method is post, you can have get variables, if the form has
 action=script.php?get_var=value

Yes but I don't (need to) define my forms like that so I don't really care :-)

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
Great Moments in History: #3

August 27, 1949:
A Hall of Fame opened to honor outstanding members of the
Women's Air Corp.  It was a WAC's Museum.
*/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php