php-general Digest 6 Oct 2005 21:41:39 -0000 Issue 3723

Topics (messages 223688 through 223714):

How do I POST data with headers & make the browser follow?
        223688 by: Ragnar
        223690 by: Brent Baisley
        223691 by: Petr Smith
        223695 by: Mark Rees

Re: Detect file size BEFORE upload it
        223689 by: Richard Davey
        223703 by: Ruben Rubio Rey
        223708 by: tg-php.gryffyndevelopment.com
        223712 by: Jasper Bryant-Greene
        223713 by: tg-php.gryffyndevelopment.com

Re: form not submitting when I change action from PHP_SELF to thanks page
        223692 by: Bruce Gilbert
        223694 by: tg-php.gryffyndevelopment.com
        223699 by: Bruce Gilbert
        223700 by: Robert Cummings
        223702 by: tg-php.gryffyndevelopment.com
        223705 by: Bruce Gilbert

Creator in the news
        223693 by: John Nichel

setcookie() is not my friend
        223696 by: Brian Dunning
        223697 by: Larry E. Ullman
        223698 by: John Nichel
        223701 by: Brian Dunning
        223706 by: Chris
        223707 by: tg-php.gryffyndevelopment.com
        223709 by: Brian Dunning
        223714 by: Richard Lynch

Re: PHP and XML
        223704 by: Rick Emery

SOAP problem, (related to gethostbyname?)
        223710 by: -k.

Re: [PHP-DB] Search & Replace within PHP
        223711 by: tg-php.gryffyndevelopment.com

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        php-general@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
Hi guys/girls,

I have to apologize if this issue has been discussed in detail before but I
couldn't find anything obvious so far.

What I need/want to do is to :

1. Take POST data from a form (no problem)
2. Do whatever i need to on the target page (no problem)
3. Pass some other data on to a 3rd page as a POST
   request.
4. Get the browser to follow to said 3rd page.


All this is happening via SSL.

So basically what i am trying to do is to "fake" whatever happens
at a normal POST request that is handled by the browser.

Now point 4. in my example above is giving me a massive headache,
I have managed to pass data on to the 3rd page as POST quite comfortably
using cURL but the browser doesn't follow (ie. the URL in the address bar
remains unchanged).

I did see that there is a FOLLOWLOCATION option you can set in cURL when you
do you request, and though "wicked, just what I needed" only to find out
that it's not working (probably because I understand what it does wrong).

Pretty pretty please if anyone knows a solution for the above, let me know. 

Oh, and I'd also like to add that the information I am trying to get to the
3rd page in the example is sensitive (Credit Card details etc.), so $_GET
and $_COOKIE are out of the question.

ANY help would be appreciated.

Kind regards,
Ben

-- 
5 GB Mailbox, 50 FreeSMS http://www.gmx.net/de/go/promail
+++ GMX - die erste Adresse für Mail, Message, More +++

--- End Message ---
--- Begin Message --- If the information is sensitive, why are you trying to fake a POST submission? A POST can be received from anywhere. SSL is just encrypting it, not verifying the client is the same. I would use session variables to store information you need to access from page to page. That way you can verify that you are talking to the same computer from the first two pages.


On Oct 6, 2005, at 5:52 AM, Ragnar wrote:


Hi guys/girls,

I have to apologize if this issue has been discussed in detail before but I
couldn't find anything obvious so far.

What I need/want to do is to :

1. Take POST data from a form (no problem)
2. Do whatever i need to on the target page (no problem)
3. Pass some other data on to a 3rd page as a POST
   request.
4. Get the browser to follow to said 3rd page.


All this is happening via SSL.

So basically what i am trying to do is to "fake" whatever happens
at a normal POST request that is handled by the browser.

Now point 4. in my example above is giving me a massive headache,
I have managed to pass data on to the 3rd page as POST quite comfortably using cURL but the browser doesn't follow (ie. the URL in the address bar
remains unchanged).

I did see that there is a FOLLOWLOCATION option you can set in cURL when you do you request, and though "wicked, just what I needed" only to find out that it's not working (probably because I understand what it does wrong).

Pretty pretty please if anyone knows a solution for the above, let me know.

Oh, and I'd also like to add that the information I am trying to get to the 3rd page in the example is sensitive (Credit Card details etc.), so $_GET
and $_COOKIE are out of the question.

ANY help would be appreciated.

Kind regards,
Ben

--
5 GB Mailbox, 50 FreeSMS http://www.gmx.net/de/go/promail
+++ GMX - die erste Adresse für Mail, Message, More +++

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

--- End Message ---
--- Begin Message ---
I have to apologize if this issue has been discussed in detail before but I
couldn't find anything obvious so far.

What I need/want to do is to :

1. Take POST data from a form (no problem)
2. Do whatever i need to on the target page (no problem)
3. Pass some other data on to a 3rd page as a POST
   request.
4. Get the browser to follow to said 3rd page.


All this is happening via SSL.

So basically what i am trying to do is to "fake" whatever happens
at a normal POST request that is handled by the browser.

Now point 4. in my example above is giving me a massive headache,
I have managed to pass data on to the 3rd page as POST quite comfortably
using cURL but the browser doesn't follow (ie. the URL in the address bar
remains unchanged).

I did see that there is a FOLLOWLOCATION option you can set in cURL when you
do you request, and though "wicked, just what I needed" only to find out
that it's not working (probably because I understand what it does wrong).

Pretty pretty please if anyone knows a solution for the above, let me know.
Oh, and I'd also like to add that the information I am trying to get to the
3rd page in the example is sensitive (Credit Card details etc.), so $_GET
and $_COOKIE are out of the question.

Hi,

it seems you have no understanding how http protocol works.. I can't learn you the whole thing, but I can give you some hints. Read something about HTTP (http://www.digital-web.com/articles/powering_the_web_with_http/), install some network sniffer (ethereal, HttpWatch for IE - great tool for beginners) and see what happens.

- you cannot force browser to POST something somewhere with PHP. You have to realize, that PHP is running on server, but the browser is the client. - you cannot use curl to do it. With curl it all happens on the server. If you want to use curl, you have to use same technique used by "web based anonymous proxy". Return all loaded data to client, rewrite urls to your script, handle everything correctly until client closes browser. Very complex stuff - followlocation has nothing to do with browser. it only says to curl to evaluate Location header and do auto-redirection
- sensitive information? GET, POST, COOKIE, everything could be intercepted
- your only help is javascript. You can generate something like this to client browser with php. But you couldn't hide sensitive information this way.
<body onload="document.forms.myform.submit()">
<form name="myform" method="post">
        <input type="hidden" name="..." value="...">
</form>
- think about your problem and possible solutions again

Petr

--- End Message ---
--- Begin Message ---
>
> 1. Take POST data from a form (no problem)
> 2. Do whatever i need to on the target page (no problem)
> 3. Pass some other data on to a 3rd page as a POST
>    request.
> 4. Get the browser to follow to said 3rd page.
>
>
> All this is happening via SSL.

What the other people said about HTTP. It's time to look at this from
another angle. Why do you need to process this data twice? What are you
trying to do?

Are you, perhaps, trying to make an online payment where you store the data
locally (page 2), then perform some kind of credit check (page 3)?

If so, would something like the following work?

Page 1 -> form post to page 2
Page 2: process form inputs, write to DB or whatever, communicate with page
3 as necessary (possibly using curl) and finally send a redirection header
to the browser sending it to a success/failure page based on what page 3
told you

--- End Message ---
--- Begin Message ---
Hi Ruben,

Thursday, October 6, 2005, 7:38:35 AM, you wrote:

> The problem is that I was able to detect file size after complete
> file is transfered.

> I need to detect file size before all file is transfered, in order
> to cancel it and preserve server resources.

> Any ideas?

The only way to do it would be to write your own client uploading
application in the likes of Java or ActiveX.

Anything client side is always going to fail because it doesn't know
about the size of the file until it has it, by which point it's too
late.

Cheers,

Rich
-- 
Zend Certified Engineer
http://www.launchcode.co.uk

--- End Message ---
--- Begin Message ---
:) U have it. Its perferct. Im gonna check it, but seems to be the solution.

Raditha Dissanayake wrote:

While you are at SF checkout Mega Upload.


Ruben Rubio Rey wrote:


Anyway, if I would use any applet I ll use one of sourceforge.net. Its free and I can modify source, so I can personalize it...

But thanks by the idea! :)


Raditha Dissanayake wrote:

Hello Ruben,
Ruben Rubio Rey wrote:

Raditha Dissanayake wrote:

Shameless plug:
you need a java upload applet such as Rad Upload (http://www.radinks.com/upload/)
Ruben wrote:

Thats actually good idea, but I would not want to use Flash or Java applets.




I respect your opinion. If you ever change your mind please do consider Rad Upload it's being used by quite a few image hosting companies.
thanks and best regards
raditha


Hi,

I have been trying _several_ ways to control the size of the files that can be uploaded in a form.

The problem is that I was able to detect file size after complete file is transfered.







I need to detect file size before all file is transfered, in order to cancel it and preserve server resources.

Any ideas?

Thanks in advance
Ruben Rubio Rey













--- End Message ---
--- Begin Message ---
I know that part of the POST transaction with the client and web server 
involves sending the 'content-length'..  there's no way to tap into that before 
the file's uploaded though I guess.
(example of how to manually POST using Python at leastfound here: 
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/146306)


Failing that.. I think someone had mentioned Java, but here's a quick and dirty 
way to do it in Javascript (found on: 
https://lists.latech.edu/pipermail/javascript/2003-April/005190.html)


var myFile = new File("c:\temp\myfile.txt");
myFile.open("r");
alert('myFile length: ' + myFile.getLength());


Havn't tested it, but I'd rather use a tiny Javascript than a Java applet.


My apologies if I missed something in the thread, I kind of speed read through 
it and wasn't going to respond, but it was nagging at the back of my brain so I 
had to do a quick search or two.. hah

-TG

= = = Original message = = =

Hi,

I have been trying _several_ ways to control the size of the files that 
can be uploaded in a form.

The problem is that I was able to detect file size after complete file 
is transfered.

I need to detect file size before all file is transfered, in order to 
cancel it and preserve server resources.

Any ideas?

Thanks in advance
Ruben Rubio Rey


___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

--- End Message ---
--- Begin Message ---
[EMAIL PROTECTED] wrote:
var myFile = new File("c:\temp\myfile.txt");
myFile.open("r");
alert('myFile length: ' + myFile.getLength());

Somehow I don't think any browser is going to give JS access to arbitrary files on the user's system like that.

--
Jasper Bryant-Greene
Freelance web developer
http://jasper.bryant-greene.name/

--- End Message ---
--- Begin Message ---
Yeah, you're right.  I didn't test that before I posted it.

Looks like you can do it as long as your clients are running Windows and you 
can use Active X or another Windows trick using something like JScript, but 
with pure Javascript it looks bleak.

I tried to use something like this:
img = New Image();
img.src = "somefile.ext"; // NOT an image file
alert(img.fileSize);

But found out that this is an IE-only trick as well. Nobody else seems to 
support the filesize property on image objects.   Funny thing is, even in IE it 
didn't work.  Even when I actually used an image for the file name.

Oh well..  guess that Java applet might be the best way then, to keep it cross 
platform and all that.

-Tg

= = = Original message = = =

[EMAIL PROTECTED] wrote:
> var myFile = new File("c:\temp\myfile.txt");
> myFile.open("r");
> alert('myFile length: ' + myFile.getLength());

Somehow I don't think any browser is going to give JS access to 
arbitrary files on the user's system like that.

-- 
Jasper Bryant-Greene
Freelance web developer
http://jasper.bryant-greene.name/


___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

--- End Message ---
--- Begin Message ---
when I add that code I can the following error msg when submitting the form.
 " *Warning*: Cannot modify header information - headers already sent by
(output started at /home/webadmin/dedicated75.virtual.vps-
host.net/html/fortuneInteractive/Consultation_test.php:6<http://host.net/html/fortuneInteractive/Consultation_test.php:6>)
in */home/webadmin/dedicated75.virtual.vps-
host.net/html/fortuneInteractive/Consultation_test.php<http://host.net/html/fortuneInteractive/Consultation_test.php>
* on line *168* "
 line 168 is the one with header( 'Location: thanks.php' );
on it.
 can anyone explain why this is happening and how to rectify?
 TIA

 On 10/5/05, Robert Cummings <[EMAIL PROTECTED]> wrote:
>
> On Wed, 2005-10-05 at 21:15, Bruce Gilbert wrote:
> > thanks for the reply.
> >
> > and where on the page would that need to go? Within the head tags?
> > and would it need to be within <?php ?>
>
> Right after this line:
>
> mail ($to, $subject, $msg, $mailheaders);
>
> And you will already be within PHP interpretation.
>
> Cheers,
> Rob.
> --
> .------------------------------------------------------------.
> | InterJinn Application Framework - http://www.interjinn.com |
> :------------------------------------------------------------:
> | An application and templating framework for PHP. Boasting |
> | a powerful, scalable system for accessing system services |
> | such as forms, properties, sessions, and caches. InterJinn |
> | also provides an extremely flexible architecture for |
> | creating re-usable components quickly and easily. |
> `------------------------------------------------------------'
>
>


--
::Bruce::

--- End Message ---
--- Begin Message ---
Check to make sure absolutely nothing before the header() function is outputing 
anything.  No echos, no prints, no var_dumps, no HTML or even blank lines.

If it's something tangible like an echo or print or something, then putting an 
exit()/die() function right before the header() function then looking at the 
HTML source that you get should show you what the offending output is.

But again, if I recall, it can be something as simple as an empty line.

-----------------------------------------
<?php

// This should work because there's no output or white space above header()
header('Location: thanks.php');

?>
-----------------------------------------

-----------------------------------------

<?php

// This should fail (if I recall) because of the blank line that's sent
// before the PHP code block. This is considered output, and can't come before
// any header statements

header('Location: thanks.php');

?>
-----------------------------------------


= = = Original message = = =

when I add that code I can the following error msg when submitting the form.
 " *Warning*: Cannot modify header information - headers already sent by
(output started at /home/webadmin/dedicated75.virtual.vps-
host.net/html/fortuneInteractive/Consultation_test.php:6<http://host.net/html/fortuneInteractive/Consultation_test.php:6>)
in */home/webadmin/dedicated75.virtual.vps-
host.net/html/fortuneInteractive/Consultation_test.php<http://host.net/html/fortuneInteractive/Consultation_test.php>
* on line *168* "
 line 168 is the one with header( 'Location: thanks.php' );
on it.
 can anyone explain why this is happening and how to rectify?
 TIA

 On 10/5/05, Robert Cummings <[EMAIL PROTECTED]> wrote:
>
> On Wed, 2005-10-05 at 21:15, Bruce Gilbert wrote:
> > thanks for the reply.
> >
> > and where on the page would that need to go? Within the head tags?
> > and would it need to be within <?php ?>
>
> Right after this line:
>
> mail ($to, $subject, $msg, $mailheaders);
>
> And you will already be within PHP interpretation.
>
> Cheers,
> Rob.
> --
> .------------------------------------------------------------.
> | InterJinn Application Framework - http://www.interjinn.com |
> :------------------------------------------------------------:
> | An application and templating framework for PHP. Boasting |
> | a powerful, scalable system for accessing system services |
> | such as forms, properties, sessions, and caches. InterJinn |
> | also provides an extremely flexible architecture for |
> | creating re-usable components quickly and easily. |
> `------------------------------------------------------------'
>
>


--
::Bruce::


___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

--- End Message ---
--- Begin Message ---
I checked and no white space involved. What would I need to put tin the
exit()/die() function?

On 10/6/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]>
wrote:
>
> Check to make sure absolutely nothing before the header() function is
> outputing anything. No echos, no prints, no var_dumps, no HTML or even blank
> lines.
>
> If it's something tangible like an echo or print or something, then
> putting an exit()/die() function right before the header() function then
> looking at the HTML source that you get should show you what the offending
> output is.
>
> But again, if I recall, it can be something as simple as an empty line.
>
> -----------------------------------------
> <?php
>
> // This should work because there's no output or white space above
> header()
> header('Location: thanks.php');
>
> ?>
> -----------------------------------------
>
> -----------------------------------------
>
> <?php
>
> // This should fail (if I recall) because of the blank line that's sent
> // before the PHP code block. This is considered output, and can't come
> before
> // any header statements
>
> header('Location: thanks.php');
>
> ?>
> -----------------------------------------
>
>
> = = = Original message = = =
>
> when I add that code I can the following error msg when submitting the
> form.
> " *Warning*: Cannot modify header information - headers already sent by
> (output started at /home/webadmin/dedicated75.virtual.vps-
> host.net/html/fortuneInteractive/Consultation_test.php:6<http://host.net/html/fortuneInteractive/Consultation_test.php:6>
> <http://host.net/html/fortuneInteractive/Consultation_test.php:6>)
> in */home/webadmin/dedicated75.virtual.vps-
> host.net/html/fortuneInteractive/Consultation_test.php<http://host.net/html/fortuneInteractive/Consultation_test.php>
> <http://host.net/html/fortuneInteractive/Consultation_test.php>
> * on line *168* "
> line 168 is the one with header( 'Location: thanks.php' );
> on it.
> can anyone explain why this is happening and how to rectify?
> TIA
>
> On 10/5/05, Robert Cummings <[EMAIL PROTECTED]> wrote:
> >
> > On Wed, 2005-10-05 at 21:15, Bruce Gilbert wrote:
> > > thanks for the reply.
> > >
> > > and where on the page would that need to go? Within the head tags?
> > > and would it need to be within <?php ?>
> >
> > Right after this line:
> >
> > mail ($to, $subject, $msg, $mailheaders);
> >
> > And you will already be within PHP interpretation.
> >
> > Cheers,
> > Rob.
> > --
> > .------------------------------------------------------------.
> > | InterJinn Application Framework - http://www.interjinn.com |
> > :------------------------------------------------------------:
> > | An application and templating framework for PHP. Boasting |
> > | a powerful, scalable system for accessing system services |
> > | such as forms, properties, sessions, and caches. InterJinn |
> > | also provides an extremely flexible architecture for |
> > | creating re-usable components quickly and easily. |
> > `------------------------------------------------------------'
> >
> >
>
>
> --
> ::Bruce::
>
>
> ___________________________________________________________
> Sent by ePrompter, the premier email notification software.
> Free download at http://www.ePrompter.com.
>
>


--
::Bruce::

--- End Message ---
--- Begin Message ---
Here's the simple solution (put it at the top of your script:

    ob_start();

Cheers,
Rob.

On Thu, 2005-10-06 at 10:30, Bruce Gilbert wrote:
> I checked and no white space involved. What would I need to put tin the
> exit()/die() function?
> 
> On 10/6/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]>
> wrote:
> >
> > Check to make sure absolutely nothing before the header() function is
> > outputing anything. No echos, no prints, no var_dumps, no HTML or even blank
> > lines.
> >
> > If it's something tangible like an echo or print or something, then
> > putting an exit()/die() function right before the header() function then
> > looking at the HTML source that you get should show you what the offending
> > output is.
> >
> > But again, if I recall, it can be something as simple as an empty line.
> >
> > -----------------------------------------
> > <?php
> >
> > // This should work because there's no output or white space above
> > header()
> > header('Location: thanks.php');
> >
> > ?>
> > -----------------------------------------
> >
> > -----------------------------------------
> >
> > <?php
> >
> > // This should fail (if I recall) because of the blank line that's sent
> > // before the PHP code block. This is considered output, and can't come
> > before
> > // any header statements
> >
> > header('Location: thanks.php');
> >
> > ?>
> > -----------------------------------------
> >
> >
> > = = = Original message = = =
> >
> > when I add that code I can the following error msg when submitting the
> > form.
> > " *Warning*: Cannot modify header information - headers already sent by
> > (output started at /home/webadmin/dedicated75.virtual.vps-
> > host.net/html/fortuneInteractive/Consultation_test.php:6<http://host.net/html/fortuneInteractive/Consultation_test.php:6>
> > <http://host.net/html/fortuneInteractive/Consultation_test.php:6>)
> > in */home/webadmin/dedicated75.virtual.vps-
> > host.net/html/fortuneInteractive/Consultation_test.php<http://host.net/html/fortuneInteractive/Consultation_test.php>
> > <http://host.net/html/fortuneInteractive/Consultation_test.php>
> > * on line *168* "
> > line 168 is the one with header( 'Location: thanks.php' );
> > on it.
> > can anyone explain why this is happening and how to rectify?
> > TIA
> >
> > On 10/5/05, Robert Cummings <[EMAIL PROTECTED]> wrote:
> > >
> > > On Wed, 2005-10-05 at 21:15, Bruce Gilbert wrote:
> > > > thanks for the reply.
> > > >
> > > > and where on the page would that need to go? Within the head tags?
> > > > and would it need to be within <?php ?>
> > >
> > > Right after this line:
> > >
> > > mail ($to, $subject, $msg, $mailheaders);
> > >
> > > And you will already be within PHP interpretation.
> > >
> > > Cheers,
> > > Rob.
> > > --
> > > .------------------------------------------------------------.
> > > | InterJinn Application Framework - http://www.interjinn.com |
> > > :------------------------------------------------------------:
> > > | An application and templating framework for PHP. Boasting |
> > > | a powerful, scalable system for accessing system services |
> > > | such as forms, properties, sessions, and caches. InterJinn |
> > > | also provides an extremely flexible architecture for |
> > > | creating re-usable components quickly and easily. |
> > > `------------------------------------------------------------'
> > >
> > >
> >
> >
> > --
> > ::Bruce::
> >
> >
> > ___________________________________________________________
> > Sent by ePrompter, the premier email notification software.
> > Free download at http://www.ePrompter.com.
> >
> >
> 
> 
> --
> ::Bruce::
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

--- End Message ---
--- Begin Message ---
You don't have to put anything specific, it just stops the script from 
executing.

You can optionally put text in there.  I like using die() for some reason 
(shorter? more.. err.. aggressive? hah)  so I'll using commands like:

die("Made it to this point...");

I might use this to see if I got to a certain conditional or not..

Anyway, if you're getting that error, then there's definitely something being 
sent before the header() is executed.

Check any require() or include() files, check all the code above your header() 
statement.  So far I've never seen or heard of any bugs with header() where 
it'd mysteriously bomb out in this manner, it's always been something output 
and it's always been something people kick themselves for not seeing before. hah

Keep looking, you'll find it.

-TG

= = = Original message = = =

I checked and no white space involved. What would I need to put tin the
exit()/die() function?

--
::Bruce::


___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

--- End Message ---
--- Begin Message ---
when I put the die statment in and test the form I get, the html prior to
the form and what I put in my die statement eg:"made it to this point". The
form submits and I get the info, but I am not redirected to the Thanks page.

 My question is how do I determine from this what is causing my error?

 On 10/6/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]>
wrote:
>
> You don't have to put anything specific, it just stops the script from
> executing.
>
> You can optionally put text in there. I like using die() for some reason
> (shorter? more.. err.. aggressive? hah) so I'll using commands like:
>
> die("Made it to this point...");
>
> I might use this to see if I got to a certain conditional or not..
>
> Anyway, if you're getting that error, then there's definitely something
> being sent before the header() is executed.
>
> Check any require() or include() files, check all the code above your
> header() statement. So far I've never seen or heard of any bugs with
> header() where it'd mysteriously bomb out in this manner, it's always been
> something output and it's always been something people kick themselves for
> not seeing before. hah
>
> Keep looking, you'll find it.
>
> -TG
>
> = = = Original message = = =
>
> I checked and no white space involved. What would I need to put tin the
> exit()/die() function?
>
> --
> ::Bruce::
>
>
> ___________________________________________________________
> Sent by ePrompter, the premier email notification software.
> Free download at http://www.ePrompter.com.
>
>


--
::Bruce::

--- End Message ---
--- Begin Message ---
http://news.yahoo.com/s/pcworld/20051006/tc_pcworld/122874

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message --- I'm trying to setcookie('username',$username,15552000) but on subsequent pages $_COOKIE('username') is always null.

I verified that I'm setting it before any other output is sent to the browser. I verified that $username does have some valid contents. I also verified that the browsers I'm testing are set to allow all cookies. I do have a $username and a $_SESSION['username'] that contain the same data.

I'm all out of ideas for where to look further to debug this - any suggestions?
--- End Message ---
--- Begin Message ---
I'm trying to setcookie('username',$username,15552000) but on subsequent pages $_COOKIE('username') is always null.

I verified that I'm setting it before any other output is sent to the browser. I verified that $username does have some valid contents. I also verified that the browsers I'm testing are set to allow all cookies. I do have a $username and a $_SESSION ['username'] that contain the same data.

Well, the stupid/obvious question is: are you checking $_COOKIE ('username') like you posted or $_COOKIE['username'], which is syntactically correct?

Secondarily, have you set your browser to prompt you when a cookie is sent and, if so, what happens?

Larry

--- End Message ---
--- Begin Message ---
Brian Dunning wrote:
I'm trying to setcookie('username',$username,15552000) but on subsequent pages $_COOKIE('username') is always null.
<snip>

Is that just a typo?  It should be $_COOKIE['username']

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
On Oct 6, 2005, at 7:28 AM, John Nichel wrote:

Is that just a typo?  It should be $_COOKIE['username']

Oops, yes, that was my typo in the email - it is correctly $_COOKIE ['username'] in the code. Thanks.
--- End Message ---
--- Begin Message --- Unless I'm mistaken, you appear to be setting the Expiration date of the cookie to "Mon, 29 Jun 1970 17:00:00 -0700".

Which would cause the cookie to be unset, if it were already set, and do nothing otherwise.

Chris

Brian Dunning wrote:

I'm trying to setcookie('username',$username,15552000) but on subsequent pages $_COOKIE('username') is always null.

I verified that I'm setting it before any other output is sent to the browser. I verified that $username does have some valid contents. I also verified that the browsers I'm testing are set to allow all cookies. I do have a $username and a $_SESSION['username'] that contain the same data.

I'm all out of ideas for where to look further to debug this - any suggestions?


--- End Message ---
--- Begin Message ---
Good catch, Chris.  I was wondering about that myself but hadn't taken the time 
to see if setcookie() used regular serial time or if cookies had another time 
standard.

echo date("m/d/Y h:i:s", 15552000);

06/29/1970 08:00:00

That's what I get.

-TG

= = = Original message = = =

Unless I'm mistaken, you appear to be setting the Expiration date of the 
cookie to "Mon, 29 Jun 1970 17:00:00 -0700".

Which would cause the cookie to be unset, if it were already set, and do 
nothing otherwise.

Chris

Brian Dunning wrote:

> I'm trying to setcookie('username',$username,15552000) but on  
> subsequent pages $_COOKIE('username') is always null.
>
> I verified that I'm setting it before any other output is sent to the  
> browser. I verified that $username does have some valid contents. I  
> also verified that the browsers I'm testing are set to allow all  
> cookies. I do have a $username and a $_SESSION['username'] that  
> contain the same data.
>
> I'm all out of ideas for where to look further to debug this - any  
> suggestions?
>


___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

--- End Message ---
--- Begin Message --- D'Oh! You guys are absolutely right. I was trying to go for 6 months, which works now if I say time()+15552000 instead of 15552000. And the documentation shows that exactly - apparently I read right over it, even though I studied it minutely before posting.

Oh well...my wife would have the same complaint about me when I can't find the can opener when it's sitting in plain view.

:)

--- End Message ---
--- Begin Message ---
On Thu, October 6, 2005 9:11 am, Brian Dunning wrote:
> I'm trying to setcookie('username',$username,15552000) but on
> subsequent pages $_COOKIE('username') is always null.
>
> I verified that I'm setting it before any other output is sent to the
> browser. I verified that $username does have some valid contents. I
> also verified that the browsers I'm testing are set to allow all
> cookies. I do have a $username and a $_SESSION['username'] that
> contain the same data.
>
> I'm all out of ideas for where to look further to debug this - any
> suggestions?

Some Ideas:

Internet Explorer, and those that mimic its broken behaviour, require
BOTH a time AND a directory (use '/') if you are going to provide a
time.

Is 15552000 sufficiently in the future to be valid? Use time() +
(60*60*24) to be SURE.

Or avoid both these issues, and leave out the time argument for now,
making it a "session" cookie, only valid as long as the browser stays
open.

DEFINITELY configure your browser to let you confirm cookies before
accepting them, so you'll know what the cookie is getting sent.

Windows XP with Service Pack 2 has made a nightmare out of cookies, by
default no longer accepting them -- And I THINK this changes based on
your adding that new goofy compact privacy policy header Microsoft
made up.

It's gotten to the point where I just don't care if IE works or not
for the parts of some of my sites that require member login from
people who need access, and I don't really care if I lose visitors or
not in that particular area.  I just tell the users to switch
browsers, or live without the access they want.  Works so far -- they
just switch to a better browser.

-- 
Like Music?
http://l-i-e.com/artists.htm

--- End Message ---
--- Begin Message ---
Quoting Robbert van Andel <[EMAIL PROTECTED]>:

Thanks, I'm investigating XSL and it looks pretty good.  We use an RPM based
installation of PHP version 5.0.4.  I see on PHP.net's website that XSL
comes standard with PHP 5 and you need to enable it by adding the argument
--with-xsl to the configure line.  How do I do this when we did not build
PHP from source?  Is there another way to get XSL activated?

Thanks for your help
Robbert

You don't mention which distro you're using, but Fedora Core 4 has a php-xml rpm to "...add support to PHP for manipulating XML documents using the DOM tree, and performing XSL transformations on XML documents."

Hope this helps,
Rick
--
Rick Emery

"When once you have tasted flight, you will forever walk the Earth
with your eyes turned skyward, for there you have been, and there
you will always long to return"
                                             -- Leonardo Da Vinci

--- End Message ---
--- Begin Message ---
I'm using the PEAR Soap package and having problem accessing another sites's 
webservices. When i
do something like this:

<?PHP

$wsdl_url = 'some_wsdl.xml';
$WSDL     = new SOAP_WSDL($wsdl_url); 
$client   = $WSDL->getProxy(); 

$web_service_result = $client -> 
some_web_service($param1,$param2,$param3,$param4);

?>

$web_service_result returns the soap_fault Object. The message portion contains 
the line
"curl_exec error 6 Couldn't resolve host 'secure.example.com' " Also if i try 
to grab the WSDL
file from the remote server the script doesn't seem to grab the WSDL ( i get a 
bunch of "Passed
variable is not an array or object" errors ). I think the problem is curl can't 
resolve the
hostname. 

Also if i run
<?PHP
echo gethostbyname('http://bugs.php.net');
?>

It echos "http://bugs.php.net";, no good.

When i try something like 
<?PHP
$url = 'https://secure.example.com/index.html';
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER,TRUE);
$result = curl_exec($ch);

$cur_error = curl_error($ch);
curl_close($ch);   
        
echo $result;
echo "<BR> Error: ".$cur_error;
?>

It doesn't echo out anything, however if run "curl 
https://secure.example.com/index.html"; from the
command line i get back the page found at that address.

I'm running PHP Version 4.3.4 with CURL support enabled (CURL Information:  
libcurl 7.9.8 (OpenSSL
0.9.7c) (ipv6 enabled) ) on Red Had.

If i ping 'secure.example.com' the address resolves properly.

Any tips on things to try? Should i reinstall curl? SSL? Anything else i should 
investigate?




-k.


                
__________________________________ 
Yahoo! Mail - PC Magazine Editors' Choice 2005 
http://mail.yahoo.com

--- End Message ---
--- Begin Message ---
str_replace() is the first thing that comes to mind.  From the manual:

// Provides: <body text='black'>
$bodytag = str_replace("%body%", "black", "<body text='%body%'>");


Using %keyword% and is kind of a template style method, but has worked out well 
for me (and I assume others) so try something along those lines.

You can also use arrays with str_replace to indicate a list of things that need 
replacing:

$template = "Please forward this to %NAME% at %ADDRESS%.  Call them at %PHONE% 
if there's a problem";
$tags = array("%NAME%", "%ADDRESS%", "%PHONE%");

$userinfoQY = "select Name, Address, Phone from users";
$userinfoRS = mysql_query($userinfoQY);
while($userinfoRW = mysql_fetch_assoc($userinfoRS)){
  $userinfo = array($userinfoRW['Name'], $userinfoRW['Address'], 
$userinfoRW['Phone']);

  echo str_replace($tags, $userinfo, $templte);
}


Is that the answer you were looking for?

-TG

= = = Original message = = =

Is there a search & replace PHP command?

An example I am needing this for would be:

My name is replace_with_real_name

I want to retrieve replace_with_real_name from a mySQL database and put in
the name ... the key is that I want to put the person's name in various
position ... so I want to search for something like "replace_with_real_name"
and be able to put it anywhere in the sentence.

Ron



___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

--- End Message ---

Reply via email to