#!perl
# Fig. 26.22: cookies.pl
# Program to write a cookie to a client’s machine

use CGI qw( :standard );

$name = param( NAME );
$height = param( HEIGHT );
$color = param( COLOR );

$expires = "Monday, 11-JUN-01 16:00:00 GMT";

print "Set-Cookie: Name=$name; expires=$expires; path=\n";
print "Set-Cookie: Height=$height; expires=$expires; path=\n";
print "Set-Cookie: Color=$color; expires=$expires; path=\n";

print header, start_html( "Cookie Saved" );
print <<End_Data;
<FONT FACE = "ARIAL,SANS-SERIF" SIZE = 3>
The cookie has been set with the folowing data:<BR><BR>
<FONT COLOR = BLUE>Name:</FONT> $name <BR>
<FONT COLOR = BLUE>Height:</FONT> $height<BR>
<FONT COLOR = BLUE>Favorite Color:</FONT> 
<FONT COLOR = $color> $color<BR></FONT>
<BR>Click <A HREF = "read_cookies.pl">here</A>
to read saved cookie.
End_Data

print end_html;

########################################################################## 
# (C) Copyright 2001 by Deitel & Associates, Inc. and Prentice Hall.     #
# All Rights Reserved.                                                   #
#                                                                        #
# DISCLAIMER: The authors and publisher of this book have used their     #
# best efforts in preparing the book. These efforts include the          #
# development, research, and testing of the theories and programs        #
# to determine their effectiveness. The authors and publisher make       #
# no warranty of any kind, expressed or implied, with regard to these    #
# programs or to the documentation contained in these books. The authors #
# and publisher shall not be liable in any event for incidental or       #
# consequential damages in connection with, or arising out of, the       #
# furnishing, performance, or use of these programs.                     #
##########################################################################
