<?php
/*
 ########################################################################
#                                                                        #
#           Version 4       /                        /   /               #
#          -----------__---/__---__------__----__---/---/-               #
#           | /| /  /___) /   ) (_ `   /   ) /___) /   /                 #
#          _|/_|/__(___ _(___/_(__)___/___/_(___ _/___/___               #
#                       Free Content / Management System                 #
#                                   /                                    #
#                                                                        #
#                                                                        #
#   Copyright 2005-2006 by webspell.org                                  #
#                                                                        #
#   visit webSPELL.org, webspell.info to get webSPELL for free           #
#   - Script runs under the GNU GENERAL PUBLIC LICENSE                   #
#   - It's NOT allowed to remove this copyright-tag                      #
#   -- http://www.fsf.org/licensing/licenses/gpl.html                    #
#                                                                        #
#   Code based on WebSPELL Clanpackage (Michael Gruber - webspell.at),   #
#   Far Development by Development Team - webspell.org                   #
#                                                                        #
#   visit webspell.org                                                   #
#                                                                        #
 ########################################################################
*/

eval ("\$title_contact = \"".gettemplate("title_contact")."\";");
echo $title_contact;

if($_POST["action"] == "send") {
  $subject = trim(stripslashes($_POST['subject']));
  $text = trim(stripslashes($_POST['text']));
  $name = trim(stripslashes($_POST['name']));
  $from = trim(stripslashes($_POST['from']));
	$CAPCLASS = new Captcha;
	if(!$CAPCLASS->check_captcha($_POST['captcha'], $_POST['captcha_hash'])) $fehler[] = "The security code was wrong!";
  if(!$name) $fehler[] = "You have to enter your name.";
  if(!$subject) $fehler[] = "You have to enter a subject.";
  if(!$text) $fehler[] = "Whats you message?";
  if(!$from) $fehler[] = "Please enter your mail adress.";
  if(!count($fehler)) {
  	$header="From:$from\n";
  	$header .= "Reply-To: $from\n";
  	$header.="Content-Type: text/html";
    mail($admin_email, $subject, 'This mail was send over your webSPELL - Website (IP '.$ip.'): '.$hpurl.'<br><br>'.clearfromtags($text), $header);
    redirect('index.php?site=contact','Your message was send successfully.');
    unset($name);
    unset($from);
    unset($text);
    unset($subject);
  } else {
    echo '<table width="100%" border="0" cellspacing="1" cellpadding="2" bgcolor="'.$border.'">
     <tr bgcolor="'.$bghead.'"> 
      <td class="title">&nbsp; &#8226; Contact</td>
     </tr>
     <tr><td bgcolor="'.$pagebg.'"></td></tr>
     <tr bgcolor="'.$bg1.'">
      <td><table width="100%" border="0" cellspacing="0" cellpadding="2">
       <tr>
        <td><b>There are some problems:</b><br><br>
        <ul><li>'.implode('<li>',$fehler).'</ul><br>
        <center>[ <b><a href="javascript:history.back()">back to formular</a></b> ]</center><br></td>
       </tr>
      </table></td>
     </tr>
    </table>';
  }
} else{

$bg1 = BG_1;

$CAPCLASS = new Captcha;
$captcha = $CAPCLASS->create_captcha();
$hash = $CAPCLASS->get_hash();
$CAPCLASS->clear_oldcaptcha();

eval ("\$contact = \"".gettemplate("contact")."\";");
echo $contact;
}
?>