Re: [PHP] another easy cookie question - SOLVED

2001-09-21 Thread George Pitcher

Hi all,

I solved my Cookie problem by making it simple:

On cookietest.php I have:



and on cookietest.lasso I have

Display Cookie:
[Cookie:'Cookievalue']

and the cookie is displayed properly.

This will allow me to integrate Lasso and PHP together and be able to pass
data between them using cookies.

I am already using PHP to download PDF files in a Lasso solution.

If and when I become proficient, I'll rebuild my solution in php. It's using
a 12-db Filemaker system as the database and I don't really want to change
that as its just s easy for the clients to use.

Thanks for everyone's suggestions.

George, in Edinburgh



- Original Message -
From: "Richard Baskett" <[EMAIL PROTECTED]>
To: "PHP General" <[EMAIL PROTECTED]>
Sent: Friday, September 14, 2001 7:04 PM
Subject: Re: [PHP] another easy cookie question


> The way I see it is that your script never has a chance to set the cookie
> plus you can not send headers after html, one other thing is that you have
a
> ")" at the end of your setcookie function value so if you reformatted it
> this way:
>
>setcookie("Cookievalue", "abcdefghijklmnopqrstuvwxyz0123456789",
> time()+3600);
>   header("Location: index.php");
>   exit;
> ?>
>
> 
> 
> Untitled Document
> 
> 
>
> What that will do is as soon as it comes to the page it will set a cookie
> and then take you to index.php.  You do not need to use the full URL in
the
> Location.  Plus I have had nothing but trouble with the setcookie function
> so I just send the header setcookie instead, for example I use this code:
>
> header("Set-Cookie: $CookieName=$CookieValue; path=/;
expires=$expireDate");
>
> Make sure expire is in this format and it'll work on all browsers:
>
> $expireDate  = gmdate("l, d-M-");
> $expireDate .= gmdate("Y")+1;
> $expireDate .= gmdate(" H:i:s")." GMT";
>
> this sets the expiration date for one year.
>
> All in all your new code would look like:
>
>$expireDate  = gmdate("l, d-M-");
>   $expireDate .= gmdate("Y")+1;
>   $expireDate .= gmdate(" H:i:s")." GMT";
> header("Set-Cookie: $CookieName=$CookieValue; path=/;
expires=$expireDate");
> header("Location: index.php");
> exit;
> ?>
>
> 
> 
> Untitled Document
> 
> 
>
>
> > 
> > 
> >  > header("Location:index.php");
> > setcookie("Cookievalue", "abcdefghijklmnopqrstuvwxyz0123456789")
> > time()+3600);
> > ?>
> > Untitled Document
> > 
> > 
> >
> > I get the following error.
> >
> > CGI Error
> > The specified CGI application misbehaved by not returning a complete set
> of
> > HTTP headers.  The headers it did return are:
> >
> > ... and nothing else!
> >
> > Where am I going wrong? I bet it's a simple answer.
> >
> > George P in Edinburgh
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]


_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] another easy cookie question

2001-09-14 Thread Richard Baskett

The way I see it is that your script never has a chance to set the cookie
plus you can not send headers after html, one other thing is that you have a
")" at the end of your setcookie function value so if you reformatted it
this way:





Untitled Document



What that will do is as soon as it comes to the page it will set a cookie
and then take you to index.php.  You do not need to use the full URL in the
Location.  Plus I have had nothing but trouble with the setcookie function
so I just send the header setcookie instead, for example I use this code:

header("Set-Cookie: $CookieName=$CookieValue; path=/; expires=$expireDate");

Make sure expire is in this format and it'll work on all browsers:

$expireDate  = gmdate("l, d-M-");
$expireDate .= gmdate("Y")+1;
$expireDate .= gmdate(" H:i:s")." GMT";

this sets the expiration date for one year.

All in all your new code would look like:





Untitled Document




> 
> 
>  header("Location:index.php");
> setcookie("Cookievalue", "abcdefghijklmnopqrstuvwxyz0123456789")
> time()+3600);
> ?>
> Untitled Document
> 
> 
>
> I get the following error.
>
> CGI Error
> The specified CGI application misbehaved by not returning a complete set
of
> HTTP headers.  The headers it did return are:
>
> ... and nothing else!
>
> Where am I going wrong? I bet it's a simple answer.
>
> George P in Edinburgh


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] another easy cookie question

2001-09-14 Thread Chris Hobbs

George Pitcher wrote:


>  header("Location:index.php");
> setcookie("Cookievalue", "abcdefghijklmnopqrstuvwxyz0123456789",
> time()+3600);

A couple of things:

First, I believe Location: must have a space after it, as well as a 
fully qualified URL (ie. http://wherver.com/index.php).

Second, once you've sent the Location header to the browser, I would 
expect it to immediately request the new page, and therefore not get the 
cookie you send afterwards. Why not just set the cookie in index.php?

My $0.02...

-- 
___  ____    _
Chris Hobbs   / \ \/ / |  | |/ ___\|  __ \
Head Geek| (___  \ \  / /| |  | | (___ | |  | |
WebMaster \___ \  \ \/ / | |  | |\___ \| |  | |
PostMaster) |  \  /  | |__| |) | |__| |
   \/\/\/ \/|_/
   http://www.silvervalley.k12.ca.us
   [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] another easy cookie question

2001-09-14 Thread nate

If nothing but the header Location ran then it would send him to his page,
but its not even doing that. It's giving him an error before it does that.
He already mentioned he didn't have any html or anything before the headers.

- Original Message -
From: "Niklas Lampén" <[EMAIL PROTECTED]>
To: "Php-General" <[EMAIL PROTECTED]>
Sent: Friday, September 14, 2001 3:51 AM
Subject: RE: [PHP] another easy cookie question


> First of all, before header() or setcookie() can't be any outputing code
> (like html).
>
> And here if you do:
>
>  header("Location: index.php");
> setcookie(blah);
> 
>
> Nothing else but header() will be run, since it will move you to the
> index.php file.
>
>
> P.S. Notice the space: header("Location: index.php");
>
>
> Niklas
>
>
> -Original Message-
> From: George Pitcher [mailto:[EMAIL PROTECTED]]
> Sent: 14. syyskuuta 2001 12:47
> To: [EMAIL PROTECTED]
> Subject: [PHP] another easy cookie question
>
>
> Hi all,
>
> This is what I have at the top of my php page (php-4.0.6-winNT).
>
> 
> 
>  header("Location:index.php");
> setcookie("Cookievalue", "abcdefghijklmnopqrstuvwxyz0123456789")
> time()+3600);
> ?>
> Untitled Document
> 
> 
>
> I get the following error.
>
> CGI Error
> The specified CGI application misbehaved by not returning a complete set
of
> HTTP headers.  The headers it did return are:
>
> ... and nothing else!
>
> Where am I going wrong? I bet it's a simple answer.
>
> George P in Edinburgh
>
>
>
>
>  _ Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] another easy cookie question

2001-09-14 Thread Niklas Lampén

First of all, before header() or setcookie() can't be any outputing code
(like html).

And here if you do:

mailto:[EMAIL PROTECTED]]
Sent: 14. syyskuuta 2001 12:47
To: [EMAIL PROTECTED]
Subject: [PHP] another easy cookie question


Hi all,

This is what I have at the top of my php page (php-4.0.6-winNT).




Untitled Document



I get the following error.

CGI Error
The specified CGI application misbehaved by not returning a complete set of
HTTP headers.  The headers it did return are:

... and nothing else!

Where am I going wrong? I bet it's a simple answer.

George P in Edinburgh




 _ Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] another easy cookie question

2001-09-14 Thread George Pitcher

No, absolutely nothing.

George
- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, September 14, 2001 11:34 AM
Subject: Re: [PHP] another easy cookie question


> Do you have any white spaces or carriage returns before your headers? If
so
> get rid of them.
>
> - Original Message -
> From: "George Pitcher" <[EMAIL PROTECTED]>
> To: "Kelly Barrett" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
> Sent: Friday, September 14, 2001 3:21 AM
> Subject: Re: [PHP] another easy cookie question
>
>
> > Kelly,
> >
> > Thanks for the tip but having re-arranged my code I still get the same
> > message.
> >
> > New coding =
> >
> >  > header("Location:index.php");
> > setcookie("Cookievalue", "abcdefghijklmnopqrstuvwxyz0123456789",
> > time()+3600);
> > ?>
> > 
> > 
> > Untitled Document
> > 
> > 
> >
> >
> > Any suggestions?
> >
> > George
> >
> > - Original Message -
> > From: "Kelly Barrett" <[EMAIL PROTECTED]>
> > To: "George Pitcher" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> > Sent: Friday, September 14, 2001 11:31 AM
> > Subject: Re: [PHP] another easy cookie question
> >
> >
> > > Hi George,
> > > You must output all headers (including cookies) before you output any
> > > content.
> > >
> > > So, you just need to move your header and setcookie calls so they are
> > above
> > > the  and  tags.
> > >
> > > e.g.
> > >   > >  header("Location:index.php");
> > >  setcookie("Cookievalue", "abcdefghijklmnopqrstuvwxyz0123456789")
> > >  time()+3600);
> > >  ?>
> > >  
> > >  
> > >
> > >
> > > Cheers,
> > > Kelly.
> > >
> > > > Hi all,
> > > >
> > > > This is what I have at the top of my php page (php-4.0.6-winNT).
> > > >
> > > > 
> > > > 
> > > >  > > > header("Location:index.php");
> > > > setcookie("Cookievalue", "abcdefghijklmnopqrstuvwxyz0123456789")
> > > > time()+3600);
> > > > ?>
> > > > Untitled Document
> > > > 
> > > > 
> > > >
> > > > I get the following error.
> > > >
> > > > CGI Error
> > > > The specified CGI application misbehaved by not returning a complete
> set
> > > of
> > > > HTTP headers.  The headers it did return are:
> > > >
> > > > ... and nothing else!
> > > >
> > > > Where am I going wrong? I bet it's a simple answer.
> > > >
> > > > George P in Edinburgh
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > _
> > > > Do You Yahoo!?
> > > > Get your free @yahoo.com address at http://mail.yahoo.com
> > > >
> > > >
> > > > --
> > > > PHP General Mailing List (http://www.php.net/)
> > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > > To contact the list administrators, e-mail:
> [EMAIL PROTECTED]
> > > >
> > > >
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > To contact the list administrators, e-mail:
[EMAIL PROTECTED]
> >
> >
> > _
> > Do You Yahoo!?
> > Get your free @yahoo.com address at http://mail.yahoo.com
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]


_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] another easy cookie question

2001-09-14 Thread nate

Do you have any white spaces or carriage returns before your headers? If so
get rid of them.

- Original Message -
From: "George Pitcher" <[EMAIL PROTECTED]>
To: "Kelly Barrett" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Friday, September 14, 2001 3:21 AM
Subject: Re: [PHP] another easy cookie question


> Kelly,
>
> Thanks for the tip but having re-arranged my code I still get the same
> message.
>
> New coding =
>
>  header("Location:index.php");
> setcookie("Cookievalue", "abcdefghijklmnopqrstuvwxyz0123456789",
> time()+3600);
> ?>
> 
> 
> Untitled Document
> 
> 
>
>
> Any suggestions?
>
> George
>
> - Original Message -
> From: "Kelly Barrett" <[EMAIL PROTECTED]>
> To: "George Pitcher" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> Sent: Friday, September 14, 2001 11:31 AM
> Subject: Re: [PHP] another easy cookie question
>
>
> > Hi George,
> > You must output all headers (including cookies) before you output any
> > content.
> >
> > So, you just need to move your header and setcookie calls so they are
> above
> > the  and  tags.
> >
> > e.g.
> >   >  header("Location:index.php");
> >  setcookie("Cookievalue", "abcdefghijklmnopqrstuvwxyz0123456789")
> >  time()+3600);
> >  ?>
> >  
> >  
> >
> >
> > Cheers,
> > Kelly.
> >
> > > Hi all,
> > >
> > > This is what I have at the top of my php page (php-4.0.6-winNT).
> > >
> > > 
> > > 
> > >  > > header("Location:index.php");
> > > setcookie("Cookievalue", "abcdefghijklmnopqrstuvwxyz0123456789")
> > > time()+3600);
> > > ?>
> > > Untitled Document
> > > 
> > > 
> > >
> > > I get the following error.
> > >
> > > CGI Error
> > > The specified CGI application misbehaved by not returning a complete
set
> > of
> > > HTTP headers.  The headers it did return are:
> > >
> > > ... and nothing else!
> > >
> > > Where am I going wrong? I bet it's a simple answer.
> > >
> > > George P in Edinburgh
> > >
> > >
> > >
> > >
> > >
> > > _
> > > Do You Yahoo!?
> > > Get your free @yahoo.com address at http://mail.yahoo.com
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > To contact the list administrators, e-mail:
[EMAIL PROTECTED]
> > >
> > >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
> _
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] another easy cookie question

2001-09-14 Thread George Pitcher

Kelly,

Thanks for the tip but having re-arranged my code I still get the same
message.

New coding =




Untitled Document




Any suggestions?

George

- Original Message -
From: "Kelly Barrett" <[EMAIL PROTECTED]>
To: "George Pitcher" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Friday, September 14, 2001 11:31 AM
Subject: Re: [PHP] another easy cookie question


> Hi George,
> You must output all headers (including cookies) before you output any
> content.
>
> So, you just need to move your header and setcookie calls so they are
above
> the  and  tags.
>
> e.g.
>header("Location:index.php");
>  setcookie("Cookievalue", "abcdefghijklmnopqrstuvwxyz0123456789")
>  time()+3600);
>  ?>
>  
>  
>
>
> Cheers,
> Kelly.
>
> > Hi all,
> >
> > This is what I have at the top of my php page (php-4.0.6-winNT).
> >
> > 
> > 
> >  > header("Location:index.php");
> > setcookie("Cookievalue", "abcdefghijklmnopqrstuvwxyz0123456789")
> > time()+3600);
> > ?>
> > Untitled Document
> > 
> > 
> >
> > I get the following error.
> >
> > CGI Error
> > The specified CGI application misbehaved by not returning a complete set
> of
> > HTTP headers.  The headers it did return are:
> >
> > ... and nothing else!
> >
> > Where am I going wrong? I bet it's a simple answer.
> >
> > George P in Edinburgh
> >
> >
> >
> >
> >
> > _
> > Do You Yahoo!?
> > Get your free @yahoo.com address at http://mail.yahoo.com
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]


_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] another easy cookie question

2001-09-14 Thread Kelly Barrett

Hi George,
You must output all headers (including cookies) before you output any
content.

So, you just need to move your header and setcookie calls so they are above
the  and  tags.

e.g.
 
 
 


Cheers,
Kelly.

> Hi all,
>
> This is what I have at the top of my php page (php-4.0.6-winNT).
>
> 
> 
>  header("Location:index.php");
> setcookie("Cookievalue", "abcdefghijklmnopqrstuvwxyz0123456789")
> time()+3600);
> ?>
> Untitled Document
> 
> 
>
> I get the following error.
>
> CGI Error
> The specified CGI application misbehaved by not returning a complete set
of
> HTTP headers.  The headers it did return are:
>
> ... and nothing else!
>
> Where am I going wrong? I bet it's a simple answer.
>
> George P in Edinburgh
>
>
>
>
>
> _
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]