472,984 Members | 2,125 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,984 software developers and data experts.

URGENT: cookies not working anymore!

hello, any idea why the following code does not work?!!

<?

$cookieExpire = 864000000;

setcookie("a", "love", $cookieExpire);
header("Set-Cookie: lc=50; expires=$cookieExpire");
header("Set-Cookie: id=test; expires=$cookieExpire");

while (list ($key, $val) = each ($_COOKIE)) {
echo "$key => $val<br />\n";
}

?>

Only the last cookie, "id=test" is set. Why?

Also, how should I delete all cookies set from my website in one command?

Thanks!!

Jul 16 '05 #1
1 5524
Why are you setting one cookie with setcookie() but setting the others
with header()? For testing reasons I presume. Get rid of the other
header() lines and just use setcookie().

Try setting $cookieExpire to time() + number of seconds (or decrease
$cookieExpire a bit - 86400 is 1 day so 864000000 is about 27 years...)

To delete a cookie, set it again (use setcookie()) with the value
parameter set to "" and everything else the same.

Use a browser such as Mozilla and set it to ask permission before a
cookie is set - you can see all the details of the cookie there, such as
the date it is due to expire. This makes it much easier to debug cookie
problems.

Hope this helps.

MK.

Craig Matthews wrote:
hello, any idea why the following code does not work?!!

<?

$cookieExpire = 864000000;

setcookie("a", "love", $cookieExpire);
header("Set-Cookie: lc=50; expires=$cookieExpire");
header("Set-Cookie: id=test; expires=$cookieExpire");

while (list ($key, $val) = each ($_COOKIE)) {
echo "$key => $val<br />\n";
}

?>

Only the last cookie, "id=test" is set. Why?

Also, how should I delete all cookies set from my website in one command?

Thanks!!


--
MeerKat

Jul 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Spidah | last post by:
I am working on a shopping cart for a client and have struck a weird problem. The client's ssl setup is on a different url to the main site. As a result we get two copies of our shopping cart...
1
by: Tony Archer | last post by:
(Forgive the dupicate post, I had left out the OS Version out of the prior post.) Gentlemen, your urgent help is needed in solving a STRANGE problem. I have two servers a dev box, and a...
6
by: Mark | last post by:
Hi... I've come across some weird bug with Response.Cookies. Or maybe it will be called "by design" but for the life of me I can't figure out what purpose it would serve. If you're setting a...
0
by: Amratash | last post by:
Hi, I needyour help.Its urgent. My main aim is to log the site activities in a database at runtime. I'm using W3C Extended Log File format for logging information. I can use ODBC Logging directly...
5
by: Martin Heuckeroth | last post by:
Hi We are working on a webservice application and are having some problems with the cookies and/or sessions. We have them working on our intranet but then its not working on the internet. We...
6
by: André | last post by:
Hi, Not sure it's a asp.net problem, but i discovered it with asp.net, so ... I need to pass data from page to another, so i use cookies for that. My problem is that when a certain amount of...
1
by: maheshv | last post by:
Hi all, Dear friends, i am facing a problem when using cookies i need help of yours... Lets come to the issue, i am using cookies all over the site, it is working all fine, the only problem is...
0
by: Chandu | last post by:
Urgent Openings for SE/SSE/TL in .Net for Bangalor Dear , Greetings from Job Cookies India Pvt Ltd., We have Urgent Openings for SE/SSE/TL in .Net for Bangalore Skills Required: 4+Yeard...
7
by: cmrchs | last post by:
Hi, In Windows Vista: where does asp.net write its cookies? I use HttpCookie objCookie = new HttpCookie("nameCookie"); in Win2000 (and later) they used to be in C:\Documents and...
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.