<commit_before><?php
if($_POST['honeypot'] != ''){
   die("You spammer!");
}
if(!isset($_POST['submit']))
{
  //This page should not be accessed directly. Need to submit the form.
  echo "error; you need to submit the form!";
}

$name = $_POST['name'];
$visitor_email = $_POST['email'];
$ip = $_SERVER['REMOTE_ADDR'];

//Validate first
if(empty($name)||empty($visitor_email)) 
{
    echo "Oops! We really need you to fill out your name and email.";
    exit;
}

if (!filter_var($visitor_email, FILTER_VALIDATE_EMAIL))
{
    echo "Oops! Please enter a valid email.";
    exit;
}

if(IsInjected($visitor_email))
{
    echo "Oops! Please enter a valid email.";
    exit;
}

$email_from = '<NAME>';
$email_subject = "All About Me!";
$email_body = "$name wants more information. You better reach out to them!\n".
              "Name: ".$name."\n"
             ."Email: ".$visitor_email."\n"
             ."Contacted you from ip address: ".$ip."\n";
    
$to = "<EMAIL>";
$headers = "From: $email_from \r\n";
$headers .= "Reply-To: $visitor_email \r\n";
//Send the email!
mail($to,$email_subject,$email_body,$headers);
//done. redirect to thank-you page.<commit_msg>Update send_form.php to include better email validation<commit_after><?php
if($_POST['honeypot'] != ''){
   die("You spammer!");
}
if(!isset($_POST['submit']))
{
  //This page should not be accessed directly. Need to submit the form.
  echo "error; you need to submit the form!";
}

$name = $_POST['name'];
$visitor_email = $_POST['email'];
$ip = $_SERVER['REMOTE_ADDR'];

//Validate first
if(empty($name)||empty($visitor_email)) 
{
    echo "Oops! We really need you to fill out your name and email.";
    exit;
}

if (filter_var($visitor_email, FILTER_VALIDATE_EMAIL) === false)
{
    echo "Oops! Please enter a valid email.";
    exit;
}

if(IsInjected($visitor_email))
{
    echo "Oops! Please enter a valid email.";
    exit;
}

$email_from = '<NAME>';
$email_subject = "All About Me!";
$email_body = "$name wants more information. You better reach out to them!\n".
              "Name: ".$name."\n"
             ."Email: ".$visitor_email."\n"
             ."Contacted you from ip address: ".$ip."\n";
    
$to = "<EMAIL>";
$headers = "From: $email_from \r\n";
$headers .= "Reply-To: $visitor_email \r\n";
//Send the email!
mail($to,$email_subject,$email_body,$headers);
//done. redirect to thank-you page.
{'fraction_non_alphanumeric': 0.1817798397300717, 'fraction_numerical': 0.0, 'mean_word_length': 3.6328125, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1419082', 'n_tokens_mistral': 819, 'n_tokens_neox': 812, 'n_words': 234}