Path: csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.093 X-Spam-Evidence: '*H*': 0.82; '*S*': 0.01; 'else:': 0.03; 'data:': 0.09; 'host,': 0.09; 'pages.': 0.09; 'template.': 0.09; 'cc:addr :python-list': 0.11; 'template': 0.14; 'thread': 0.14; '%s,': 0.16; 'cookies': 0.16; 'hits': 0.16; 'subject:when': 0.16; 'wrote:': 0.18; 'bit': 0.19; 'pages,': 0.22; 'cc:addr:python.org': 0.22; 'exists': 0.24; 'cc:2**0': 0.24; 'values': 0.27; 'header:In- Reply-To:1': 0.27; 'record': 0.27; 'tried': 0.27; 'host': 0.29; 'message-id:@mail.gmail.com': 0.30; 'url:mailman': 0.30; 'code': 0.31; 'easy,': 0.31; 'open': 0.33; 'url:python': 0.33; 'subject:from': 0.34; 'something': 0.35; 'received:google.com': 0.35; 'google': 0.35; 'add': 0.35; 'there': 0.35; 'url:listinfo': 0.36; 'url:org': 0.36; 'follows:': 0.38; 'pm,': 0.38; 'previous': 0.38; 'url:mail': 0.40; 'tell': 0.60; 'free,': 0.61; 'new': 0.61; 'browser': 0.61; 'simple': 0.61; 'first': 0.61; 'account': 0.65; 'to:addr:gmail.com': 0.65; 'city': 0.66; '8bit%:100': 0.72; 'account.': 0.80; 'ref': 0.84; 'subject:gets': 0.84; 'visitor': 0.84; 'analytics.': 0.91; 'joel': 0.91; 'visitors.': 0.91; 'yes!': 0.91; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=l5hu89k9H6VC1Dp+HEhPUs8pgQGv8ocId+EHgmmdgfI=; b=jwsl4lfCEYI13ot9b+E0S4TAuNOt+F3vk9k3GXaNJAbHQOQxKYIyCbG3ENEJ49o0SH FhVm4ecTWGK77lN65las0O2NQTO8jHZcDyjjYAVdd22WH2F0ad318A+iDpt9C2hb/Y/T 66G+vYtiPRHNHbXic3kct7jJ/ypy1ReKvDyNXv/FL0SeaLgElLbL5OsuFKx85vel8knW ZwRx8dOpa77FtiRjJkRP/BQqFXW/0Cmo9C1WQbowburlgiVv8jRlgL0aZc7NM/+QhBEB D3qSFmUyBd/H8eXEAtB0jYc8K/WGSCal6g/Dg8CX+ERsPOydwvtw0c/eEn8vprxLATUK ve6w== MIME-Version: 1.0 X-Received: by 10.205.65.208 with SMTP id xn16mr2738107bkb.31.1381254434565; Tue, 08 Oct 2013 10:47:14 -0700 (PDT) In-Reply-To: References: Date: Tue, 8 Oct 2013 13:47:14 -0400 Subject: Re: Cookie gets changed when hit comes from a referrer From: Joel Goldstick To: =?UTF-8?B?zp3Or866zr/PgiDOkc67zrXOvs+Mz4DOv8+FzrvOv8+C?= Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: "python-list@python.org" X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 49 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1381254441 news.xs4all.nl 15891 [2001:888:2000:d::a6]:55321 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:56436 On Tue, Oct 8, 2013 at 1:30 PM, =CE=9D=CE=AF=CE=BA=CE=BF=CF=82 =CE=91=CE=BB= =CE=B5=CE=BE=CF=8C=CF=80=CE=BF=CF=85=CE=BB=CE=BF=CF=82 wrote: > Is there any better way to identif a previous visitor? i tried cookies wh= ich > 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 =3D= %s > and host =3D %s''', (cID, host) ) > data =3D 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, user= os, > browser, ref, lastvisit) ) > else: > # since visitor exists just update his record > cur.execute('''UPDATE visitors SET city =3D %s, u= seros > =3D %s, browser =3D %s, ref =3D %s, hits =3D hits + 1, lastvisit =3D %s''= ', (city, > useros, browser, ref, lastvisit) ) > =3D=3D=3D=3D=3D=3D=3D > > Please tell me if you can think fo something else. Yes! there is a very simple and comprehensive way to learn about your visitors. Use Google Analytics. Its free, you only need a google account to open an analytics account. They give you a small bit of javascript that you copy and past to your pages. If you are using a template to create your pages, this is easy, since you just add google code to the template. > > -- > https://mail.python.org/mailman/listinfo/python-list --=20 Joel Goldstick http://joelgoldstick.com