View Single Post
Old 11-18-2008, 05:09 PM   #11 (permalink)
codefreek
Super Moderator
Inquisitive 
 
codefreek's Avatar
 
Join Date: Sep 2007
Location: Near you.
Posts: 791
Thanks: 241
codefreek is on a distinguished road
Default

i have put the functions in it's own file so it looks more clean..

PHP Code:
<?php
error_reporting
(E_ALL);
include 
'sm_functions.php';
if(isset(
$_POST['submit']))
    {
$email $_POST['email'];
$message $_POST['message'];
$bottest $_POST['leave_blank'];

    if(
strlen($email)<1
    {
        exit(
"</br>You did not put in you're email!");
    }
    if(
strlen($message)<1
    {
        exit(
"</br>You forgot to write a message");
    }
    if(
strlen($bottest)>1
    {
        exit(
"</br>Nice try!");
    }

/* this will do the check if the script has asked for $_REQUEST['email'] */

    
if (isset($_REQUEST['email']))
    {
    
$mailcheck spamcheck($_REQUEST['email']);

    if (
$mailcheck==FALSE)
  
    {

    echo 
"Invalid input<br />";

    }

else

    {

/* func_check_email */

    
if(is_valid_email($email))

    {

  
$email $_REQUEST['email'] ;
  
$message strip_tags($_REQUEST['message']) ; 

  
mail"mailto@gmail.com""Mail From Site By User!",
    
$message"From: $email);
  print 
"Thank you for taking an interest in mysite.com";

    }

else

    {

  print 
"please post your real email";
    
    }

}
}
}
?>


<form method="post" action="sendmail.php">
  Email: <input name="email" type="text" /><br />
  Message:<br />
  <textarea name="message" rows="10" cols="30">
  </textarea><br />
<div style='display:none;visibility:hidden;'>
    <input type='text' name='leave_blank' id='leave_blank'>
</div>
  <input type="submit" name="submit" value="submit"/>
</form>
codefreek is offline  
Reply With Quote