I am using the following lines of code
to set the cookie
setcookie("TestCookie",$userid,time()+(60*60*24*30),"/"); -------------
> Sets the cookie
to read the cookie
$MyUserId = $_COOKIE['TestCookie']; -------------------------> Sets
the variable $MyUserId if I try to access the file containg this code
in browser. However, this code does not work if I include the file
containing this code.
When setting the cookie from server, it would require that you
reload the page. http://in2.php.net/setcookie
--
<?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/
Why are you trying to read a cookie with an <img> tag? That doesn't
make any sense.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstu...@attglobal.net
==================
Possibly, he's spying his users (stats).
<OT>
How is life and economy going?
</OT>
Disregard OT, I thought I was replying to Geof
>> <OT>
>> How is life and economy going?
>> </OT>
>
> Disregard OT, I thought I was replying to Geof
:-)
Mail me and we can catch up (use the address in the sig), Haven't seen
you post for ages..
--
Geoff Berrow 0110001001101100010000000110
001101101011011001000110111101100111001011
100110001101101111001011100111010101101011
http://slipperyhill.co.uk - http://4theweb.co.uk
>Pankaj wrote:
>> I have st a cookie that would last for 30 days. If I put a line <img
>> src="http://www.example.com/readcookie.php" width="1" height="1"> in a
>> php file, I cannot read the cookie if I use IE7. However, it works in
>> Firefox and Chrome. If I try to access the URL http://www.example.com/readcookie.php
>> in IE7, I am able to read the cookie then.
>>
>> I am using the following lines of code
>>
>> to set the cookie
>>
>> setcookie("TestCookie",$userid,time()+(60*60*24*30),"/"); -------------
>>> Sets the cookie
>>
>> to read the cookie
>>
>> $MyUserId = $_COOKIE['TestCookie']; -------------------------> Sets
>> the variable $MyUserId if I try to access the file containg this code
>> in browser. However, this code does not work if I include the file
>> containing this code.
>>
>>
>>
>
>Why are you trying to read a cookie with an <img> tag? That doesn't
>make any sense.
It does. An HTTP request is an HTTP request, it doesn't matter if the
return is an HTML page or an image. If for example there's an image-
generating script, there might also be the need for reading some cookie
value, maybe the preferred image size or something like that.
In my own case some images can be delivered by a script from a protected
directory. Authentication is handled with a cookie-based session, so the
request for such an image _must_ contain the session cookie or the image
won't be delivered, because the authentication fails.
Micha
I am tracking how many users from my site visited one of my partner
site and signed up there. AFAIK, I do not have another way of finding
this out. I do not think it is an issue with authentication because
the code works if the user agent is firefox/ opera/ chrome.
Pankaj
Are both of these sites in the same domain?
This type of failure is usually caused by a higher security setting in
IE than the others.
>Yes they are on the same domain
and subdomain (i.e. both have "www")?
--
Free personal divertable Phone number: <http://www.bizorg.co.uk/personalnos.htm>
Check the status bar--if it's been denied by the policy settings.
Probably your domain name or cookie name might be a trouble. Also, try
setting P3P policy header http://www.sitepoint.com/print/p3p-cookies-ie6/