Re: SetCookie question
| From: | Hans H. Anderson | Date: | Fri, 01 Sep 2000 19:57:23 +0000 |
| Subject: | Re: SetCookie question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-14878@lists.php.net to get a copy of this message | ||
Jim,
It should work, just send it before sending any other information. Like,
if you are doing an imagecookie for tracking, you'd
1 fopen and read the gif or jpg
2 set a cookie
3 set content-type: image/gif
4 print fopened data (the image, even if a 1x1 pixel)
Cookie should be sent along with it. I've done this before, back before I
swore off cookies and back when I was using Cold Fusion (read: I've not
done it in PHP, but PHP is way better than CF, so it's most likely
doable).
Hans
On Fri, 1 Sep 2000, Jim Brown, Sr. wrote:
> Hello again,
>
> Question: If I call a '.php' script from within an HTML document (say, by <IMG
> SRC=...>) and the PHP script contains the function 'SetCookie();', will the
> cookie actually get set or is it disregarded because the call is not being set
> before the HTML header information???
>
> Ex:
>
> <html>
> <head>
> <title>Some Title</title>
> </head>
> <body>
> <p>
> <a href=".."><img src="something.php"></a>
> </body>
> </html>
>
> something.php: contains SetCookie(); function
>
>
> Will this fail to set the cookie info??
>
>
> TIA
> --
> James Brown, Sr.
> CIO | DNS/System/Network Administrator
> Sys-Admin@CSUinternet.net | CSU internet, inc. - Tifton, GA.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>
>
Hans Anderson ~ me@hansanderson.com
http://www.hansanderson.com | PHP, SQL Databases, Flash 5
Animation / Programming,
http://www.goofiness.com | Killer Audio Production, Search
Engines, Brewmeister.