[PHP] Register_globals = off-compliant form class?

2002-11-16 Thread Leif K-Brooks
I'm looking for a good class for forms that will work with 
register_globals off.  I was planning to modify Manuel Lemos's class, 
but it turned out to be too big of a task.  Any ideas?

--
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-compliant form class?

2002-11-16 Thread BigDog
try using pear...



On Sat, 2002-11-16 at 22:53, Leif K-Brooks wrote:
 I'm looking for a good class for forms that will work with 
 register_globals off.  I was planning to modify Manuel Lemos's class, 
 but it turned out to be too big of a task.  Any ideas?
 
 -- 
 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.
-- 
.: B i g D o g :.



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




[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




[PHP] register_globals off issues

2002-11-12 Thread Mark Spohr
I'm very new to PHP/mySQL and am working through the PHP and mySQL for 
Dummies examples. Unfortunately, these were all written with 
register_globals on and the system I'm using has register_globals off.

I'm having trouble converting the examples to use the $_POST() expression.

Specifically, the examples use a POST with a form variable to run a 
query and then unset this variable as such:

if (@$form == yes)
{
unset($form);
}

I'm trying to convert this to use $_POST() as such:

 if (@$_POST['form'] == yes)
{
unset($_POST['form']);
}

However, this does not work. It appears that you can't unset the 
$_POST['form'] array element.

Does anyone have any suggestions on how to fix this?
I know I'm probably missing a few very obvious things here... but I am a 
newbie.

/Mark
--
Mark H. Spohr
email: [EMAIL PROTECTED]




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



Re: [PHP] register_globals off issues

2002-11-12 Thread Ernest E Vogelsinger
At 21:05 12.11.2002, Mark Spohr said:
[snip]
I'm trying to convert this to use $_POST() as such:

  if ($_POST['form'] == yes)
{
unset($_POST['form']);
}

However, this does not work. It appears that you can't unset the 
$_POST['form'] array element.
[snip] 

unset() works for any variable - also for the superglobals like $_POST.
Try this:

[cut here] 
xmp
?php
print_r($_POST);
echo 'F1 = ', $_POST['f1'], \nF2 = , $_POST['f2'], \n;
unset($_POST['f2']);
print_r($_POST);
?
/xmp
form method=POST
input type=text name=f1 value=?php echo $_POST['f1'];?
br
input type=text name=f2 value=?php echo $_POST['f2'];?
br
input type=submit
/form
[/cut here] 

What error do you get? Make sure you're using the correct case - PHP is
case sensitive in variable names and associative index keys...


-- 
   O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



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




[PHP] register_globals = Off

2002-09-06 Thread Holzner Roland

Hi there
 
In my shop a had this code to add a product to the shoppingcart:
 
session_start();
session_register(cart);
 
if($action == addtocart)
  {
  $cart[] = $id,$amount;
  }
 
To view the cart i had to explode the session_variable $cart and get
more data from the database.
 
session_start();
 
foreach($cart as $value)
  {
  $value = list($id, $amount) = explode(,, $value);
  echo $id : $amount\n;
  }
 
This workt perfect bevor i hat to reinstall my Computer.
Now i have php 4.2.2 and every time i want to add a product to the cart
it overwrites my session_variable.
So now i have only the newest variable in the session_variable.
I've tried it with $_REQUEST, $_SESSION, import_request_variables() but
none of them gives me my array back.
 
Can you help me ?



[PHP] register_globals off or on, why on

2002-08-25 Thread Peter J. Schoenster

Hi,

I'm working on a site where I'm using geeklog 
http://geeklog.sourceforge.net/ 

It has the requirement that 

 Geeklog needs the register_globals variable turned on in order to work.
 Since PHP 4.2.0, the default for register_globals is off. To fix it,
 simply add the following line to your php.ini file

Is this not *wrong*. It sounds to me like fake laziness. Nothing drives 
me bonkers more than trying to track down a variable that is inherited 
from who knows where. 

Perhaps I'm missing something. I've recently worked on a lot of PHP 
code written by others and it's a nightmare trying to track down where 
a variable is defined and where it's value might be changed.  Perhaps 
there is some tool I can use to trace this. I dunno. 

Am I correct in my aversion to globals or I am I missing their true 
value and perhaps some tools I could use when working on apps that have 
more than 50 php files floating all over the place and no 
documentation.

Peter





---
Reality is that which, when you stop believing in it, doesn't go
away.
-- Philip K. Dick


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




Re: [PHP] register_globals off or on, why on

2002-08-25 Thread Rasmus Lerdorf

 I'm working on a site where I'm using geeklog
 http://geeklog.sourceforge.net/

 It has the requirement that

  Geeklog needs the register_globals variable turned on in order to work.
  Since PHP 4.2.0, the default for register_globals is off. To fix it,
  simply add the following line to your php.ini file

 Is this not *wrong*. It sounds to me like fake laziness. Nothing drives
 me bonkers more than trying to track down a variable that is inherited
 from who knows where.

If you initialize all your local variables, there is nothing wrong with
having register_globals on.  Well-written apps run quite nicely and
securely with them on.  The reason to turn them off is to protect yourself
from crappy code.

-Rasmus


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




[PHP] register_globals=Off Question

2002-04-28 Thread Kirk Babb

How do I use $PHP_SELF with register_globals off?  I looked up the
documentation on php.net but haven't gotten this line of code to work:

form name=form5 method=post action='?php echo($_SERVER[PHP_SELF];
?'

I get this error instead:

[28-Apr-2002 16:33:31] PHP Parse error:  parse error, expecting `T_STRING'
or `T_VARIABLE' or `T_NUM_STRING' in - on line 140

what am I doing wrong?  thanks,

Kirk



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




RE: [PHP] register_globals=Off Question

2002-04-28 Thread John Holmes

You are missing an ending quote to begin with. Either add it in and use
braces, or remove the quotes.

action = '?=$_SERVER[PHP_SELF]?'

or...

action = '? echo $_SERVER[PHP_SELF]; ?'

or...

action = '? echo {$_SERVER['PHP_SELF']}; ?'

Adapt to your needs...

---John Holmes...


 -Original Message-
 From: Kirk Babb [mailto:[EMAIL PROTECTED]]
 Sent: Sunday, April 28, 2002 3:58 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] register_globals=Off Question
 
 How do I use $PHP_SELF with register_globals off?  I looked up the
 documentation on php.net but haven't gotten this line of code to work:
 
 form name=form5 method=post action='?php
echo($_SERVER[PHP_SELF];
 ?'
 
 I get this error instead:
 
 [28-Apr-2002 16:33:31] PHP Parse error:  parse error, expecting
`T_STRING'
 or `T_VARIABLE' or `T_NUM_STRING' in - on line 140
 
 what am I doing wrong?  thanks,
 
 Kirk
 
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



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




Re: [PHP] register_globals=Off Question

2002-04-28 Thread Miguel Cruz

On Sun, 28 Apr 2002, Kirk Babb wrote:
 How do I use $PHP_SELF with register_globals off?  I looked up the
 documentation on php.net but haven't gotten this line of code to work:
 
 form name=form5 method=post action='?php echo($_SERVER[PHP_SELF];
 ?'

action='?= $_SERVER['PHP_SELF'] ?'

miguel


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




Re: [PHP] register_globals=Off Question

2002-04-28 Thread Steve Buehler

Looks like you forgot your ticks ' around the PHP_SELF.  If I am correct, 
it should be $_SERVER['PHP_SELF'].
Either way, you might want to try this.  Somebody else posted it before and 
I have been using it so that no matter what version of PHP my program runs 
on, it should work.
if (isset($_SERVER)) $PHP_SELF = $_SERVER['PHP_SELF'];

Steve

At 05:58 PM 4/28/2002, Kirk Babb wrote:
How do I use $PHP_SELF with register_globals off?  I looked up the
documentation on php.net but haven't gotten this line of code to work:

form name=form5 method=post action='?php echo($_SERVER[PHP_SELF];
?'

I get this error instead:

[28-Apr-2002 16:33:31] PHP Parse error:  parse error, expecting `T_STRING'
or `T_VARIABLE' or `T_NUM_STRING' in - on line 140

what am I doing wrong?  thanks,

Kirk



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


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