----------------------------------------------------------
----------------------------------------------------------
----------------------------------------------------------
----------------------------------------------------------
----------------------------------------------------------
----------------------------------------------------------
#!/usr/local/bin/perl5
# Purpose: prints cookie results to a Web page
# Author: Larry Gales, November 2000
use CGI;
$query = new CGI;
print "Content-type: text/html\n\n";
print "";
print "
Here are your cookies:
";
@cookie = split(/&/, $ENV{'HTTP_COOKIE'});
$cookie_len = 11;
foreach $c (@cookie) {
$c =~ s/%([\dA-Fa-f][\dA-Fa-f])/pack ("C", hex ($1))/eg;
$c =~ s/\s+/:/g; # replace blanks with :'s
$c =~ s/&/
/g; # replace & with \n's
if ( $c =~ "Help-Web-Cookie" ) { # treat 1st line different
@fields = split( /:/, $c );
$line1 = $fields[0] . ":XXX";
for ( $i = 3; $i < $cookie_len; $i++ ) {
$line1 = $line1 . ":" . $fields[$i] ;
}
$fields[1] =~ s/=//;
$line2 = $fields[1];
for ( $i = 2; $i < $cookie_len; $i++ ) {
$line2 = $line2 . ":" . $fields[$i] ;
}
print "$line1
";
print "$line2
";
} else {
print "$c
";
}
};
print "
exit(0);