#!/usr/local/bin/perl # HTML4dummies Registration CGI # 6/5/95 - singe@outer.net # called by http://www.outer.net/html4dum/registrn.html # # 1.0 - collects data from the user's submitted registration form, # parses it and translates where necessary into an intelligible format # then writes the whole thing to the data file for future use. # # 1.1 - error handling added # require "/www/cgi-bin/formlib.pl"; $| = 1; # output NOT buffered chop ($date = `/bin/date`); # for the 'this page created' line at the bottom &GetFormArgs(); # parse arguments passed from FORM (now in %in) $ENV{PATH_INFO} ne '' && &GetPathArgs($ENV{PATH_INFO}); print "Content-Type: text/html\n\n"; ############################################################################ print "<HTML><HEAD><TITLE>HTML for Dummies", "Registration</TITLE></HEAD>"; unless ( $in{Name} && ($in{Addr1} || $in{DayPhone})) { # the user did not send us the minimum amount of information, # spit out an error print "<H1><IMG ALIGN=TOP SRC=", "\"http://www.outer.net/html4dum/graphics/dummyguy.gif\">", "ERROR!</H1>\n"; print "There was a problem with the data you entered. You ", "need to supply at least: <B>name, address and ", "phone number.</B><P>", "If you wish to correct your data, ", "<A HREF=\"http://www.outer.net/html4dum/registrn.html\">", "return to the registration form.</A><HR>", "<ADDRESS>Registration form CGI by", "singe@outer.net<P>$date</ADDRESS></HTML>"; exit (1); # end the CGI right here. } else { # we now continue with our regularly scheduled CGI print "<BODY> <A NAME=\"top\"></A> ", "<IMG SRC=\"http://www.outer.net/html4dum/graphics/line.gif\"><BR>", "<B><A HREF = \"http://www.outer.net/html4dum/html4dum.html\"> ", "HOME</A>  |", "<A HREF = \"http://www.outer.net/html4dum/contact.htm#top\"> ", "BACK</A>  |", "<A HREF = \"http://www.outer.net/html4dum/ftpstuff.htm#top\"> ", "NEXT</A>  |", "<A HREF = \"http://www.outer.net/html4dum/search4d.htm#menu\"> ", "MENU</A>  |", "<A HREF = ", "\"http://www.outer.net/html4dum/search4d.html#search4d\"> SEARCH</A> ", " |", "<A HREF = \"http://www.outer.net/html4dum/contact.html\"> ", "CONTACT</A>  |", "<A HREF = \"http://www.outer.net/html4dum/comment.html\"> ", "COMMENT</A>  |", "<A HREF = \"http://www.outer.net/html4dum/helpinfo.html\"> ", "HELPINFO</A></B><BR>", "<IMG ", "SRC=\"http://www.outer.net/html4dum/graphics/line.gif\"><P>", "<IMG ALIGN=TOP ", "SRC=\"http://www.outer.net/html4dum/graphics/dummyguy.gif\"> "; while (-e "/www/httpdocs/html4dum/data/registrations.LCK") { system ("sleep 3"); } open (LOCK, ">> /www/httpdocs/html4dum/data/registrations.LCK"); open (REGISTER, ">>/www/httpdocs/html4dum/data/registrations"); print REGISTER "Overall Rating: $in{overrate}\nHeard from: "; if ($in{Bookstore}) { print REGISTER "Bookstore"; if ($in{BSname}) { print REGISTER " ($in{BSname})"; $join = "|"; } } print REGISTER "\t"; if ($in{Ad}) { print REGISTER "${join}Advertisement"; $join = "|"; } if ($in{Word}) { print REGISTER "${join}Word of mouth"; $join = "|"; } if ($in{Review}) { print REGISTER "${join}Review"; $join = "|"; } if ($in{Catalog}) { print REGISTER "${join}Catalog"; $join = "|"; } if ($in{Other}) { print REGISTER "${join}Other"; $join = "|"; } if ($in{othernm}) { print REGISTER " ($in{othernm})" } $join = ""; print REGISTER "\nLiked: $in{liked}\nWould Change: $in{change}\nComments:", "$in{comments}"; print REGISTER "\nComputer Books Purchased Per Year: $in{compnumb}\nSkill ", "level: $in{compskil}\n"; print REGISTER "Type of Computer used: "; if ($in{DOS}) { print REGISTER "${join}DOS"; $join = "|"; } if ($in{Windows}) { print REGISTER "${join}Windows"; $join = "|"; } if ($in{OS/2}) { print REGISTER "${join}OS/2"; $join = "|"; } if ($in{Macintosh}) { print REGISTER "${join}Macintosh"; $join = "|"; } if ($in{Other}) { print REGISTER "${join}Other"; $join = "|"; } if ($in{other}) { print REGISTER " ($in{otherpc})"; } $join = ""; print REGISTER "\n"; print REGISTER "Interested in: "; if ($in{WordProc}) { print REGISTER "Word Processing"; $join = "|"; } if ($in{WordProcNm}) { print REGISTER " ($in{WordProcNm})" } if ($in{Spreadsheets}) { print REGISTER "${join}Spreadsheets"; $join = "|"; } if ($in{SpreadsheetsNm}) { print REGISTER " ($in{SpreadsheetsNm})" } if ($in{Databases}) { print REGISTER "${join}Data bases"; $join = "|"; } if ($in{DatabasesNm}) { print REGISTER " ($in{DatabasesNm})" } if ($in{Desktop}) { print REGISTER "${join}Desktop Publishing"; $join = "|"; } if ($in{DesktopNm}) { print REGISTER " ($in{DesktopNm})" } if ($in{FileUtil}) { print REGISTER "${join}File Utilities"; $join = "|"; } if ($in{FileUtilNm}) { print REGISTER " ($in{FileUtilNm})" } if ($in{MoneyMng}) { print REGISTER "${join}Money Management"; $join = "|"; } if ($in{MoneyMngNm}) { print REGISTER " ($in{MoneyMngNm})" } if ($in{Networking}) { print REGISTER "${join}Networking"; $join = "|"; } if ($in{NetworkingNm}) { print REGISTER " ($in{NetworkingNm})" } if ($in{ProgLang}) { print REGISTER "${join}Programming Languages"; $join = "|"; } if ($in{ProgLangNm}) { print REGISTER " ($in{ProgLangNm})" } if ($in{Other}) { print REGISTER "${join}Other"; $join = "|"; } if ($in{other}) { print REGISTER " ($in{other})" } $join = ""; print REGISTER "\nUses a PC at:\t"; if ($in{PCHome}) { print REGISTER "Home"; $join = "|"; } if ($in{PCWork}) { print REGISTER "${join}Work"; $join = "|"; } if ($in{PCSchool}) { print REGISTER "${join}School"; $join = "|"; } if ($in{PCOther}) { print REGISTER "${join}Other"; $join = "|"; } if ($in{PCOtherNm}) { print REGISTER " ($in{PCOtherNm})" } ${join} = ""; print REGISTER "\nPreferred Disks:\t"; if ($in{525}) { print REGISTER "5.25"; $join = "|"; } if ($in{35}) { print REGISTER "${join}3.5"; $join = "|"; } if ($in{DiskOther}) { print REGISTER "${join}Other"; $join = "|"; } if ($in{DiskOtherSize}) { print REGISTER " ($in{DiskOtherSize})" } print REGISTER "\nHas a CD-ROM:\t$in{CDROM}\n"; print REGISTER "Plans to buy or upgrade computer hardware this ", "year:\t$in{Hardware}\n"; print REGISTER "Plans to buy or upgrade computer software this ", "year:\t$in{Software}\n"; print REGISTER "Name: $in{Name}\n"; print REGISTER "Business Title: $in{Bustitle}\n"; print REGISTER "Type of Business: $in{TypeBus}\n"; print REGISTER "$in{AddrLoc} Address: $in{Addr1}:$in{Addr2}:$in{CSZ}:$in{Country}\n"; if ($in{QuoteMe} eq "on") { $quote = "Yes"; } else { $quote = "No"; } print REGISTER "Agrees to be quoted: $quote\n"; print REGISTER "Daytime phone number: $in{DayPhone}\n"; print REGISTER "=============================================================\n\n"; close (REGISTER); unlink ("/www/httpdocs/html4dum/data/registrations.LCK"); print "<H2>Thanks for your registration information!</H2>"; print "<ADDRESS>Registration form CGI by singe@outer.net<P>$date</ADDRESS></HTML>"; }
HOME |
BACK |
NEXT |
MENU |
SEARCH | ORDER |
COMMENT |
HELPINFO
E-Mail: The Web Foundations at twf@lanw.com