#!/usr/local/bin/perl

###########################################################################
# fortune.cgi -(slightly) modified date.cgi                               #
#                                                                         #
# This script was written by Selena Sol (selena at eff.org                #
# http://www.eff.org/~erict)[and modified by Josiah Hamilton              #
# (jqh1 at cornell.edu http://beastie.law.cornell.edu/~hamilton])         #
# having been inspired by countless other                                 #
# perl authors.  Feel free to copy, cite, reference, sample, borrow or    #
# plagiarize the contents.  However, please let me know where it goes so  #
# that I can at least watch and take part in the development of the       #
# memes. Information wants to be free, support public domain freware.     #
#                                                                         #
###########################################################################

# Set some server specific variables.  You'll have to change these for 
# your own system.


  $graphic = "/icons/myicon.gif";
  $background = "/backgrounds/mybackground.jpg";


# Run the shell command "fortune" and assign output to the variable $fortune

    $fortune = `fortune`;


# Tell the server (communicating in MIME) to get ready to send an html
# document to the client.  This is basically the mime "header".
# Make sure that this extra blank line is included!  This is another MIME
# "command" which lets the server know that we are done with the MIME header.

    print "Content-type: text/html\n\n";

# Begin by giving this new, created on the fly, document a title and
# head and all that  "template" sort of stuff.  And then send the results 
# of the newly formatted fortune command to the browser.  Note, in order for 
# perl to understand that the "" in the link is not a perl command, and is
# something it is supposed to send to the browser, you escape them " with /

     print "<HTML><HEAD><TITLE>Your Fortune:</TITLE></HEAD>";
     print "<BODY background=\"$background\">";
     print "<HR width=64>";
     print "<CENTER><H3><IMG SRC=\"$graphic\"> $fortune </H3></CENTER>";
     print "<HR width=64>";

# Here's a link back to the referring page.  You shouldn't have to modify it.

    print "<CENTER><A HREF=\"$ENV{'HTTP_REFERER'}\">Return.</a></CENTER>";
    print "</BODY></HTML>" 
