[headertop]
<?  $pagetype = "other"; ?>
<?=$doctype?>
<meta name="keywords" content="contact, [metakeywords]">
<meta name="description" content="[metadescription]">
<title>Contact - <?=$sitename?></title>
<? include('header.php'); ?>
<div class="posttitle"><h2>Contact</h2></div>
<div class="postcontent">
[contactcontent]
</div>
<? if($_POST) {
      $message       = $_REQUEST['message'];
      $password      = $_REQUEST['password'];
      $random_string = $_REQUEST['random'];
      if (!$captchas->validate ($random_string))
      { echo '<div class="message">The current CAPTCHA has previously been used. Please try again.</div>'; }
      elseif (!$captchas->verify ($password))
      { echo '<div class="message">You entered the wrong captcha. Please try again.</div>'; }
      else
      {
         $EmailFrom = trim(stripslashes($_POST['email']));
         $EmailTo = $mail;
		 $Site = $sitename;
    	 $Url = trim(stripslashes($_POST['url']));
         $Subject =  '[' . $sitename . '] ' . trim(stripslashes($_POST['subject']));
         $Name = trim(stripslashes($_POST['name'])); 
         $Email = trim(stripslashes($_POST['email'])); 
         $Message = trim(stripslashes($_POST['message'])); 
         $Body = "Date: " . date("F j, Y, g:i a") . "\n" . "Name: " . $Name . "\n" . "Email: " . $Email . "\n" . "Website: " . $Url . "\n" . "Message: " . $Message . "\n";
         $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");
         if ($success){
            print "<div class=\"message success\">Success : Your email was sent succesfully</div>";
         }
         else {
            print "<div class=\"message\">Error : Your email was not sent</div>";
         }
      }
   } ?>

<div id="contact-area">			
   <form method="post" action="">
      <input type="hidden" name="random" value="<?= $captchas->random () ?>">
      <div class="label"><b>Subject:</b></div><div class="inputbox">
         <select name="subject">
            <option value="Comment">Comment</option>
            <option value="Question">Question</option>
            <option value="Purchase Ad Space">Purchase Ad Space</option>
         </select>
      </div><div class="clr"></div>
      <div class="label"><b>Name:</b></div><div class="inputbox"><input type="text" name="name"></div><div class="clr"></div>
      <div class="label"><b>Email:</b></div><div class="inputbox"><input type="text" name="email"></div><div class="clr"></div>
      <div class="label"><b>Website URL:</b></div><div class="inputbox"><input type="text" name="url"></div><div class="clr"></div>
      <div class="label"><b>Message:</b></div><div class="inputbox"><textarea name="message" rows="20" cols="20"></textarea></div><div class="clr"></div>
      <div class="captcha"><b>Enter Captcha:</b></div>
      <div class="inputbox"><?= $captchas->image () ?><input name="password" size="6">
      <input type="submit" name="submit" value="Submit" class="submit-button"></div>
   </form>		
   <div class="clr"></div>
</div>

<? include('footer.php'); ?>
