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();
|