Location: PHPKode > projects > WH Community > wh_community/contact.php
<?php require('layout/header.php'); ?>

    <script type="text/javascript">
    	function showSuccessMessage() {
    	showNotification({
    	type : "success",
    	message: "<?php echo $lang['message_send']; ?>"
    	});    
        }
    </script>

<div id="content_wrapper">
    <div class="content"><?php

        if(!isset($_SESSION['signed_in'])) {
        
		echo '<p class="false">' . $lang['just_for_users'] . '!</p>
              <p>' . $lang['you_need_to'] . ' <a href="signin.php">' . $lang['signin_s'] . '</a>.
              - ' . $lang['not_yet'] . ' <a href="signup.php">' . $lang['registered'] . '</a>?</p>';

    		}else{

    		echo '<h1>' . $lang['contact'] . '</h1>';
    		
    		include_once('functions/flood.php');
    	
    		echo '<small>' . $lang['any_questions'] . '?</small><br><br>';
		
		if($_SERVER['REQUEST_METHOD'] != 'POST') {
		
		echo '<form id="contact" name="contact" method="post" action="">
    		  <p><input type="text" name="name" class="fields" size="40" maxlength="70"> <strong>' . $lang['name'] . ' *</strong></p>
    		  <p><input type="text" name="from" class="fields" size="40" maxlength="90"> <strong>' . $lang['e_mail'] . ' *</strong></p>
    		  <p><input type="text" name="homepage" class="fields" size="40" maxlength="100"> <strong>' . $lang['homepage'] . '</strong></p>
    		  <p><input type="text" name="reason" class="fields"size="40" maxlength="100"> <strong>' . $lang['subject'] . ' *</strong></p>
    		  <br>
    		  <p><strong>' . $lang['message'] . ' *</strong><br>
    		  <textarea name="text" cols="40" rows="5" class="fields_text"></textarea></p>
    		  <p><small>' . $lang['spam_protection_question'] . ' *</small><br>
    		  <strong>' . $lang['sum_of'] . ' ' . $random1 . ' + ' . $code . ' =</strong> <input size="5" name="zip" id="Spamschutz" type="text" class="fields"><input type="hidden" name="zip2" value=' . $rand_result . '></p>
    		  <p><label>
    		  <input name="to" type="hidden" value="' . $webmaster . '"></label>
    		  <label>
    		  <input type="submit" name="Senden" value="' . $lang['send'] . '" class="button">
    		  </label></p>
    		  </form>';
		
			}else{
		
			if(sha1($_POST["zip"]) != $_POST["zip2"]) {
		
			echo '<p class="false">' . $lang['invalid_spam'] . '!</p>
			      <p>[ <a href="javascript:history.back();">' . $lang['back'] . '</a> ]</p>';
		
		}else{
		
		$errors = array();
		
		if(isset($_POST['name'])) {
		if(strlen($_POST['name']) > 30) {
		$errors[] = '<p>' . $lang['not_longer_30'] . '.</p>';
		}
		
			}else{
			$errors[] = '<p>' . $lang['fill_in_name'] . '.</p>';
			}
		
		if(isset($_POST['from'])) {
		$from = mysql_escape_string($_POST['from']);  
		
		if(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $from)) {
		$errors[] = '<p>' . $lang['invalid_syntax'] . '.</p>';
		}
		
			}else{
			$errors[] = '<p>' . $lang['fill_in_email'] . '.</p>';
			}
		
		if(isset($_POST['reason'])) {
		if(strlen($_POST['reason']) > 30) {
		$errors[] = '<p>' . $lang['subject_longer_30'] . '.</p>';
		}
		
			}else{
			$errors[] = '<p>' . $lang['fill_in_subject'] . '.</p>';
			}
		
		if(!empty($errors)) {
		
		echo '<p class="false"><u>' . $lang['not_filled_all'] . '</u></p>
		      <p>[ <a href="javascript:history.back();">' . $lang['back'] . '</a> ]</p><br>';
		echo '<ul>';
		
		foreach($errors as $key => $value) {
		echo '<li>' . $value . '</li>'; 
		}
		echo '</ul>';
		
			}else{
		
			$to = $webmaster;
			
			include_once('functions/sendmail.php');
			
			sendmail();
			
			echo "<script type=\"text/javascript\">showSuccessMessage();</script>";
		
        }}}}
		
		echo '<div class="spacer_div">&nbsp;</div>';

		?>
    </div>
</div>

<div id="infobox_wrapper">
    <div class="infobox">
        <?php include('layout/infobox.php'); ?>
    </div>
</div>

<?php require('layout/footer.php'); ?>
Return current item: WH Community