You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
713 B
Perl

#!perl
use CGI qw( :standard );
print header, start_html( "Read cookies" );
print "<STRONG>The folowing data is saved in a cookie on your ";
print "computer.<STRONG><BR><BR>";
%cookies = readCookies();
print "<TABLE>";
foreach $cookieName ( "Name", "Height", "Color" )
{
print "<TR>";
print " <TD>$cookieName</TD>";
print " <TD>$cookies{ $cookieName }</TD>";
print "</TR>";
}
print "</TABLE>";
print end_html;
sub readCookies
{
@cookieArray = split( "; ", $ENV{ 'HTTP_COOKIE' } );
foreach ( @cookieArray )
{
( $cookieName, $cookieValue ) = split ( "=", $_ );
$cookieHash{ $cookieName } = $cookieValue;
}
return %cookieHash;
}