#!/lusr/bin/perl #---------------------------------------------------------------------------- # Program: card.pl (on-line card CGI) # # Version: 0.2 # # Date: Thu Jul 2 07:47:10 CDT 1998 initial upload (program date: Dec 97) # # Description: # # Christmas card (or for any other purpose). # # Author: Yoonsuck Choe Copyright (c) 1998 # # Licensing Terms : Freely distributable for private use only (with this # header section intact). # Provided as-is. No warranty. # # Usage: # See http://www.cs.utexas.edu/users/yschoe/forms/card/ # for an example form. # Must setup datafile : $towhom. # Also, you have to set up a coverpage : $coverpage # # Datafile format: # # one line per person. # # username:passwd:message:sig # # For example, # # yschoe:greetings: Merry Christmas! Have fun! : Sincerely,yschoe # ahran:whazup: Merry Christmas! Have fun! : Yours, Yoonsuck # super:lois: Merry Christmas! Have fun! Doh! : Later, YS # # Coverpage format: # # Basically in HTML. # # Example file is in # http://www.cs.utexas.edu/users/yschoe/src/card.data # The keywords # # DEARWHO MESSAGE SIGNATURE # # in this file is replaced by the data fields listed above. # # Source URL: # # http://www.cs.utexas.edu/users/yschoe/src/card.pl # # Requirements: # # Perl Version 5.003 or better # * may work with older versions, but I cannot tell for sure. # #---------------------------------------------------------------------------- # some declarations # datafile contains name, passwd and message $towhomfile = "/usr/spool/net/www/users/yschoe/cgi-bin/card/towhom.data"; $coverpage= "/usr/spool/net/www/users/yschoe/cgi-bin/card/card.data"; # # print HTML header and title stuff # print "Content-type: text/html", "\n\n"; print "","\n"; print " Merry Christmas 1997 \n"; print "\n"; # # get query string # $query_string = $ENV{'QUERY_STRING'}; # # process query string (get the value of each field) # ($uid) = split(/\&/,$query_string); ($junk,$uid) = split(/=/,$uid); ($name,$pwd) = split(/\./,$uid); #---------------------------------------------------------------------------- # Main part #---------------------------------------------------------------------------- # verify user and get message open(PWFILE,$towhomfile); while() { ($id,$pw,$nm,$msg,$sign) = split(/:/); #print $_."

"; #print "[$uid:$id:$pw:$pwd]

"; if ($id eq $name && $pw eq $pwd) { #print "breaking

"; last; } else { $id = "NONE"; } } close PWFILE; # id not found - message directed to nobody if ($id eq "NONE") { $nm = "You"; $msg = "Your magicword did not match any entry in the database (please try again if you got a magicword from me). Anyway, Best Wishes...."; $sign = "Yoonsuck and Ahran"; } # print it out open(MSG,"$coverpage"); while () { if (/DEARWHO/) { print $nm; } elsif (/MESSAGE/) { print $msg; } elsif (/SIGNATURE/) { print $sign; } else { print ; } } close MSG; # # end of body # print "

CGI programming by: Yoonsuck Choe (yschoe\@cs.utexas.edu). Please let me know if you cannot read Hangeul."; print "

\n"; print "\n";