in reply to Re: Re: cookie retrieval problem
in thread cookie retrieval problem
Well, I can think of basically two approaches. Either you provide a special, different cookie value to each user, either semi-randomly assigned or via a login page, and you can then track any visitor to your site.
Or, you don't set cookies for everybody, but only for yourself. You can have a special page, which you use to enter the site, but which nobody else knows of. All it has to do is set a cookie, and redirect you to the normal entrance. Every other page only has to read the cookie value. The following code forms the entrance page for the latter approach:
I'm assuming "index.html" is the normal index page to your site's directory.#!/usr/bin/perl -w use CGI qw(:standard); my $cookie_out = cookie(-name=>'test', -value=>'Nikolas was here!'); print redirect(-cookie=>$cookie_out, -uri => "index.html");
Now if you change the other script so it only reads the cookie (so drop the assignment to $cookie_out), you can visit the above script first, then go to the other script, possibly even by typing in the URL manually, and you'll see the cookie value as set here.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: cookie retrieval problem
by Nik (Initiate) on Feb 29, 2004 at 23:40 UTC | |
by bart (Canon) on Mar 01, 2004 at 11:28 UTC | |
|