#!/usr/local/bin/perl ########################################################################### #Process Sign-in screen #Introducing cookies (this Perl script stores cookies) ########################################################################### use CGI "param"; $lastname; $pswd; $name_pswd; $msg; if ( ! param() ) { # if there are NO input fields $first_time = 'yes'; # it must be first time around } else { # otherwise $first_time = 'no'; # it's not the first time around $lastname = param('lname'); # get form input for lname $pswd = param('passwd'); # get form input for passwd $name_pswd = $lastname.$pswd; # name_pswd = lastname + password &test_input(); # test the input fields } if ($first_time eq 'yes' || $msg ne '') { # if first time or there are errors &print_form(); # print the sign-in form } else { # if there are no error messages &print_menu(); # print menu } exit(0); ########################################################## sub test_input { if ($pswd eq '') { $msg = 'Please enter your password!'; } if ($lastname eq '') { $msg = 'Please enter your last name!'; } } ########################################################## sub print_form { print "Content-type: text/html \n"; print "\n"; print "

Welcome to Nile.com

The world largest online shopping mall




Enter you last name
Enter your password
 
 
 

$msg

"; } ########################################################## sub print_menu { print "Content-type: text/html \n"; print "Set-Cookie: custid=$name_pswd; path=/"; print "; expires=Friday, 13-Apr-2001 23:59:59 GMT \n"; print "\n"; print "

Nile.com Catalog


Groceries
Apples
Banana
Carrots
Dog Food
Egg
Fresh Fish
Gravy
Hot Sauce
Iceburg Lettuce
Jelly
Pet Shop
Aardvark
Baboon
Cat
Dog
Elephant
Fish
Giraffe
Hippo
Iguana
Jaguar
Ice Cream
Apple Cinnimon
Blackberry
Butter Pecan
Cherry
Chocolate
Coffee
Cookies and Cream
Dark Fudge
Fudge Swirl
German Fudge
"; }