RE: [PHP] PHP new super globals or something else??

2002-05-29 Thread Ed Gorski

Well you should be using $_GET, $_POST and $_SESSION and turn 
register-globlals off as of PHP 4.2.1.I think you need to keep 
track-vars on for these arrays to be initialized.

ed

At 10:48 AM 5/29/2002 +1000, Martin Towell wrote:
code snippets would be good, if possible

-Original Message-
From: Gerard Samuel [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 29, 2002 10:46 AM
To: PHP
Subject: [PHP] PHP new super globals or something else??


I hope this makes sense to someone

Im converting a script over to work with 4.1.x +.
Im running php 4.1.2 on FreeBSD/Apache and I have 4.2.0 on w2k/IIS/Apache.
I sent the script to a friend of mine who is running w2k/Apache with 4.2.0.
He told me that the script isn't working for him but it was for me.
Upon closer inspection, I found out why it wasn't working for him, but
Im wondering why it is for me.
I have register global turned off on both machines.
In the initial load of the page, I used $_GET to grab some variables
from the url and pass it to hidden fields in the form.
$_GET['foo']
$_GET['bar']
Then the form is submitted to itself to insert into the database.  When
its submitted, the script is looking for 'foo' and 'bar', but
they are now in the $_POST, and this is where it breaks for the other
guy, because the script is still looking for 'foo' and 'bar' in
the $_GET array.  So in my case, it seems as if php is not behaving as
it should.
So, my question is, are there any other php options that I should be
looking for/using, to use the new variables in its strictest form.

If you need more info, dont hesitate to ask.
Thanks


--
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


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




[PHP] PHP new super globals or something else??

2002-05-28 Thread Gerard Samuel

I hope this makes sense to someone

Im converting a script over to work with 4.1.x +.
Im running php 4.1.2 on FreeBSD/Apache and I have 4.2.0 on w2k/IIS/Apache.
I sent the script to a friend of mine who is running w2k/Apache with 4.2.0.
He told me that the script isn't working for him but it was for me.
Upon closer inspection, I found out why it wasn't working for him, but 
Im wondering why it is for me.
I have register global turned off on both machines.
In the initial load of the page, I used $_GET to grab some variables 
from the url and pass it to hidden fields in the form.
$_GET['foo']
$_GET['bar']
Then the form is submitted to itself to insert into the database.  When 
its submitted, the script is looking for 'foo' and 'bar', but
they are now in the $_POST, and this is where it breaks for the other 
guy, because the script is still looking for 'foo' and 'bar' in
the $_GET array.  So in my case, it seems as if php is not behaving as 
it should.
So, my question is, are there any other php options that I should be 
looking for/using, to use the new variables in its strictest form.

If you need more info, dont hesitate to ask.
Thanks


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




RE: [PHP] PHP new super globals or something else??

2002-05-28 Thread Martin Towell

code snippets would be good, if possible

-Original Message-
From: Gerard Samuel [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 29, 2002 10:46 AM
To: PHP
Subject: [PHP] PHP new super globals or something else??


I hope this makes sense to someone

Im converting a script over to work with 4.1.x +.
Im running php 4.1.2 on FreeBSD/Apache and I have 4.2.0 on w2k/IIS/Apache.
I sent the script to a friend of mine who is running w2k/Apache with 4.2.0.
He told me that the script isn't working for him but it was for me.
Upon closer inspection, I found out why it wasn't working for him, but 
Im wondering why it is for me.
I have register global turned off on both machines.
In the initial load of the page, I used $_GET to grab some variables 
from the url and pass it to hidden fields in the form.
$_GET['foo']
$_GET['bar']
Then the form is submitted to itself to insert into the database.  When 
its submitted, the script is looking for 'foo' and 'bar', but
they are now in the $_POST, and this is where it breaks for the other 
guy, because the script is still looking for 'foo' and 'bar' in
the $_GET array.  So in my case, it seems as if php is not behaving as 
it should.
So, my question is, are there any other php options that I should be 
looking for/using, to use the new variables in its strictest form.

If you need more info, dont hesitate to ask.
Thanks


-- 
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] PHP new super globals or something else??

2002-05-28 Thread Miguel Cruz

On Tue, 28 May 2002, Gerard Samuel wrote:
 Then the form is submitted to itself to insert into the database.  When 
 its submitted, the script is looking for 'foo' and 'bar', but
 they are now in the $_POST, and this is where it breaks for the other 
 guy, because the script is still looking for 'foo' and 'bar' in
 the $_GET array.  So in my case, it seems as if php is not behaving as 
 it should.

You could use $_REQUEST, which include both get and post variables (as 
well as cookies, but that shouldn't matter unless you have overlapping 
namespace).

miguel


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




Re: [PHP] PHP new super globals or something else??

2002-05-28 Thread Gerard Samuel

Its a fairly long script but this is a basic rundown of the mechanics.

some_page.php
-
?php
/* user is sent here from another page, grab foo and bar from the url */
$foo = $_GET['foo'];
$bar = $_GET['bar'];

select * from database where this='$foo' and that='$bar';
$result = mysql_query();
if ($result === false)
{
trigger_error(...);  // - this is where it breaks for the other guy 
but not for me...
}

if (isset($_POST['submit']))
{
insert into database (col1, col2) values ('$foo', '$bar');
}
else
{
echo 'form action=some_page.php method=post';
echo 'input type=hidden name=foo value=' . $foo . '';
echo 'input type=hidden name=bar value=' . $bar . '';
echo 'input type=submit name=submit value=Submit';
}
?

Now as it stands, initially it would work fine, but when the form is 
submitted, it would break, because 'foo' and 'bar' are in $_POST.
For some reason, this is working on my boxes with register_globals set 
to off.

Martin Towell wrote:

code snippets would be good, if possible

-Original Message-
From: Gerard Samuel [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 29, 2002 10:46 AM
To: PHP
Subject: [PHP] PHP new super globals or something else??


I hope this makes sense to someone

Im converting a script over to work with 4.1.x +.
Im running php 4.1.2 on FreeBSD/Apache and I have 4.2.0 on w2k/IIS/Apache.
I sent the script to a friend of mine who is running w2k/Apache with 4.2.0.
He told me that the script isn't working for him but it was for me.
Upon closer inspection, I found out why it wasn't working for him, but 
Im wondering why it is for me.
I have register global turned off on both machines.
In the initial load of the page, I used $_GET to grab some variables 
from the url and pass it to hidden fields in the form.
$_GET['foo']
$_GET['bar']
Then the form is submitted to itself to insert into the database.  When 
its submitted, the script is looking for 'foo' and 'bar', but
they are now in the $_POST, and this is where it breaks for the other 
guy, because the script is still looking for 'foo' and 'bar' in
the $_GET array.  So in my case, it seems as if php is not behaving as 
it should.
So, my question is, are there any other php options that I should be 
looking for/using, to use the new variables in its strictest form.

If you need more info, dont hesitate to ask.
Thanks


  


-- 
Gerard Samuel
http://www.trini0.org:81/
http://dev.trini0.org:81/
http://www.myphpnuke.com




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




Re: [PHP] PHP new super globals or something else??

2002-05-28 Thread Lars Torben Wilson

On Tue, 2002-05-28 at 18:05, Gerard Samuel wrote:
 Its a fairly long script but this is a basic rundown of the mechanics.
 
 some_page.php
 -
 ?php
 /* user is sent here from another page, grab foo and bar from the url */
 $foo = $_GET['foo'];
 $bar = $_GET['bar'];
 
 select * from database where this='$foo' and that='$bar';
 $result = mysql_query();
 if ($result === false)
 {
 trigger_error(...);  // - this is where it breaks for the other guy 
 but not for me...
 }
 
 if (isset($_POST['submit']))
 {
 insert into database (col1, col2) values ('$foo', '$bar');
 }
 else
 {
 echo 'form action=some_page.php method=post';
 

You're POSTing the variables back to the form. Change your method
to get and you should be fine.

 echo 'input type=hidden name=foo value=' . $foo . '';
 echo 'input type=hidden name=bar value=' . $bar . '';
 echo 'input type=submit name=submit value=Submit';
 }
 ?
 
 Now as it stands, initially it would work fine, but when the form is 
 submitted, it would break, because 'foo' and 'bar' are in $_POST.
 For some reason, this is working on my boxes with register_globals set 
 to off.
 
 Martin Towell wrote:
 
 code snippets would be good, if possible
 
 -Original Message-
 From: Gerard Samuel [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, May 29, 2002 10:46 AM
 To: PHP
 Subject: [PHP] PHP new super globals or something else??
 
 
 I hope this makes sense to someone
 
 Im converting a script over to work with 4.1.x +.
 Im running php 4.1.2 on FreeBSD/Apache and I have 4.2.0 on w2k/IIS/Apache.
 I sent the script to a friend of mine who is running w2k/Apache with 4.2.0.
 He told me that the script isn't working for him but it was for me.
 Upon closer inspection, I found out why it wasn't working for him, but 
 Im wondering why it is for me.
 I have register global turned off on both machines.
 In the initial load of the page, I used $_GET to grab some variables 
 from the url and pass it to hidden fields in the form.
 $_GET['foo']
 $_GET['bar']
 Then the form is submitted to itself to insert into the database.  When 
 its submitted, the script is looking for 'foo' and 'bar', but
 they are now in the $_POST, and this is where it breaks for the other 
 guy, because the script is still looking for 'foo' and 'bar' in
 the $_GET array.  So in my case, it seems as if php is not behaving as 
 it should.
 So, my question is, are there any other php options that I should be 
 looking for/using, to use the new variables in its strictest form.
 
 If you need more info, dont hesitate to ask.
 Thanks
 
 
   
 
 
 -- 
 Gerard Samuel
 http://www.trini0.org:81/
 http://dev.trini0.org:81/
 http://www.myphpnuke.com
 
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
-- 
 Torben Wilson [EMAIL PROTECTED]
 http://www.thebuttlesschaps.com
 http://www.hybrid17.com
 http://www.inflatableeye.com
 +1.604.709.0506


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




Re: [PHP] PHP new super globals or something else??

2002-05-28 Thread Gerard Samuel

  Actually, no.  $foo and $bar are controls to let the script know which 
threads (its a forum script) to follow.
This merely an example.
Im not really looking for a fix for the script, thats a no brainer, but 
an explanation as to why the script is not behaving as it is supposed to be
with register_globals set to off.
If its going to run on my box, it would be nice if it ran on everyone 
elses to.


Lars Torben Wilson wrote:

On Tue, 2002-05-28 at 18:05, Gerard Samuel wrote:
  

Its a fairly long script but this is a basic rundown of the mechanics.

some_page.php
-
?php
/* user is sent here from another page, grab foo and bar from the url */
$foo = $_GET['foo'];
$bar = $_GET['bar'];

select * from database where this='$foo' and that='$bar';
$result = mysql_query();
if ($result === false)
{
trigger_error(...);  // - this is where it breaks for the other guy 
but not for me...
}

if (isset($_POST['submit']))
{
insert into database (col1, col2) values ('$foo', '$bar');
}
else
{
echo 'form action=some_page.php method=post';


 

You're POSTing the variables back to the form. Change your method
to get and you should be fine.

  

echo 'input type=hidden name=foo value=' . $foo . '';
echo 'input type=hidden name=bar value=' . $bar . '';
echo 'input type=submit name=submit value=Submit';
}
?

Now as it stands, initially it would work fine, but when the form is 
submitted, it would break, because 'foo' and 'bar' are in $_POST.
For some reason, this is working on my boxes with register_globals set 
to off.

Martin Towell wrote:



code snippets would be good, if possible

-Original Message-
From: Gerard Samuel [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 29, 2002 10:46 AM
To: PHP
Subject: [PHP] PHP new super globals or something else??


I hope this makes sense to someone

Im converting a script over to work with 4.1.x +.
Im running php 4.1.2 on FreeBSD/Apache and I have 4.2.0 on w2k/IIS/Apache.
I sent the script to a friend of mine who is running w2k/Apache with 4.2.0.
He told me that the script isn't working for him but it was for me.
Upon closer inspection, I found out why it wasn't working for him, but 
Im wondering why it is for me.
I have register global turned off on both machines.
In the initial load of the page, I used $_GET to grab some variables 
  

from the url and pass it to hidden fields in the form.


$_GET['foo']
$_GET['bar']
Then the form is submitted to itself to insert into the database.  When 
its submitted, the script is looking for 'foo' and 'bar', but
they are now in the $_POST, and this is where it breaks for the other 
guy, because the script is still looking for 'foo' and 'bar' in
the $_GET array.  So in my case, it seems as if php is not behaving as 
it should.
So, my question is, are there any other php options that I should be 
looking for/using, to use the new variables in its strictest form.

If you need more info, dont hesitate to ask.
Thanks


 

  

-- 
Gerard Samuel
http://www.trini0.org:81/
http://dev.trini0.org:81/
http://www.myphpnuke.com




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





-- 
Gerard Samuel
http://www.trini0.org:81/
http://dev.trini0.org:81/
http://www.myphpnuke.com




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




RE: [PHP] PHP new super globals or something else??

2002-05-28 Thread Martin Towell

well this sql :
select * from database where this='$foo' and that='$bar';
should become :
select * from database where this='' and that='';
after you substitute the variables in.

This looks like a valid sql to me, unless the database is set up to
_dis_allow zero length strings... I'd suggest looking at the two database
schemas to see if they're exactly to same

-Original Message-
From: Gerard Samuel [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 29, 2002 11:30 AM
To: PHP
Subject: Re: [PHP] PHP new super globals or something else??


  Actually, no.  $foo and $bar are controls to let the script know which 
threads (its a forum script) to follow.
This merely an example.
Im not really looking for a fix for the script, thats a no brainer, but 
an explanation as to why the script is not behaving as it is supposed to be
with register_globals set to off.
If its going to run on my box, it would be nice if it ran on everyone 
elses to.


Lars Torben Wilson wrote:

On Tue, 2002-05-28 at 18:05, Gerard Samuel wrote:
  

Its a fairly long script but this is a basic rundown of the mechanics.

some_page.php
-
?php
/* user is sent here from another page, grab foo and bar from the url */
$foo = $_GET['foo'];
$bar = $_GET['bar'];

select * from database where this='$foo' and that='$bar';
$result = mysql_query();
if ($result === false)
{
trigger_error(...);  // - this is where it breaks for the other guy 
but not for me...
}

if (isset($_POST['submit']))
{
insert into database (col1, col2) values ('$foo', '$bar');
}
else
{
echo 'form action=some_page.php method=post';


 

You're POSTing the variables back to the form. Change your method
to get and you should be fine.

  

echo 'input type=hidden name=foo value=' . $foo . '';
echo 'input type=hidden name=bar value=' . $bar . '';
echo 'input type=submit name=submit value=Submit';
}
?

Now as it stands, initially it would work fine, but when the form is 
submitted, it would break, because 'foo' and 'bar' are in $_POST.
For some reason, this is working on my boxes with register_globals set 
to off.

Martin Towell wrote:



code snippets would be good, if possible

-Original Message-
From: Gerard Samuel [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 29, 2002 10:46 AM
To: PHP
Subject: [PHP] PHP new super globals or something else??


I hope this makes sense to someone

Im converting a script over to work with 4.1.x +.
Im running php 4.1.2 on FreeBSD/Apache and I have 4.2.0 on
w2k/IIS/Apache.
I sent the script to a friend of mine who is running w2k/Apache with
4.2.0.
He told me that the script isn't working for him but it was for me.
Upon closer inspection, I found out why it wasn't working for him, but 
Im wondering why it is for me.
I have register global turned off on both machines.
In the initial load of the page, I used $_GET to grab some variables 
  

from the url and pass it to hidden fields in the form.


$_GET['foo']
$_GET['bar']
Then the form is submitted to itself to insert into the database.  When 
its submitted, the script is looking for 'foo' and 'bar', but
they are now in the $_POST, and this is where it breaks for the other 
guy, because the script is still looking for 'foo' and 'bar' in
the $_GET array.  So in my case, it seems as if php is not behaving as 
it should.
So, my question is, are there any other php options that I should be 
looking for/using, to use the new variables in its strictest form.

If you need more info, dont hesitate to ask.
Thanks


 

  

-- 
Gerard Samuel
http://www.trini0.org:81/
http://dev.trini0.org:81/
http://www.myphpnuke.com




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





-- 
Gerard Samuel
http://www.trini0.org:81/
http://dev.trini0.org:81/
http://www.myphpnuke.com




-- 
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] PHP new super globals or something else??

2002-05-28 Thread Gerard Samuel

  Ill see what else I find.  Thanks...

Martin Towell wrote:

well this sql :
   select * from database where this='$foo' and that='$bar';
should become :
   select * from database where this='' and that='';
after you substitute the variables in.

This looks like a valid sql to me, unless the database is set up to
_dis_allow zero length strings... I'd suggest looking at the two database
schemas to see if they're exactly to same

-Original Message-
From: Gerard Samuel [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 29, 2002 11:30 AM
To: PHP
Subject: Re: [PHP] PHP new super globals or something else??


  Actually, no.  $foo and $bar are controls to let the script know which 
threads (its a forum script) to follow.
This merely an example.
Im not really looking for a fix for the script, thats a no brainer, but 
an explanation as to why the script is not behaving as it is supposed to be
with register_globals set to off.
If its going to run on my box, it would be nice if it ran on everyone 
elses to.


Lars Torben Wilson wrote:

  

On Tue, 2002-05-28 at 18:05, Gerard Samuel wrote:
 



Its a fairly long script but this is a basic rundown of the mechanics.

some_page.php
-
?php
/* user is sent here from another page, grab foo and bar from the url */
$foo = $_GET['foo'];
$bar = $_GET['bar'];

select * from database where this='$foo' and that='$bar';
$result = mysql_query();
if ($result === false)
{
   trigger_error(...);  // - this is where it breaks for the other guy 
but not for me...
}

if (isset($_POST['submit']))
{
   insert into database (col1, col2) values ('$foo', '$bar');
}
else
{
   echo 'form action=some_page.php method=post';
   

  



You're POSTing the variables back to the form. Change your method
to get and you should be fine.

 



   echo 'input type=hidden name=foo value=' . $foo . '';
   echo 'input type=hidden name=bar value=' . $bar . '';
   echo 'input type=submit name=submit value=Submit';
}
?

Now as it stands, initially it would work fine, but when the form is 
submitted, it would break, because 'foo' and 'bar' are in $_POST.
For some reason, this is working on my boxes with register_globals set 
to off.

Martin Towell wrote:

   

  

code snippets would be good, if possible

-Original Message-
From: Gerard Samuel [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 29, 2002 10:46 AM
To: PHP
Subject: [PHP] PHP new super globals or something else??


I hope this makes sense to someone

Im converting a script over to work with 4.1.x +.
Im running php 4.1.2 on FreeBSD/Apache and I have 4.2.0 on


w2k/IIS/Apache.
  

I sent the script to a friend of mine who is running w2k/Apache with


4.2.0.
  

He told me that the script isn't working for him but it was for me.
Upon closer inspection, I found out why it wasn't working for him, but 
Im wondering why it is for me.
I have register global turned off on both machines.
In the initial load of the page, I used $_GET to grab some variables 
 



from the url and pass it to hidden fields in the form.
   

  

$_GET['foo']
$_GET['bar']
Then the form is submitted to itself to insert into the database.  When 
its submitted, the script is looking for 'foo' and 'bar', but
they are now in the $_POST, and this is where it breaks for the other 
guy, because the script is still looking for 'foo' and 'bar' in
the $_GET array.  So in my case, it seems as if php is not behaving as 
it should.
So, my question is, are there any other php options that I should be 
looking for/using, to use the new variables in its strictest form.

If you need more info, dont hesitate to ask.
Thanks




 



-- 
Gerard Samuel
http://www.trini0.org:81/
http://dev.trini0.org:81/
http://www.myphpnuke.com




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


   

  


  


-- 
Gerard Samuel
http://www.trini0.org:81/
http://dev.trini0.org:81/




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