[PHP] cannot remove cookies

2005-02-22 Thread Bruno Santos
Hello.
I'm using 2 cookies to control some user environmente.
every time the user logs in, the cookie is set, but when i try to change 
the value of that cookie,
deleting it firts and then setting a new one with another value, when i 
print the value of that cookie
the value is never the new one, but always the firts.

im setting the cookie with:
setcookie (cookie_name,cookie_value,time()+time-to-expiration);
when deleting it, i do
setcookie (cookie_name);
or
setcookie (cookie_name,,time()-time-to-expiration);
but it never works
the browser im testing it is firefox (linux)
but in IE is not working either...
PHP version is PHP-5.0.3
Apache version is Apache-2.0.52
Cheers
Bruno Santos
--
Say no to software patents
www.nosoftwarepatents.com/
--
[EMAIL PROTECTED]
--
Divisao de Informatica
[EMAIL PROTECTED]
Tel: +351 272 000 155
Fax: +351 272 000 257
--
Hospital Amato Lusitano
[EMAIL PROTECTED]
Tel: +351 272 000 272
Fax: +351 272 000 257
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] cannot remove cookies

2005-02-22 Thread Richard Lynch
Bruno Santos wrote:
 I'm using 2 cookies to control some user environmente.
 every time the user logs in, the cookie is set, but when i try to change
 the value of that cookie,
 deleting it firts and then setting a new one with another value, when i
 print the value of that cookie
 the value is never the new one, but always the firts.

Keep in mind the interaction here:

PHP sends cookie to browser in HTTP interaction 1.
Browser returns cookie to PHP in the *next* HTTP request. (#2)

So the play is going like this:

Act I, Scene 1.
setcookie sends cookie to browser.
Act I, Scene 2.
browser sends cookie to PHP
PHP sends new value to browser.
You check the value of the cookie, and it's still the old value
[You have not yet gone beyond this step, but you should]
Act II, Scene 1.
browser sends new cookie value to PHP

So provide yourself with a link to a new page, and your new cookie value
will magically appear

In Act I, Scene 2, you can simply keep track of the cookie value within
your script, and trust the browser (mostly) to send it back in the next
scene.

 im setting the cookie with:
 setcookie (cookie_name,cookie_value,time()+time-to-expiration);

For some versions of Micrsoft Internet Explorer, you *MUST* provide a path
if you provide a time-out.

Use '/' at the end of your setcookie after any timeout value.

 when deleting it, i do
 setcookie (cookie_name);
 or
 setcookie (cookie_name,,time()-time-to-expiration);

 but it never works

 the browser im testing it is firefox (linux)
 but in IE is not working either...

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php