Nik has asked for the wisdom of the Perl Monks concerning the following question:
Well this piece of code worked great until i realized that not all of the website visitors had their broswer ebabled to store cookies. Because of that my website inserted 10-20 records of the same person that vistied my website because when the page wanted to read the visitors cookie it could not do it because the cookie never actually stored to the visitors pc. So the code decided to insert this person ip at the log onece again and once again thinking that he was another visitor.if ( $ENV{HTTP_COOKIE} ) { $st = $db->prepare( 'SELECT * FROM logs' ); $st->execute(); while ( $row = $st->fetchrow_hashref ) { if ( cookie(host) eq $row->{host} ) { $db->do( "UPDATE logs SET visits=visits+1 WHERE host='$row->{ +host}'" ) or die $db->errstr; } } if ( not $st->rows() ) { $db->do( "INSERT INTO logs VALUES (NULL, '$host', '$xronos', 'in +dex', 1)" ) or die $db->errstr; } } elsif ( !$ENV{HTTP_COOKIE} ) { $db->do( "INSERT INTO logs VALUES (NULL, '$host', '$xronos', 'index +', 1)" ) or die $db->errstr; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Need a way to identify the same person that visits my webpage.
by blue_cowdawg (Monsignor) on Jul 18, 2004 at 12:46 UTC | |
| |
|
Re: Need a way to identify the same person that visits my webpage.
by borisz (Canon) on Jul 18, 2004 at 12:02 UTC | |
| |
|
Re: Need a way to identify the same person that visits my webpage.
by knoebi (Friar) on Jul 19, 2004 at 07:38 UTC |