Putting empty into cookie = (null)

Are you using LiveCode to create server scripts or CGIs?

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
bangkok
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 928
Joined: Fri Aug 15, 2008 7:15 am

Putting empty into cookie = (null)

Post by bangkok » Sun Feb 24, 2013 9:11 am

To test if a cookie exists, i do :

Code: Select all

put $_COOKIE into allCookies
put allCookies["mycookie"]  into mycookie
if mycookie is empty then put "problem"
But if in order to reset the cookie, i do :

Code: Select all

put cookie "mycookie" for "/" with empty
... its value becomes "(null)"

which defeats the first test.

Is it normal ? Should I just add a condition <>"(null)" to the "empty" condition and don't bother ?

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5147
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Putting empty into cookie = (null)

Post by Mark » Mon Mar 11, 2013 12:17 pm

Hi,

The cookie returns null because it is empty but still exists. This is normal. To delete a cookie, you can overwrite it with an expiry date in the past.

Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Post Reply

Return to “CGIs and the Server”