# initialize cookie and retrieve cookie from clients browser
cookie = cookies.SimpleCookie( os.environ.get('HTTP_COOKIE') )

if cookie.get('ID') is not None:
        cookieID = cookie['ID'].value
else:
        cookieID = random.randrange(0, 9999)
        cookie['ID'] = cookieID
        cookie['ID']['path'] = '/'
        print( cookie )

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

I use this code to retrive or set a cookie to the visitor's browser if present and identify him bu it.

All work well except the situation where the user visits my webpage by clicking a backlink on another wbpage.

Then for some reason the cookieID changes to another value thus a new entry appears into the database when insert happens.

What cna i do about that?
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to