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

CodeIgniter, pass data from model to controller to display sql operations results in controller
How to provide external account parameter while creating managed account in stripe using php?
how to make a page active for dynamic in codeigniter
Not getting email on second request email verification
Shared hosting, add library path (similar to ZEND)
Display MySQL query results in HTML table [duplicate]
How to fill session array with data from database?
unsupported operand types in form.inc drupal 7
Pass PHP serialize value to swift
Fetching number of rows after PDO execute
Parse.com PHP SDK case insensitive search query
Count rows with data in csv using PHP
Blank Notification Icon in Android Push Notification
How To Use Url Rewrite With PHP on CGI
how to specify table name in addColumn() function in magento
Unable to install wordpress theme - ubuntu

Categories

HOME
android-espresso
mpdf
yaml
vagrant
jms
livecode
activemq
website
risk-management
dependencies
moodle-api
swift2
linker
clone
sentry
ui-automation
cdi
u-boot
parsley.js
multi-step
jodatime
dma
orange-api
bnf
phonegap-build
vmware-workstation
mixpanel
word2vec
spyder
opam
maven-surefire-plugin
pymongo
intel
channel
candlestick-chart
pyopencl
points
marquee
sendmessage
xenapp
windows2012
snap-framework
opnet
overwrite
mongoengine
jfxtras
nppexec
runtimeexception
xvfb
forms-authentication
best-buy-api
imgur
viewcontroller
opal-framework
jqgrid-asp.net
nomad
windows-media-player
cyanogenmod
entropy
emf-compare
cognos-tm1
maatwebsite-excel
nitrousio
rational-performance-test
openquery
jpda
nunit-console
fragmentstatepageradapter
static-methods
meld
node-glob
timestamping
gwt-syncproxy
diawi
json-spirit
godeps
roxygen2
compositetype
ipod
nsmutabledata
thoughtworks-go
n-tier-architecture
inequality
berkeley-db-xml
igor
accessory
commenting
refit
bittorrent-sync
roxy-fileman
tfs-sdk
ip-geolocation
android-dialog
live-wallpaper
hardcode
algol68
azure-acs
qcar-sdk
mongrel
inversion
datagridcolumn
objectinstantiation
account-management

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App