How can I set a cookie when someone visits my home page?
I've tried using a server side include like so....
######################### code ######################### #!/usr/bin/perl -w
# This is in my html page: # <!--#exec cgi="/cgi-bin/ezInvoice2/ssi.cgi"-->
use strict;
use CGI qw/:standard/;
use CGI::Carp('fatalsToBrowser');my $Q = new CGI; my $visits;
$visits = $Q->cookie('visit_tracker');
if ($visits eq '') {
$visits = 1;
}
else {$visits++}my $visit_tracker= $Q->cookie(-name=>'visit_tracker',
-value=>"1",
-expires=>'+10y');
print $Q->header(-cookie=>$visit_tracker);
print "You've been here $visits times";
####################### end code #######################This inserts "You've been here 1 times", but does not set the cookie. Nor does it create any errors in my server logs.
I assume this can be done with some "Apache" programming, but I know almost nothing about that and I'd rather do this with perl if possible. Any tips will be much appreciated...
Kindest Regards,
Bill Stephenson
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>
