php


What's the reason for cookies mysteriously reappearing?


I'm developing a web application using a cookie to store session information. I've manually deleted the session cookies because I'm working on another part of the code where I don't want a login session. However, after a couple reloads of the page, the session cookie mysteriously reappears, including an earlier cookie that I had only set once for testing purposes, then deleted and never used again.
I keep manually deleting the cookies in question, but still, when I reload the page after a while, the cookies are back. I've double-checked my code and I am positive I'm not setting those cookies anywhere. My code is all in one file at the moment, and I'm not including anything, so there's no possibility that I'm overlooking something.
My code is in PHP and used the setcookie() call when I initially created those cookies.
I've not set an expiry date on the cookies.
Using Safari 4 Beta and the GlimmerBlocker proxy.
What's the explanation for this weird behaviour?
There are known problems with certain browsers cookie handling.
See the following paper:
iSEC Cleaning Up After Cookies
Also see this discussion on Apple.com regarding the case of the reappearing cookie.
Try this, it should remove all of your session cookies:
session_start();
// Unset all of the session variables.
$_SESSION = array();
// If it's desired to kill the session, also delete the session cookie.
// Note: This will destroy the session, and not just the session data!
if (isset($_COOKIE[session_name()])) {
setcookie(session_name(), '', time()-42000, '/');
}
// Finally, destroy the session.
session_destroy();
What version of the OS are you using? What other apps are you using at the same time? These issues are generally due to apps stomping on the cookie storage file (~/Library/Cookies/Cookies.plist) one after another.

Related Links

get parent array name after array_walk_recursive function
How To Insert From Data From PHP to MySQL DB
Form, receive variables on same php file [duplicate]
Arrays and nested foreach
Sidenavigation. Load everything with one request or splitted?
Display TinyMCE inputted text causing undisplayable characters
how to echo a node value (not atribute)
Cakephp Not validating data in Form
Regex Substring Negation
Selecting style attribute with REGEX in PHP
Convert SQL to active record in CodeIgniter
Wamp run as standard user?
PHP Curl followlocation working from command line but not from browser
Magento folder change
Keep form data inside the field after submission using php
Wordpress pagination Same code but acts differently

Categories

HOME
opengl
android-studio
memory
tomcat
clearcase
yii
kendo-dropdown
bots
haproxy
theano
fogbugz
ui-automation
kurento
gtk
pm2
smartgwt
amazon-elb
jodatime
webstore
exe
exec-maven-plugin
codefluent
bazaar
hdl
maven-surefire-plugin
perfino
offline-caching
amazon-cloudtrail
docx4j
location-services
gsp
directfb
android-canvas
buildforge
dreamfactory
xerces-c
mars-simulator
django-smart-selects
iscroll
praat
python-jira
httphandler
supertest
hibernate-ogm
phppgadmin
alertify
degrees
nrf51
cefpython
raw-sockets
conan
fiber
right-to-left
adp
wicked-pdf
noclassdeffounderror
codecharge
persistent-object-store
preferenceactivity
openmrs
google-gdk
relational-model
erlog
ocmockito
azure-xplat-cli
subview
maven-shade-plugin
operands
lifetime
symja
configurable-product
storing-data
object-code
forio-contour
forceclose
code39
visual-c++-2005
mousemotionlistener
stty
codahale-metrics
blobstorage
axacropdf
xalan
daap
coordinate
taskkill
autosize
netstream
kolite
yuidoc
will-paginate

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App