<? if ($allowcomments == "1") { ?>
<div class="posttitle commenttitle"><h2>Private Comments</h2></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;
         $Subject = '[' . $sitename . '] Comment: "[cleantitle]"';		 
    	 $Url = trim(stripslashes($_POST['url'])); 
         $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"><strong>Name:</strong></div><div class="inputbox">	<input type="text" name="name"></div><div class="clr"></div>
      <div class="label"><strong>Email:</strong></div><div class="inputbox">	<input type="text" name="email"></div><div class="clr"></div>
      <div class="label"><strong>Website URL:</strong></div><div class="inputbox">	<input type="text" name="url"></div><div class="clr"></div>
      <div class="label"><strong>Message:</strong></div><div class="inputbox">	<textarea name="message" rows="20" cols="20"></textarea></div><div class="clr"></div>
      <div class="captcha"><strong>Enter Captcha:</strong></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>
<? } ?>