RE: [PHP] $_POST not working with str_replace

2004-03-26 Thread Ford, Mike [LSS]
On 24 March 2004 22:28, PHP Email List wrote:

> And ? #2 are there any settings within PHP that would limit
> my ability to
> visually display the contents of a POST variable on a .rtf document as
> opposed to being displayed on the browser?

Yes -- take a look at the variables_order directive 
(http://uk.php.net/manual/en/configuration.directives.php#ini.variables-order) -- it's 
not immediately clear from its description that this is a relevant setting, but on the 
"Predefined variables" page 
(http://uk.php.net/manual/en/language.variables.predefined.php), the last sentence in 
the first section (just above the "PHP Superglobals" heading) says:

   "If certain variables in variables_order are not set, their appropriate PHP 
predefined arrays are also left empty."

It's clear from this that if your variables_order setting does not include "P", the 
$_POST array will not be populated in your scripts.

HTH

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



RE: [PHP] $_POST not working with str_replace

2004-03-24 Thread PHP Email List
> -Original Message-
> From: Rick Fletcher [mailto:[EMAIL PROTECTED]
>
> If your script has the same "==" where a plain ol' "=" should be, that'd
> account for the replacement being empty (since it's replaced with
> $na, which
> wasn't assigned).

Well your correct, that put me to ease some, as now I can default on my
original idea, store everything in a database then pull it out and assign it
a variable, which is what I assumed was along the same lines as a form POST,
guess not.

As far as the rest of your email. I copied and pasted "everything" from the
email and setup new files with just those lines and still nothing, changed
"POST" to "GET" and works great, even on your info. POST will not work on
this server for some reason. Which brings me to another idea...Does the file
that I am working on, the .rtf file that is also on the server, does that
have to have special permissions with POST as opposed to GET? (ie, read,
write and execute?)

And ? #2 are there any settings within PHP that would limit my ability to
visually display the contents of a POST variable on a .rtf document as
opposed to being displayed on the browser?

I'm sorry this one is so weird.

Also I guess I should throw this out since I believe John asked... I'm
running PHP 4.3.4 on Linux 2.4.24 powered by Zend Engine v1.3.0.  This is a
hosting service, so I can't make really any changes to the versions right
now. Maybe that in itself is a problem? *shrugs*
Thanks again for everyone's help on this!
Wolf

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



RE: [PHP] $_POST not working with str_replace

2004-03-24 Thread Rick Fletcher
> Ok here's the deal, I cut out the middle man, went straight 
> to the script, assigned my variable a string, and loaded the 
> rtf page, NADA, ZIP, ZILCH!!

At least as far as this test is concerned, I hope you have a nice soft desk
to bang your head on.  Check your assignment operator one more time.

>  //print_r($_POST);
> //$na = $_GET['f'];
> >$na == "Me";

If your script has the same "==" where a plain ol' "=" should be, that'd
account for the replacement being empty (since it's replaced with $na, which
wasn't assigned).

As far as the original troubles you're trying to diagnose, I loosely
replicated your setup and everything worked as expected. (I just made up a
Lettertest.rtf file.)  Below are the working files, see if they work for
you:

Cheers,

Rick

Form.html:
=








=

rtf1.php:
=
>', $name, $output );

echo $output;
?>
=

Lettertest.rtf:
=
a line of test
Hello, <>
another line
=

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



RE: [PHP] $_POST not working with str_replace

2004-03-24 Thread PHP Email List
> -Original Message-
> From: Brent Baisley [mailto:[EMAIL PROTECTED]

> What is
> interchangeable is $_REQUEST with $_POST or $_GET. You may try using
> $_REQUEST just for testing. If it works, then you could use $_REQUEST
> since it will work with GET or POST variables. Although that's not the
> best idea from a security standpoint.
> Also, have you looked at the web page source that is delivered to the
> browser? The web server may be serving a cached version of the page
> that has the form method set to GET instead of POST.
> Just throwing out some other ideas since you said you've tried most
> everything else.


Ok here's the deal, I cut out the middle man, went straight to the script,
assigned my variable a string, and loaded the rtf page, NADA, ZIP, ZILCH!!
The string replace function isn't even picking up the variable from within
the same script! Here's the code

(I added ---> to show where the variable is)
rtf1.php

$na == "Me";
$filename = "fname.rtf";

header('Content-Type: application/msword');

header('Content-Disposition: inline, "rtftest.rtf"');

$fp = fopen($filename, "r");

$output = fread($fp, filesize($filename));

$output = str_replace('', >$na, $output);
echo $output;
?>

So I have now determined that this has NOTHING to do with Get vs Post,
however, LOL, funny thing is, I put in my "$na = $_GET['f'];" from the form,
press submit and it works fine. This is seriously screwed up!!
For the sake of sanity, here is all of the form html

rtf.html










That's IT! And yes I have changed all the GET and POST parameters 5 times.
But this new find is what has really got me, why doesn't the str_replace();
function even pick up the "$na" variable from within the same script?

SERIOUSLY CONFUSED
Wolf >:-/ (sigh...)

PS. For the sake of simplicity, I made my rtf file from word show this
">><><<", on load it pulls out the  as it should but isn't replacing
anything there at all it shows this >><><< on load. Thanks in advanced for
this huge issue.  Because now, I can't even do my work around by loading
everything into a database first and then loading variables from there, as
str_replace() isn't even picking up on a straight variable either.  BUG??
I'm beginning to believe it is.  Maybe I should try pregmatch or some other
string swapping function. I don't knowPlease help...

Thanks again!!

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



RE: [PHP] $_POST not working with str_replace

2004-03-24 Thread PHP Email List
> -Original Message-
> From: Brent Baisley [mailto:[EMAIL PROTECTED]

> A technicality, but GET/POST are not interchangeable, it depends on the
> method declared in your form. I'm sure you meant they were
> interchangeable if you changed your form method.

Right I had mentioned that...

(all I'm doing is changing the action="GET" to action="POST" and on the
script side, changing all my $_GET['items'] to $_POST['items'])

> What is
> interchangeable is $_REQUEST with $_POST or $_GET. You may try using
> $_REQUEST just for testing. If it works, then you could use $_REQUEST
> since it will work with GET or POST variables. Although that's not the
> best idea from a security standpoint.
> Also, have you looked at the web page source that is delivered to the
> browser? The web server may be serving a cached version of the page
> that has the form method set to GET instead of POST.
> Just throwing out some other ideas since you said you've tried most
> everything else.

Thanks Brent for the ideas with the source, I'll try that, and I'll test
that Request idea too. :)

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



Re: [PHP] $_POST not working with str_replace

2004-03-24 Thread Brent Baisley
A technicality, but GET/POST are not interchangeable, it depends on the 
method declared in your form. I'm sure you meant they were 
interchangeable if you changed your form method. What is 
interchangeable is $_REQUEST with $_POST or $_GET. You may try using 
$_REQUEST just for testing. If it works, then you could use $_REQUEST 
since it will work with GET or POST variables. Although that's not the 
best idea from a security standpoint.
Also, have you looked at the web page source that is delivered to the 
browser? The web server may be serving a cached version of the page 
that has the form method set to GET instead of POST.
Just throwing out some other ideas since you said you've tried most 
everything else.

On Mar 23, 2004, at 10:04 PM, PHP Email List wrote:



-Original Message-
From: John W. Holmes [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 23, 2004 7:59 PM
Like someone else said, you need to whittle your code down to a 
minimum
and do a lot of variable checking along the way. Slowly add code back
until you find what's causing the problem. There's no reason using 
$_GET
over $_POST should matter, since you're assigning it to a holding
variable, anyhow. What version of PHP are you using?


Alright I'll try it from start, but again, it doesn't make any sense 
when
all I'm doing is changing the action="GET" to action="POST" and on the
script side, changing all my $_GET['items'] to $_POST['items'].  I'm 
just
wondering if the RTF format is being screwed up cuz it can't "read" the
variables from the URL like you do with GET.  I don't know just 
guessing,
but from my experience GET/POST are interchangeable as long as 
everything in
my GET form is received with $_GET['something'].

I let everyone know what I come up with. I'm hoping it's something 
stupid
and little like missing punctuation or some easy parse error that maybe
isn't showing up under the rtf conversion.

Thanks
Wolf
PS, "this reply better Chris?" :)

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

--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search & Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] $_POST not working with str_replace

2004-03-24 Thread Ford, Mike [LSS]
> -Original Message-
> From: PHP Email List [mailto:[EMAIL PROTECTED] 
> Sent: 24 March 2004 00:13
> 
> 
> what happens if you do the following?
> 
>  
> $name = $_POST['FNAME'];
> 
> echo "::$name::";
> 
> $output = str_replace("<>", $name, $output);
> 
> ?>
> 
> ??
> 
> I tried that, but I know I can get the values from the $_POST 
> array as per John's email about using print_r($_POST) to see 
> what was showing. And yes I get the value I wanted in between 
> the :: ::.
> 
> Thanks for trying though,
> 
> Anyone else have any ideas on this problem?

OK, if $name is ok, what's in $output at this point?  Try var_dump()-ing that.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services, JG125, James Graham 
Building, Leeds Metropolitan University, Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211

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



RE: [PHP] $_POST not working with str_replace

2004-03-23 Thread PHP Email List


> -Original Message-
> From: John W. Holmes [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, March 23, 2004 7:59 PM
>
> Like someone else said, you need to whittle your code down to a minimum
> and do a lot of variable checking along the way. Slowly add code back
> until you find what's causing the problem. There's no reason using $_GET
> over $_POST should matter, since you're assigning it to a holding
> variable, anyhow. What version of PHP are you using?


Alright I'll try it from start, but again, it doesn't make any sense when
all I'm doing is changing the action="GET" to action="POST" and on the
script side, changing all my $_GET['items'] to $_POST['items'].  I'm just
wondering if the RTF format is being screwed up cuz it can't "read" the
variables from the URL like you do with GET.  I don't know just guessing,
but from my experience GET/POST are interchangeable as long as everything in
my GET form is received with $_GET['something'].

I let everyone know what I come up with. I'm hoping it's something stupid
and little like missing punctuation or some easy parse error that maybe
isn't showing up under the rtf conversion.

Thanks
Wolf

PS, "this reply better Chris?" :)

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



Re: [PHP] $_POST not working with str_replace

2004-03-23 Thread John W. Holmes
PHP Email List wrote:

Ok I tried the print_r($_POST) and received...

Array ( [FNAME] => test [LNAME] => t [ADDRESS] => t [CITY] => t [STATE] => t
[ZIP] => t [DATE] => t [PARAGRAPH1]=> t [PARAGRAPH2] => t [FROM] => t
[SUBMIT] => TEST ME )
So they array isn't empty for my post. Obviously the values don't matter for
this array, but the array is still not being brought into the str_replace
function.  Is it possible that str_replace requires "GET" opposed to "POST"
for it to work? This is becoming very odd! Possible bug? I hate throwing
that out there but it doesn't make sense why one would work and the other
wouldn't since all any of them are doing is holding "strings".  Any other
ideas?
Like someone else said, you need to whittle your code down to a minimum 
and do a lot of variable checking along the way. Slowly add code back 
until you find what's causing the problem. There's no reason using $_GET 
over $_POST should matter, since you're assigning it to a holding 
variable, anyhow. What version of PHP are you using?

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com

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


RE: [PHP] $_POST not working with str_replace

2004-03-23 Thread Chris W. Parker
PHP Email List 
on Tuesday, March 23, 2004 4:13 PM said:

> I tried that, but I know I can get the values from the $_POST array
> as per John's email about using print_r($_POST) to see what was
> showing. And yes I get the value I wanted in between the :: ::.

hhhm!!! very strange.

have you tried making a simple test page that cuts out everything except
for the operations in question?



chris.

p.s. please quote your replies as your emails are sometimes very
difficult to follow. (there's a reason people do it. ;)

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



RE: [PHP] $_POST not working with str_replace

2004-03-23 Thread PHP Email List
what happens if you do the following?

>", $name, $output);

?>

??

I tried that, but I know I can get the values from the $_POST array as per
John's email about using print_r($_POST) to see what was showing. And yes I
get the value I wanted in between the :: ::.

Thanks for trying though,

Anyone else have any ideas on this problem?
Thanks!
Wolf

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



RE: [PHP] $_POST not working with str_replace

2004-03-23 Thread Chris W. Parker
PHP Email List 
on Tuesday, March 23, 2004 3:08 PM said:

> This is becoming very odd!
> Possible bug? I hate throwing that out there but it doesn't make
> sense why one would work and the other wouldn't since all any of them
> are doing is holding "strings".  Any other ideas?

sorry, jumping in late. hopefully this hasn't already been covered.

using some code from a previous email:

>> why. [snip] $name = $_POST['FNAME'];
> [snip]
>> $output = str_replace("<>",$name,$output);

what happens if you do the following?

>", $name, $output);

?>

??

Do you get the expected value betwee the two ::'s? If you aren't getting
what you're expecting that's where your problem is. If the contrary is
true, I have no idea. ;)


chris.

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



RE: [PHP] $_POST not working with str_replace

2004-03-23 Thread PHP Email List
PHP Email List wrote:

> Ok here's my problem, I'm in the midst of creating a string replace to
work
> on a rtf file that is on the server, this fuctionallity works perfect with
> "GET" but not "POST", I guess I don't understand why.
[snip]
> $name = $_POST['FNAME'];
[snip]
> $output = str_replace("<>",$name,$output);

There's no reason why something would work with $_GET['FNAME'] and not
with $_POST['FNAME'], so I can understand why you're confused. Are you
sure there are even any values in $_POST? Right at the beginning of
rtf.php, put a print_r($_POST) to see what the values are. If $_POST is
empty even when you put values in the form, then it must be an issue
with your web browser or server not allowing POST values (that would be
very odd, though).

::John,

Ok I tried the print_r($_POST) and received...

Array ( [FNAME] => test [LNAME] => t [ADDRESS] => t [CITY] => t [STATE] => t
[ZIP] => t [DATE] => t [PARAGRAPH1]=> t [PARAGRAPH2] => t [FROM] => t
[SUBMIT] => TEST ME )

So they array isn't empty for my post. Obviously the values don't matter for
this array, but the array is still not being brought into the str_replace
function.  Is it possible that str_replace requires "GET" opposed to "POST"
for it to work? This is becoming very odd! Possible bug? I hate throwing
that out there but it doesn't make sense why one would work and the other
wouldn't since all any of them are doing is holding "strings".  Any other
ideas?

Thanks,
Wolf

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



Re: [PHP] $_POST not working with str_replace

2004-03-23 Thread John W. Holmes
PHP Email List wrote:

Ok here's my problem, I'm in the midst of creating a string replace to work
on a rtf file that is on the server, this fuctionallity works perfect with
"GET" but not "POST", I guess I don't understand why.  
[snip]
$name = $_POST['FNAME'];
[snip]
$output = str_replace("<>",$name,$output);
There's no reason why something would work with $_GET['FNAME'] and not 
with $_POST['FNAME'], so I can understand why you're confused. Are you 
sure there are even any values in $_POST? Right at the beginning of 
rtf.php, put a print_r($_POST) to see what the values are. If $_POST is 
empty even when you put values in the form, then it must be an issue 
with your web browser or server not allowing POST values (that would be 
very odd, though).

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com

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