By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,614 Members | 1,680 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,614 IT Pros & Developers. It's quick & easy.

Cookie in IE7

P: n/a
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.
Oct 9 '08 #1
Share this Question
Share on Google+
12 Replies


P: n/a
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.
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/
Oct 9 '08 #2

P: n/a
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 <imgtag? That doesn't
make any sense.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Oct 9 '08 #3

P: n/a
On Oct 9, 10:25 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
Pankaj wrote:
<snip>
Why are you trying to read a cookie with an <imgtag? That doesn't
make any sense.
Possibly, he's spying his users (stats).

<OT>
How is life and economy going?
</OT>

--
<?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/
Oct 9 '08 #4

P: n/a
On Oct 9, 10:32 pm, "R. Rajesh Jeba Anbiah"
<ng4rrjanb...@rediffmail.comwrote:
On Oct 9, 10:25 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
Pankaj wrote:
<snip>
Why are you trying to read a cookie with an <imgtag? That doesn't
make any sense.

Possibly, he's spying his users (stats).

<OT>
How is life and economy going?
</OT>
Disregard OT, I thought I was replying to Geof

--
<?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/
Oct 9 '08 #5

P: n/a
Message-ID:
<aa**********************************@n33g2000pri. googlegroups.comfrom
R. Rajesh Jeba Anbiah contained the following:
><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
Oct 9 '08 #6

P: n/a
..oO(Jerry Stuckle)
>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*3 0),"/"); -------------
>>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 <imgtag? 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
Oct 9 '08 #7

P: n/a
On Oct 10, 1:16*am, Michael Fesser <neti...@gmx.dewrote:
.oO(Jerry Stuckle)
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 URLhttp://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 <imgtag? *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
Oct 10 '08 #8

P: n/a
Pankaj wrote:
On Oct 10, 1:16 am, Michael Fesser <neti...@gmx.dewrote:
>.oO(Jerry Stuckle)
>>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 URLhttp://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 <imgtag? 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.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Oct 10 '08 #9

P: n/a
Rajesh, the page is reloaded. I tried to read the cookie after the
user has filled up a two page form

R. Rajesh Jeba Anbiah wrote:
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.

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/
Oct 11 '08 #10

P: n/a
Yes they are on the same domain

Jerry Stuckle wrote:
Pankaj wrote:
On Oct 10, 1:16 am, Michael Fesser <neti...@gmx.dewrote:
.oO(Jerry Stuckle)

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 URLhttp://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 <imgtag? 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.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Oct 11 '08 #11

P: n/a
On Fri, 10 Oct 2008 18:32:46 -0700 (PDT), Pankaj <pa******@gmail.com>
wrote:
>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>
Oct 11 '08 #12

P: n/a
On Oct 11, 6:31 am, Pankaj <panah...@gmail.comwrote:
Rajesh, the page is reloaded. I tried to read the cookie after the
user has filled up a two page form
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/

--
<?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/
Oct 14 '08 #13

This discussion thread is closed

Replies have been disabled for this discussion.