LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-20-2004, 12:09 PM   #1
Linh
Member
 
Registered: Apr 2003
Posts: 178

Rep: Reputation: 30
Smile Cookie got wipe out but not completely


I have a web application with several pages in it.
On one web page I set the cookie value to null, and I print it out and it works, but when I go to another web page on the same web application, the value was not wiped out, but it is still there.

I know that each session of Linux or apache user maintain its own environment and that when a cookie in one environment session got wiped out, it does not affect a cookie in another environment session.

The web application that I am running have one session even if the user clicked on a different page on the same application.

=====================

def get_cookie():

cookie = Cookie.SmartCookie()
cookie.load(os.environ["HTTP_COOKIE"])

for key, item in cookie.items():

if key == "USERNAME" and item.value != "":
user_name = item.value

if key == "PASSHASH" and item.value != "":
user_password = item.value

if key == "COOKIE_TIME_STAMP" and item.value != "":
cookie_time_stamp = item.value

time_difference = time.mktime(time.localtime(time.time())) - float(cookie_time_stamp);
if (time_difference > 10): #if the time limit exceeds 10 seconds

cookie["USERNAME"]=""
cookie["PASSHASH"]=""
cookie["COOKIE_TIME_STAMP"]=""

for key, item in cookie.items():
if key == "USERNAME":
a = item.value

if key == "PASSHASH":
b = item.value

if key == "COOKIE_TIME_STAMP":
c = item.value

# The user_name, user_password, cookie_time_stamp
# should all be blank because of the loop above
return a, b, c

##############################

return USERNAME, PASSHASH, COOKIE_TIME_STAMP

##############################

var_cookie_time_stamp = get_cookie();
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Javascript Cookie help master splinter Programming 2 05-12-2005 05:37 AM
LQ cookie not used this time??? itsjustme LQ Suggestions & Feedback 3 11-19-2004 10:29 AM
secret cookie? Chuck23 Linux - Security 6 09-06-2004 09:41 PM
mmmm cookie nny0000 Slackware 3 01-11-2004 03:17 AM
Lost my cookie crabboy LQ Suggestions & Feedback 2 06-12-2001 02:40 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:02 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration