#!/usr/bin/perl
use Socket;
$|=1;
##################################################################  
#  birdcast.cgi Version 2.1
#  updated Nov 2, 2002
#  (C)1998-2002 Bignosebird.com                                          
#  This software is FREEWARE! Do with it as you wish. It is yours   
#  to share and enjoy. Modify it, improve it, and have fun with it! 
#  It is distributed strictly as a learning aid and bignosebird.com 
#  disclaims all warranties- including but not limited to:          
#  fitness for a particular purpose, merchantability, loss of       
#  business, harm to your system, etc... ALWAYS BACK UP YOUR        
#  SYSTEM BEFORE INSTALLING ANY SCRIPT OR PROGRAM FROM ANY          
#  SOURCE!
##################################################################  

# CONFIGURATION NOTES 

#
# $SCRIPT_NAME is the full URL of this script, including the 
# http part, ie, "http://domainname.com/cgi-bin/birdcast.cgi";
#
# $SITE_NAME is the "name" of your web site.
# $SITE_URL is the URL of your site (highest level)
# $END_LINE is the very last line printed in the e-mail.
#
# $MAXNUM is the number of possible people a person can refer
# your URL to at one time. If you call the script using the
# GET method, then this is also the number of entry blanks
# created for recipient names and addresses.
#
# $SMTP_SERVER is the name of your e-mail gateway server, or
# SMTP host. On most systems, "localhost" will work just fine.
# If not, change "localhost" to whatever your ISP's SMTP
# server name is, ie, smtp.isp.net or mail.isp.net

# $SEND_MAIL is the full path to your server's sendmail program
# If you do not wish to use Sockets for some reason and need
# to use sendmail, uncomment the $SEND_MAIL line and comment
# the $SMTP_SERVER line.

# okaydomains is a list of domains from which you want to allow
# the script to be called from.  Leave it commented to leave the
# script unrestricted. If you choose to use it, be sure to list
# your site URL with and without the www.

#  Use either $SMTP_SERVER 
# $SMTP_SERVER="smtp.1and1.com";
#
#     OR
#
  $SEND_MAIL="/usr/sbin/sendmail -t"; 
#
#      BUT NEVER BOTH!!!!!!

   @okaydomains=("http://qfever.com", "http://www.qfever.com");

   $SCRIPT_NAME="https://www.qfever.com/cgi-bin/pagecast_2005.cgi";
   $SITE_NAME="Q Fever! - Medical Humor & Satire For Healthcare Professionals";
   $SITE_URL="https://www.qfever.com/";
   $ENDLINE="";
   $MAXNUM=7;
   $LOGFILE="/homepages/23/d167956403/htdocs/qfever/html/reflog.txt";

   if ($SENDMAIL ne "")
     {&test_sendmail;}


   &valid_page;    #if script is called from offsite, bounce it!
   &decode_vars;
   if ( $ENV{'REQUEST_METHOD'} ne "POST")
    {
      &draw_request;
      exit;
    }
   &do_log;
   &process_mail;
   print "Location: $JUMP_TO\n\n";

##################################################################
sub process_mail
 {
for ($i=1;$i<$MAXNUM+1;$i++)
    {
      $recipname="recipname_$i";
      $recipemail="recipemail_$i";
      if ($fields{$recipemail} eq "")
        {
         next;
        }
      if (&valid_address == 0)
        {
         next;
        }

#BNB SAYS! You can modify the Subject line below.

$subject = "$fields{'send_name'} thinks you should *Qatch The Fever!*";

#BNB SAYS! Modify the lines below between the lines marked
# with __STOP_OF_MAIL__ to customize your e-mail message
# DO NOT remove the lines that contain __STOP_OF_MAIL__!
# If you enter any hardcoded e-mail addresses, BE SURE TO
# put the backslash before the at sign, ie, me\@here.net

$msgtxt = <<__STOP_OF_MAIL__;            
Hey, $fields{$recipname}!

One of your best friends, $fields{'send_name'}, stopped by at **Q Fever! - Medical Humor & Satire For Healthcare Professionals**, and thought you should really check it out!

   https://www.qfever.com/

__STOP_OF_MAIL__

      if ($fields{'message'} ne "")
       {
         $msgtxt .= "Oh, and by the way ... $fields{'send_name'} also thought it might be appropriate to say:\n\n";
         $msgtxt .= "   $fields{'message'}\n\n";
       }
       $msgtxt .= "-----------------------------\n";
       $msgtxt .= "Q Fever! - Medical Humor & Satire\n";
       $msgtxt .= "For Healthcare Professionals\n";
       $msgtxt .= "https://www.qfever.com/\n\n";
       $mailresult=&sendmail($fields{send_email}, $fields{send_email}, $fields{$recipemail}, $SMTP_SERVER, $subject, $msgtxt);

      if ($mailresult ne "1")
      {print "Content-type: text/html\n\n";
       print "MAIL NOT SENT. SMTP ERROR: $mailresult\n";
       print "Did you fill everything out correctly?";
       exit
      }

    }
 }

##################################################################
sub draw_request
 {
print "Content-type: text/html\n\n";

#BNB SAYS! Here is the part that draws the page that asks the 
#reader to enter e-mail addresses and names. Tailor it to meet
# your needs if necessary. DO NOT disturb the lines with
# __REQUEST__ on them.
# ----------------- HTML STARTS HERE --------------------
print <<__REQUEST__;
<html>
<head>
<title>Q Fever! MEDICAL HUMOR</title>

<meta name="keywords" content="medical, humor, satire, parody, news, healthcare, medicine, nurses, nursing, doctor, doctors, nurse, funny, med, premed, physician, physicians, md, interns, intern, resident, residency, joke, jokes, fun, suppository, hippo, medical classifieds">
<meta name="description" content="A medical humor and satire website for healthcare professionals, with news, articles, features and other nonsense! ">
<META NAME="copyright" CONTENT="(c) Q Fever!, LLC. All rights reserved.">
<!-- <META HTTP-EQUIV="?" CONTENT="?; URL=?"> -->

<LINK REL="SHORTCUT ICON" HREF="https://www.qfever.com/q.ico">
<!---- 
<link rel="stylesheet" href="qfever-new.css" type="text/css"> 
<style type="text/css">
.style1 {font-size: 1px}
</style>
----->
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
a:link {
	text-decoration: none;
	color: #3333FF;
}
a:visited {
	text-decoration: none;
}
a:hover {
	text-decoration: underline;
}
a:active {
	text-decoration: none;
}
body {
	background-color: #CCCCCC;
}
.style1 {font-size: 10px}
.style2 {font-size: 11px; }
.style3 {font-style: italic}
.style4 {color: #999999}
-->
</style>
<link href="../qfever_new.css" rel="stylesheet" type="text/css">
</head>
<body>
<table width="770"  border="0" align="center" cellpadding="0" cellspacing="0">
  <tr align="center" valign="top" bgcolor="#9999FF">
    <td height="18" bgcolor="#9999FF"><div align="center"><img src="../images/main_template_images/rounded_upper_left-wider-grey.gif" width="18" height="12" align="top"></div></td>
    <td width="734" height="25" valign="middle"><span class="Title_Bar_Date_Volume">&nbsp;</span></td>
    <td height="18" bgcolor="#9999FF"><img src="../images/main_template_images/rounded_upper_right-wider-grey.gif" width="18" height="12" align="top"></td>
  </tr>
  <tr align="center" bgcolor="#9999FF">
    <td colspan="3"><table width="100%" border="0" bgcolor="#FFFFFF">
        <tr>
          <td valign="middle" width="100%" bgcolor="#FFFFFF" colspan="3"><div align="center">
              <table width="100%"  border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td height="6" bgcolor="#FFFFFF"></td>
                </tr>
              </table>
              <table  border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td width="4">&nbsp;</td>
                  <td width="194"><div align="right">
                      <table width="100%"  border="0" cellpadding="0" cellspacing="0">
                        <tr>
                          <td width="102"><div align="right"><span class="style1"><img src="../images/main_template_images/main_logo_hippo_with_lines.gif" width="102" height="61"></span></div></td>
                          <td width="69" nowrap>                            <p align="left" class="Title_Bar_Hippo_Talk"><!-- #BeginLibraryItem "/Library/HippoTalk_JustLikeYourMamma.lbi" -->Just like your <br>
mamma used <br>
to make it!<!-- #EndLibraryItem --></p></td>
                          <td width="16" nowrap>&nbsp;&nbsp;&nbsp;&nbsp;</td>
                        </tr>
                      </table>
                  </div></td>
                  <td width="287"><a href="https://www.qfever.com/"><img src="../images/main_template_images/main_logo_middle_piece_05.gif" width="287" height="61" border="0"></a></td>
                  <td width="173" nowrap><div align="center"><span class="Title_Bar_Medical_Humor">Medical Humor &amp; Satire<br>
                      For Healthcare Professionals</span><br>
                  <span class="Title_Bar_Copyright">&copy; Q Fever! 2000-2005</span></div></td>
                  <td width="5" nowrap>&nbsp;</td>
                </tr>
              </table>
              <table width="100%"  border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td height="6" bgcolor="#FFFFFF"></td>
                </tr>
              </table>
          </div></td>
        </tr>
    </table></td>
  </tr>
  <tr align="center" valign="middle" bgcolor="#9999FF">
    <td height="23" colspan="3"><div align="center"><strong><strong><!-- #BeginLibraryItem "/library/Sublogo_E_Pluribus_Jejunum.lbi" -->
<span class="Title_Bar_Sublogo">&nbsp;&nbsp;<em>E Pluribus Jejunum</em></span>
<!-- #EndLibraryItem --></strong></strong></span></div></td>
  </tr>
  <tr>
    <td height="12" colspan="3"><table width="100%" border="0" cellspacing="0" style="background-image:url(../testing/gradient4.gif)">
        <tr>
          <td height="12" background="../images/main_template_images/gradient4.gif"></td>
        </tr>
    </table></td>
  </tr>
</table>
<table width="770" height="100%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  <tr>
    <td valign="top"><div align="left">
      <table width="100%"  border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="15%" valign="top"><table width="100%"  border="0" cellpadding="7" cellspacing="0">
              <tr>
                <td><!-- #BeginLibraryItem "/Library/MenuBox_CurrentIssue.lbi" -->
                  <table width="100%"  border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td><table width="100%"  border="0" align="center" cellpadding="5" cellspacing="0" bordercolor="#FFFFFF" bgcolor="#CCCCCC">
                          <tr>
                            <td bgcolor="#E6E6E6" class="Index_Sections_Menu">Menu</td>
                          </tr>
                        </table>
                          <table width="100%"  border="0" cellpadding="2" cellspacing="0">
                            <tr>
                              <td class="Index_Menu_Items"><a href="/">Current Issue</a></td>
                            </tr>
                            <tr>
                              <td class="Index_Menu_Items"><a href="../backissues.html">Back Issues</a></td>
                            </tr>
                            <tr>
                              <td class="Index_Menu_Items"><a href="http://www.booksurge.com/author.php3?affiliateID=A000111&accountID=IMPR01633" target="_blank"><em>Q Fever!</em> Book</a></td>
                            </tr>
                            <tr>
                              <td class="Index_Menu_Items"><a href="http://www.cafeshops.com/qfever/" target="_blank"><em>Q Fever!</em> Store</a></td>
                            </tr>
                            <tr>
                              <td class="Index_Menu_Items"><a href="/cgi-bin/spreadcast_2005.cgi">Spread The <em>Q!</em></a></td>
                            </tr>
                            <tr>
                              <td class="Index_Menu_Items"><a href="../support.html">Support The <em>Q!</em></a></td>
                            </tr>
                            <tr>
                              <td class="Index_Menu_Items"><a href="../affiliate.html">Get Paid! </a></td>
                            </tr>
                            <tr>
                              <td class="Index_Menu_Items"><a href="../contactus.html">Contact Us</a></td>
                            </tr>
                        </table></td>
                    </tr>
                  </table>
                <!-- #EndLibraryItem --></td>
              </tr>
            </table> 
			
			<!-- #BeginLibraryItem "/library/Mailing_List_Box.lbi" -->
			<table width="120"  border="0" align="center" cellpadding="2" cellspacing="0" class="Image_Box_Light">
              <tr>
                <td><p align="center" class="Article_Subtitle"><span class="Text_Small_Black"><strong>Mailing List</strong></span><br>
                        <span class="Tiny_Text">New issues, etc.</span></p>
                    <!--
                    <strong>
                    <script src="../issues/20050720/subscribe.js" type="text/javascript"></script>
                    </strong>
                    <script src="../issues/20050720/subscribe.js" type="text/javascript">
              </script>
			  -->
                    <form method="post"  action="../lists/?p=subscribe&amp;id=1" name="subscribeform">
                      <!-- Previous line previously had target="subscribe" -->
                      <table width="100" border="0" cellspacing="0" cellpadding="1" align="center">
                        <tr>
                          <td width="100" colspan="2" align="center" class="Article_Subtitle"><strong> Choose:</strong></td>
                        </tr>
                        <tr>
                          <td width="10" align ="right"><input type="radio" name="htmlemail" value="0" /></td>
                          <td width="90" align ="left"><div class="Tiny_Text">text version</div></td>
                        </tr>
                        <tr>
                          <td width="10" align ="right"><input type="radio" name="htmlemail" value="1" checked></td>
                          <td width="90" align ="left"><div class="Tiny_Text">html version</div></td>
                        </tr>
                        <tr>
                          <td width="100" colspan="2" align="left" class="Tiny_Text"><strong>Email:</strong></td>
                        </tr>
                        <tr valign="top">
                          <td colspan="2" align="left"><div class="Tiny_Text">
                              <input type="text" name="email" value =" " size="13" />
                            </div>
                              <script language="Javascript" type="text/javascript">addFieldToCheck("email","email address");</script></td>
                        </tr>
                        <tr>
                          <td width="100" colspan="2" align="left" class="Tiny_Text"><strong>Confirm Email: </strong>
                                      <tr>
                                        <td colspan="2" align="left" class="attributeinput"><div class="Tiny_Text">
                                            <input type=text name=emailconfirm value="" size="13" />
                                          </div>
                                            <script language="Javascript" type="text/javascript">addFieldToCheck("emailconfirm","Confirm email");</script></td>
                                      </tr>
                                      <tr>
                                        <td height="33" colspan="2" align="left"><input type="hidden" name="list[2]" value=signup />
                                            <font size =" -1">
                                            <input type=submit name="subscribe" value="Subscribe" onClick="return checkform();" />
                                          </font> </td>
                                      </tr>
                      </table>
                    </form>
                    <!-- End Subscribe --></td>
              </tr>
            </table>
			<!-- #EndLibraryItem --><!-- #BeginLibraryItem "/Library/Left_Ad_Block_01.lbi" -->
<table width="100%"  border="0" align="center" cellpadding="5" cellspacing="0">
  <tr>
    <td align="center">  <table width="100%" border="0" cellpadding="5" cellspacing="0" class="Image_Box_Purple">
        <tr>
          <td class="Misc_Text_Small_Light"><div align="center">
            <table cellspacing="0" cellpadding="2">
              <tr>
                <td align="center"><table cellspacing="0" cellpadding="3" class="Image_Box">
                  <tr>
                    <td><strong><a href="http://www.booksurge.com/author.php3?affiliateID=A000111&accountID=IMPR01633" target="_blank"><img src="../images/qfeverbook_small.jpg" width="74" height="110" border="0"></a></strong></td>
                  </tr>
                </table></td>
              </tr>
              <tr>
                <td align="center" class="Misc_Text_Small_11"><a href="http://www.booksurge.com/author.php3?affiliateID=A000111&accountID=IMPR01633" target="_blank"><strong>The <em>Q Fever! </em>Book!</strong><em><br>
                </em></a>                <span class="Text_Small_Purple_Tahoma"><strong>Makes a great gift!</strong></span><br>
only <a href="http://www.booksurge.com/author.php3?affiliateID=A000111&accountID=IMPR01633" target="_blank">$13.99</a> </td>
              </tr>
            </table>
            <strong><a href="http://www.booksurge.com/author.php3?affiliateID=A000111&accountID=IMPR01633" target="_blank">          </a></strong></div></td>
        </tr>
      </table></td>
  </tr>
  <tr>
    <td align="center"><iframe src="http://rcm.amazon.com/e/cm?t=qfevermedichu-20&o=1&p=8&l=as1&asins=1929693133&fc1=000000&=1&lc1=0000ff&bc1=000000&lt1=_blank&IS2=1&f=ifr&bg1=ffffff&f=ifr" width="120" height="240" scrolling="no" marginwidth="0" marginheight="0" frameborder="0">
</iframe></td>
  </tr>
  <tr>
    <td align="center">  <table width="100%"  height="120" border="0" cellpadding="5" cellspacing="0" class="Image_Box">
        <tr>
          <td class="Misc_Text_Small_Light"><div align="center"><a href="http://www.amazon.com/exec/obidos/redirect?link_code=ur2&amp;camp=1789&amp;tag=qfevermedichu-20&amp;creative=9325&amp;path=external-search%3Fsearch-type=ss%26keyword=medical%20humor%26index=blended"><em>More</em> Medical Humor Books!</a><img src="http://www.assoc-amazon.com/e/ir?t=qfevermedichu-20&amp;l=ur2&amp;o=1" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /></div></td>
        </tr>
      </table></td>
  </tr>
  <tr>
    <td align="center"><iframe src="http://rcm.amazon.com/e/cm?t=qfevermedichu-20&o=1&p=6&l=st1&mode=books&search=medical%20humor&fc1=&=1&lc1=&lt1=&f=ifr&bg1=&f=ifr" marginwidth="0" marginheight="0" width="120" height="150" border="0" frameborder="0" style="border:none;" scrolling="no"></iframe>    </td>
  </tr>
  <!--
  <tr>
    <td align="center"><iframe src="http://rcm.amazon.com/e/cm?t=ouijacat0b-20&o=1&p=8&l=as1&asins=1591096928&fc1=000000&=1&lc1=0000ff&bc1=000000&lt1=_blank&IS2=1&f=ifr&bg1=ffffff&f=ifr" width="120" height="240" scrolling="no" marginwidth="0" marginheight="0" frameborder="0">
</iframe>    </td>
  </tr>
  -->
  </table><!-- #EndLibraryItem --></td>
          <td valign="top">            <table width="100%"  border="0" align="center" cellpadding="7" cellspacing="0" bordercolorlight="#FFFFFF" bordercolordark="#FFFFFF" class="Index_Center_Table_Box">
                <tr>
                  <td height="100%"><style type="text/css">
<!--
.style5 {color: #FF0000}
-->
                </style>
                    <table width="100%"  border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td><style type="text/css">
<!--
.style1 {color: #FF0000}
-->
                      </style>
                          <table width="100%"  border="0" align="center" cellpadding="5" cellspacing="0" bgcolor="#CCCCCC">
                            <tr>
                              <td bgcolor="#E6E6E6" class="Index_SectionNames_Center">&nbsp;</td>
                            </tr>
                          </table>
                          <table width="100%"  border="0" cellspacing="0" cellpadding="0">
                            <tr>
                              <td height="3"></td>
                            </tr>
                          </table>
                          <span class="Article_Title">Help Spread <em>Q Fever!</em> </span><br>
                          <span class="Article_Subtitle">Give the gift of the purple hippo!</span><br>
  
                        <p class="Article_Text">Here's a handy tool you can use to spread the word about <em>Q Fever! - Medical Humor &amp; Satire For Healthcare Professionals. </em></p>
                          <p class="Article_Text">First, enter your name and email address, so your friends know who to thank (or who to tell to stop sending stuff like this). </p>
                          <p class="Article_Text">Then, enter the information for up to seven lucky recipients. They'll each receive a personalized greeting with a link to <em>Q Fever!</em> ... and <em>you'll</em> receive the inner satisfaction - indeed, the unbridled joy - of knowing that you've passed <em>Q Fever!</em> along to the people that mean the most to you&#8482;.</p>
                          <form method="POST" action="$SCRIPT_NAME">
          <input type="HIDDEN" name="call_by" value=$ENV{'HTTP_REFERER'}>
          <table border="0" align="center">
            <tr class="Article_Subtitle"> 
              <td width="83" align="right" class="Article_Subtitle">&nbsp;</td>
              <td><strong>Name</strong></td>
              <td><strong>Email Address</strong></td>
            </tr>
            <tr class="Article_Subtitle"> 
              <td width="83" align="right" class="Article_Subtitle"><strong>Your 
                Info:</strong></td>
              <td class="Article_Subtitle"><strong><font size="2"> 
                <input type="TEXT" name="send_name" size="10">
                </font></strong></td>
              <td class="Article_Subtitle"><strong><font size="2"> 
                <input type="TEXT" name="send_email" size="20">
                </font></strong></td>
            </tr>
		    </table>
          <table width="100%"  border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td height="11"></td>
            </tr>
          </table>
          <table border="0" align="center">
            <tr class="Article_Subtitle"> 
              <td width="83" align="right">&nbsp;</td>
              <td><strong>Name</strong></td>
              <td><strong>Email Address</strong></td>
            </tr>		  
		  <!----REPEATING ROWS BEGIN HERE -->
__REQUEST__
# ------------ REPEATING ROWS BEGIN HERE -----------------
    for ($i=1;$i<$MAXNUM+1;$i++)
     {
    print <<__STOP_OF_ROW__;            
          <tr class="Article_Subtitle"> 
            <td width="83" align="right"><strong>Recipient $i:</strong></td>
            <td> 
              <input name="recipname_$i" type="TEXT" size="10">
             </td>
            <td> 
              <input name="recipemail_$i" type="TEXT" size="20">
              </td>
          </tr>
__STOP_OF_ROW__
     }
# ------------ REPEATING ROWS END HERE -----------------
# ------------ END OF REPEATING ROWS AND START OF MESSAGE TABLE BEGINS HERE -----------------            
print <<__REQUEST2__;
		    </table>
          <table width="100%"  border="0" cellspacing="0" cellpadding="0">
		     <tr>
              <td height="11"></td>
            </tr>
          </table>
          <table border="0" align="center">
            <tr> 
		              <td colspan="3"><div align="center"><span class="Article_Subtitle"><strong>And A Message, If You Like:</strong><br>
                          </span>
		                <table width="100%"  border="0" cellspacing="0" cellpadding="0">
                            <tr>
                              <td height="6"></td>
                            </tr>
                          </table>                        
                          <span class="Article_Subtitle">
                            <textarea name="message" wrap=virtual rows=5 cols=37></textarea>
                            <br>
                            </span>
                          <table width="100%"  border="0" cellspacing="0" cellpadding="0">
                              <tr>
                                <td height="6"></td>
                              </tr>
                            </table>
                           
                                </div></td>
                          </tr>
                            </table>
                           <table width="250"  border="0" align="center" cellpadding="0" cellspacing="0">
                             <tr>
                               <td class="Article_Subtitle"><div align="center">
                                   <table width="100%"  border="0" cellpadding="3" cellspacing="0" class="Image_Box_Purple">
                                     <tr>
                                       <td class="Article_Subtitle"><div align="center" class="Text_Small_Purple">After submitting, you'll be returned to the previous page.</div></td>
                                     </tr>
                                   </table>
                                   <p>
                                     <input type="submit" value="Spread It!" name="submit">
                                     <br>
          [Press once only]</p>
                               </div></td>
                             </tr>
                           </table>
                          </form>
                       </p>
                        </td>
                      </tr>
                    </table>
                    <!-- #BeginLibraryItem "/library/Return_To_Index_Block.lbi" -->
                    <table width="100%"  border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td height="12"></td>
                      </tr>
                    </table>
                    <div align="center" class="Send_This_Page"><a href="/cgi-bin/pagecast_2005.cgi">Send this page</a></div>
                    <table  border="0" align="center" cellpadding="0" cellspacing="0">
                      <tr>
                        <td class="Return_To_Index"><a href="../index.html" style="color: #666666">[Return To Index]</a></td>
                      </tr>
                    </table>
                    <table width="100%"  border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td height="12"></td>
                      </tr>
                    </table>
                    <!-- #EndLibraryItem --><!-- #BeginLibraryItem "/Library/More_Stuff_Block.lbi" -->
                    <table width="100%"  border="0" align="center" cellpadding="5" cellspacing="0" bgcolor="#CCCCCC">
                      <tr>
                        <td bgcolor="#E6E6E6" class="Index_SectionNames_Center">More Stuff! </td>
                      </tr>
                    </table>
                    <!-- #BeginLibraryItem "/Library/Spacer_Center_Col_Top.lbi" -->
                    <table width="100%"  border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td height="5"></td>
                      </tr>
                    </table>
                    <!-- #EndLibraryItem -->
                    <div class="Index_More_Stuff_Text"> &nbsp;Get the <strong><a href="http://www.booksurge.com/author.php3?affiliateID=A000111&accountID=IMPR01633" target="_blank"><em>Q Fever!</em></em> Book!</a></strong></strong> <br>
&nbsp;The <a href="http://www.cafeshops.com/qfever/" target="_blank"><strong><em>Q Fever!</em> Store!</strong></a>: T-shirts, caps, mugs, and thongs!<br>
&nbsp;Help <a href="/cgi-bin/spreadcast_2005.cgi"><strong>Spread</strong></a> <em>Q Fever! </em><br>
&nbsp;<a href="../support.html" target="_top"><strong>Support</strong></a> The <em>Q!</em><br>
&nbsp;<a href="../affiliate.html" target="_top"><strong>Make Money</strong></a> With The <em>Q Fever!</em> Affiliate Program!<br>
&nbsp;<a href="../lists"><strong>Subscribe</strong></a> to the <em>Q Fever!</em> Mailing List!<br>
&nbsp;<a href="../contactus.html"><strong>Contact</strong></a> <em>Q Fever!
  <!--
        <a href="" target="_top">&nbsp;Advertise</a> With Q Fever!<br>
        <a href="" target="_top">&nbsp;Postcards &amp; Wallpapers</a></span>
-->
</em></div>
                    <!-- #BeginLibraryItem "/library/Spacer_Center_Col_Bot.lbi" -->
                    <table width="100%"  border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td height="11"></td>
                      </tr>
                    </table>
                    <!-- #EndLibraryItem --><!-- #EndLibraryItem --><!-- #BeginLibraryItem "/Library/Search_Q_Fever_Block.lbi" -->
                    <!-- SiteSearch Google -->
                    <form method="get" action="http://www.google.com/custom" target="google_window">
                      <table border="0" bgcolor="#ffffff">
                        <tr>
                          <td nowrap="nowrap" valign="top" align="left" height="32"><a href="http://www.google.com/"> <img src="http://www.google.com/logos/Logo_25wht.gif"
border="0" alt="Google"></img></a> </td>
                          <td nowrap="nowrap"><input type="hidden" name="domains" value="qfever.com">
                              </input>
                              <input type="text" name="q" size="31" maxlength="255" value="">
                              </input>
                              <input type="submit" name="sa" value="Search">
                              </input>
                              <table>
                                <tr>
                                  <td class="Misc_Text_Small"><input type="radio" name="sitesearch" value="">
              web</td>
                                  <td class="Misc_Text_Small"><input type="radio" name="sitesearch" value="qfever.com" checked="checked">
              qfever.com</td>
                                </tr>
                            </table></td>
                        </tr>
                        <tr valign="top">
                          <td></td>
                          <td nowrap="nowrap"><input type="hidden" name="client" value="pub-5248220292378490">
                              </input>
                              <input type="hidden" name="forid" value="1">
                              </input>
                              <input type="hidden" name="ie" value="ISO-8859-1">
                              </input>
                              <input type="hidden" name="oe" value="ISO-8859-1">
                              </input>
                              <input type="hidden" name="cof" value="GALT:#008000;GL:1;DIV:#336699;VLC:663399;AH:center;BGC:FFFFFF;LBGC:336699;ALC:0000FF;LC:0000FF;T:000000;GFNT:0000FF;GIMP:0000FF;FORID:1;">
                              </input>
                              <input type="hidden" name="hl" value="en">
                              </input>
                          </td>
                        </tr>
                      </table>
                    </form>
                    <!-- SiteSearch Google -->
                    <!-- #EndLibraryItem -->
                    <form method=GET action="http://www.google.com/search"><table width="100%" border="0" align="center">
                          <tr>
                            <td height="50" align="center" bgcolor="#E6E6E6" class="Misc_Text_Medium style4"> Remember: <strong><em>Quality</em></strong> Without The <strong><em>Q</em></strong> Is Just <strong><em>Uality! </em></strong></td>
                          </tr>
                        </table>
                  </form></td></tr>
                <tr>
                  <td height="100%"></td>
                </tr>
            </table></td>
          <td width="135" valign="top" bgcolor="#FFFFFF"><!-- #BeginLibraryItem "/library/Right_Ad_Block_01.lbi" --><table width="100%"  border="0" cellspacing="0" cellpadding="7">
              <tr>
                <td><table width="100%"  border="0" align="center" cellpadding="5" cellspacing="0" bordercolor="#FFFFFF" bgcolor="#CCCCCC">
                  <tr>
                    <td bordercolor="#FFFFFF" bgcolor="#E6E6E6"><div align="center" class="Index_Sections_QsFlashes">&nbsp;</div></td>
                  </tr>
                </table>
                  <table width="100%"  border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td height="14"></td>
                    </tr>
                  </table>
                  <table width="50" height="50"  border="0" cellpadding="0" cellspacing="0">
                    <tr>
                      <td><script type="text/javascript"><!--
google_ad_client = "pub-5248220292378490";
google_ad_width = 120;
google_ad_height = 600;
google_ad_format = "120x600_as";
google_ad_type = "text";
google_ad_channel ="";
google_color_border = "CCCCCC";
google_color_bg = "FFFFFF";
google_color_link = "0000FF";
google_color_url = "008000";
google_color_text = "000000";
//--></script>
                          <script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
                    </script>
                      </td>
                    </tr>
                  </table></td>
              </tr>
            </table>
          <!-- #EndLibraryItem --></td>
        </tr>
      </table>
    </div></td>
  </tr>
  <tr>
    <td height="5%" valign="bottom" bgcolor="#CCCCCC"><div align="left">      
      <table width="100%" border="0" cellpadding="8" cellspacing="0" bgcolor="#FFFFFF">
        <tr valign="middle">
          <td width="30%" bgcolor="#CCCCFF"><div align="center">
              <div align="center" class="Index_Headlines_Subtitles"><font color="#333333">Editor-In-Chief: <a href="../contact.html">M. Furfur, MD</a> | Editor-At-Large: <a href="../contact.html">B. Cereus, MD, PhD</a> <br>
          All rights reserved. &copy; Q Fever!, LLC 2000-2005</font></div>
          </div></td>
        </tr>
      </table>
    </div></td>
  </tr>
</table>
<hr align="center" width="770" noshade>
<table width="770" border="0" align="center" bgcolor="#CCCCCC">
  <tr>
    <td class="Disclaimer"><b>Disclaimer: </b>This is a  medical humor and parody website meant solely for entertainment purposes, and is not intended to recommend or advise regarding the prevention, diagnosis, or treatment of any medical illness or condition. Stories and articles are meant only to provide a brief, fleeting distraction from the wretchedness of reality, and are not intended to be insensitive, callous, or offensive, or to otherwise belittle the plight of those affected with any medical disease, condition, or illness. All names and descriptions of people are fictitious except for those of well-known public figures, who are the subject of satire. Any resemblance to actual persons or events is purely coincidental. <em>Medical Humor is just that: Medical Humor. </em></td>
  </tr>
</table>
<hr width="770" noshade>
</body>
</html>
__REQUEST2__
 }

##################################################################
#  NOTHING TO MESS WITH BEYOND THIS POINT!!!!
##################################################################
sub decode_vars
 {
 $i=0;
  if ( $ENV{'REQUEST_METHOD'} eq "GET")
   {
     $temp=$ENV{'QUERY_STRING'};
   }
   else
    {
      read(STDIN,$temp,$ENV{'CONTENT_LENGTH'});
    }
  @pairs=split(/&/,$temp);
  foreach $item(@pairs)
   {
    ($key,$content)=split(/=/,$item,2);
    $content=~tr/+/ /;
    $content=~s/%(..)/pack("c",hex($1))/ge;
    $content=~s/\012//gs;
    $content=~s/\015/ /gs;
    $fields{$key}=$content;
   }
   if ($fields{'call_by'} eq "")
    {
     $JUMP_TO = $ENV{'HTTP_REFERER'};
    }
   else
    {
     $JUMP_TO = $fields{'call_by'};
    }
}

##################################################################
sub valid_address 
 {
  $testmail = $fields{$recipemail};
  if ($testmail =~ /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/ ||
  $testmail !~ /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/)
   {
     return 0;
   }
   else 
    {
        return 1;
    }
}

sub valid_page
 {
 if (@okaydomains == 0) {return;}
  $DOMAIN_OK=0;                                         
  $RF=$ENV{'HTTP_REFERER'};                             
  $RF=~tr/A-Z/a-z/;                                     
  foreach $ts (@okaydomains)                            
   {                                                    
     if ($RF =~ /$ts/)                                  
      { $DOMAIN_OK=1; }
   }                                                    
   if ( $DOMAIN_OK == 0)                                
     { print "Content-type: text/html\n\n Sorry, cant run it from here....";    
      exit;
     }                                                  
}


##################################################################
sub test_sendmail
 {
  @ts=split(/ /,$MAIL_PROGRAM);
  if ( -e $ts[0] )
   {
    return;
   }
   print "Content-type: text/html\n\n";
   print "<H2>$ts[0] NOTFOUND. PLEASE CHECK YOUR SCRIPT'S MAIL_PROGRAM VARIABLE</H2>";
   exit;
 }

sub do_log
{
open (ZL,">>$LOGFILE");
$date=localtime(time);
for ($i=1;$i<$MAXNUM+1;$i++)
    {
      $recipname="recipname_$i";
      $recipemail="recipemail_$i";
      if ($fields{$recipemail} eq "")
        {
         next;
        }
      if (&valid_address == 0)
        {
         next;
        }
     $logline="$date\|$JUMP_TO\|$fields{'send_email'}\|$fields{$recipemail}\|\n";
     print ZL $logline;
   }
  close(ZL);
}

###################################################################
###################################################################
sub sendmail  {

# error codes below for those who bother to check result codes <gr>

# 1 success
# -1 $smtphost unknown
# -2 socket() failed
# -3 connect() failed
# -4 service not available
# -5 unspecified communication error
# -6 local user $to unknown on host $smtp
# -7 transmission of message failed
# -8 argument $to empty
#
#  Sample call:
#
# &sendmail($from, $reply, $to, $smtp, $subject, $message );
#
#  Note that there are several commands for cleaning up possible bad inputs - if you
#  are hard coding things from a library file, so of those are unnecesssary
#

    my ($fromaddr, $replyaddr, $to, $smtp, $subject, $message) = @_;

    $to =~ s/[ \t]+/, /g; # pack spaces and add comma
    $fromaddr =~ s/.*<([^\s]*?)>/$1/; # get from email address
    $replyaddr =~ s/.*<([^\s]*?)>/$1/; # get reply email address
    $replyaddr =~ s/^([^\s]+).*/$1/; # use first address
    $message =~ s/^\./\.\./gm; # handle . as first character
    $message =~ s/\r\n/\n/g; # handle line ending
    $message =~ s/\n/\r\n/g;
    $smtp =~ s/^\s+//g; # remove spaces around $smtp
    $smtp =~ s/\s+$//g;

    if (!$to)
    {
	return(-8);
    }

 if ($SMTP_SERVER ne "")
  {
    my($proto) = (getprotobyname('tcp'))[2];
    my($port) = (getservbyname('smtp', 'tcp'))[2];

    my($smtpaddr) = ($smtp =~
		     /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/)
	? pack('C4',$1,$2,$3,$4)
	    : (gethostbyname($smtp))[4];

    if (!defined($smtpaddr))
    {
	return(-1);
    }

    if (!socket(MAIL, AF_INET, SOCK_STREAM, $proto))
    {
	return(-2);
    }

    if (!connect(MAIL, pack('Sna4x8', AF_INET, $port, $smtpaddr)))
    {
	return(-3);
    }

    my($oldfh) = select(MAIL);
    $| = 1;
    select($oldfh);

    $_ = <MAIL>;
    if (/^[45]/)
    {
	close(MAIL);
	return(-4);
    }

    print MAIL "helo $SMTP_SERVER\r\n";
    $_ = <MAIL>;
    if (/^[45]/)
    {
	close(MAIL);
	return(-5);
    }

    print MAIL "mail from: <$fromaddr>\r\n";
    $_ = <MAIL>;
    if (/^[45]/)
    {
	close(MAIL);
	return(-5);
    }

    foreach (split(/, /, $to))
    {
	print MAIL "rcpt to: <$_>\r\n";
	$_ = <MAIL>;
	if (/^[45]/)
	{
	    close(MAIL);
	    return(-6);
	}
    }

    print MAIL "data\r\n";
    $_ = <MAIL>;
    if (/^[45]/)
    {
	close MAIL;
	return(-5);
    }

   }

  if ($SEND_MAIL ne "")
   {
     open (MAIL,"| $SEND_MAIL");
   }

    print MAIL "To: $to\n";
    print MAIL "From: $fromaddr\n";
    print MAIL "Reply-to: $replyaddr\n" if $replyaddr;
    print MAIL "X-Mailer: Perl Powered Socket Mailer\n";
    print MAIL "Subject: $subject\n\n";
    print MAIL "$message";
    print MAIL "\n.\n";

 if ($SMTP_SERVER ne "")
  {
    $_ = <MAIL>;
    if (/^[45]/)
    {
	close(MAIL);
	return(-7);
    }

    print MAIL "quit\r\n";
    $_ = <MAIL>;
  }

    close(MAIL);
    return(1);
}
