#!/usr/bin/perl
#---------------------------
#  I N T E L L I S C R I P T . N E T  -  i A w a r d
#  Designed by Jason Silver of Intelliscript.net, CrookedBush.com Inc.
#  All Rights Reserved.  International Copyright Secured.
#  Violators Will Be Prosecuted to the FULL EXTENT of the law.
#  Do Not remove this copyright notice.
#---------------------------

$html_start  = "<i>"; # is always displayed at the beginning of the quote
$html_end    = "</i>"; # is always displayed at the end of the quote
$random_file = "/home/mojoscri/public_html/testimonials.txt"; # the file in which all of your random text phrases are stored.
$delimiter   = "\n\%\%\n"; # separates each group of html or quotes


# ...you're all set...
#___________________________
#---------------------------
print "Content-type: text/html\n\n";

open(FILE,"$random_file") || &error('open->random_file',$random_file);
    @FILE = <FILE>;
close(FILE);
$phrases = join('',@FILE);
@phrases = split(/$delimiter/,$phrases);

# If you are on a machine which doesn't put the 
# pid into $$ (ie. Macintosh, Win NT, etc...), change
# this line to:  srand(time ^ 22/7);

srand(time ^ $$);

$phrase = rand(@phrases);
$phrase2 = rand(@phrases) unless ($phrase eq $phrase2);
$phrase3 = rand(@phrases) unless ($phrase eq $phrase3 || $phrase2 eq $phrase3);

print "<tr>\n";
print "<td align=\"center\">\n";
print "<table width=\"100%\" cellpadding=\"8\" cellspacing=\"0\" bgcolor=\"#FFFFFF\">\n";
print "<tr><td colspan=\"2\"><a href=\"/testimonials.shtml\">READ MORE TESTIMONIALS HERE!</a><br><br><span class=\"testimonials\">\n";

print $html_start.$phrases[$phrase].$html_end;
print "<hr>";
print $html_start.$phrases[$phrase2].$html_end;
print "<hr>";
print $html_start.$phrases[$phrase3].$html_end;

print "</span><br>\n";
print "<a href=\"/contact/index.shtml\">Click here to submit a quote!</a><br>\n";
print "</td></tr>\n";
print "</table>\n";
print "</td></tr><tr><td>&nbsp\;</td></tr></table>\n\n";
print "</td>\n";
print "</tr>\n";
print "</table>\n";
print "</td></tr><tr><td>&nbsp\;</td></tr></table>\n\n";

exit;

sub error {
 ($error,$file) = @_;
 print qq~
 Content-type: text/html
 <html>
 <head>
  <title>ERROR: Random File Unopenable</title>
 </head>
 <body bgcolor=#FFFFFF text=#000000>
  <center>
   <h1>ERROR: Random File Unopenable</h1>
  </center>
  The random file, as specified in the \$random_file perl variable was 
  unopenable.<p>~;
 if (-e $random_file) {
     print "The file was found on your system, so make sure that it is\n";
     print "readable by the web server.  This means you will need to\n";
     print "execute the following command:<pre>\n";
     print "    chmod 744 $random_file\n";
     print "</pre>\n";
 }
 else {
  print "The file was not found on your file system.  This means that\n";
  print "it has either not been created or the path you have specified\n";
  print "in \$trrandom_file is incorrect.\n";
 }
 exit;
}
