33 lines
713 B
Perl
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;
|
||
|
}
|