Ah, that problem again. <grin>
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:
#!/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");
I'm assuming "index.html" is the normal index page to your site's directory.
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. |