Cookie gets changed when hit comes from a referrer
Νίκος Αλεξόπουλος
nikos.gr33k at gmail.com
Tue Oct 8 13:30:48 EDT 2013
Is there any better way to identif a previous visitor? i tried cookies
which failed for me for the reason i opened this thread and host like
follows:
# try to locate the visitor
cur.execute('''SELECT * FROM visitors WHERE counterID = %s and host =
%s''', (cID, host) )
data = cur.fetchone()
if not data:
# if first time visitor on this page, create new record
cur.execute('''INSERT INTO visitors (counterID, host, city, useros,
browser, ref, lastvisit) VALUES (%s, %s, %s, %s, %s, %s, %s)''',
(cID, host, city, useros, browser, ref, lastvisit) )
else:
# since visitor exists just update his record
cur.execute('''UPDATE visitors SET city = %s, useros = %s, browser =
%s, ref = %s, hits = hits + 1, lastvisit = %s''', (city, useros,
browser, ref, lastvisit) )
=======
Please tell me if you can think fo something else.
More information about the Python-list
mailing list