#! /usr/bin/perl # httphead - Print the http headers require ("cgi-lib.pl"); &ReadParse(); $test="def"; print "Content-type: text/html \n"; if ( $in{'Action'} eq 'Reset') { $test="gotin"; $cook = $ENV{'HTTP_COOKIE'}; @breakout = split (/;/,$cook); foreach $variable ( sort @breakout ) { @cvals = split (/=/, $variable); print "Set-Cookie: $cvals[0]=; expires=Friday, 01-Jan-1999 00:00:00 GMT \n"; } } if ( $in{'Action'} eq "Add") { if ($in{'CName'} ne '') { print "Set-Cookie: $in{'CName'}= $in{'CValue'}"; if ( $in{'Persist'} eq 'Permanent' ) { print "; expires=Friday, 28-Dec-2001 00:00:00 GMT"; } } print "\n"; } print "\n"; print <Cookie Demo

Cookie Demo

END $cook = $ENV{'HTTP_COOKIE'}; print "

Display Cookie Values and Arguments Passed In

\n"; print "HTTP Cookie in HTTP Header: $cook


\n"; @breakout = split (/;/,$cook); print "\n"; print "\n"; foreach $variable ( sort @breakout ) { @cvals = split (/=/, $variable); print "\n"; } print "
Cookie Name Cookie Value
$cvals[0]\n"; print "$cvals[01]
\n"; if ( $in{'Action'} eq "Add") { print "

Adding Cookie:

\n"; print "Cookie Name: $in{'CName'}
\n"; print "Cookie Value: $in{'CValue'}
\n"; print "Expiration: $in{'Persist'}
\n"; } if ( $in{'Action'} eq "Reset") { print "

All Cookies Will Be Reset

\n"; } print <Form to Add, Display or Clear Cookies\n;
Cookie Name:
Cookie Value:
Cookie Persistence: Session Permanent

Button Action: Add Cookie Show Cookie Reset Cookies





Copyright © 2000 Meerkat Technology
Homepage
END print "\n"