<commit_before><?php
if(isset($_POST['submit'])) {

    // Personal Info
    $email_to = "<EMAIL>";
    $email_subject = "Message from Portfolio";

    // Error
    // function died($error) {
    //     echo "We are very sorry, but there were error(s) found with the form you submitted. ";
    //     echo "These errors appear below.<br /><br />";
    //     echo $error."<br /><br />";
    //     echo "Please go back and fix these errors.<br /><br />";
    //     die();
    // }

    // Validations
    // if(!isset($_POST['name']) ||
    //     !isset($_POST['email']) ||
    //     !isset($_POST['phone']) ||
    //     !isset($_POST['message'])) {
    //     died('We are sorry, but there appears to be a problem with the form you submitted.');
    // }

    // Guest's Info
    $name = $_POST['name']; // required
    $email_from = $_POST['email']; // required
    $phone = $_POST['phone']; // not required
    $message = $_POST['message']; // required

    // $error_message = "WHATATTTT";

    // Error parsing
    // $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
    //
    // if(!preg_match($email_exp,$email_from)) {
    //     $error_message .= 'The Email Address you entered does not appear to be valid.<br />';
    // }
    //
    // $string_exp = "/^[A-Za-z .'-]+$/";
    //
    // if(!preg_match($string_exp,$name)) {
    //     $error_message .= 'The First Name you entered does not appear to be valid.<br />';
    // }
    //
    // if(strlen($message) < 2) {
    //     $error_message .= 'The Comments you entered do not appear to be valid.<br />';
    // }
    //
    // if(strlen($error_message) > 0) {
    //     died($error_message);
    // }

    // Email
    $email_message = "Form details below.\n\n";

    function clean_string($string) {
        $bad = array("content-type","bcc:","to:","cc:","href");
        return str_replace($bad,"",$string);
    }

    $email_message .= "Name: ".clean_string($name)."\n";
    $email_message .= "Email: ".clean_string($email_from)."\n";
    $email_message .= "Phone: ".clean_string($phone)."\n";
    $email_message .= "Message: ".clean_string($message)."\n";

    // Email Headers
    $headers = 'From: '.$email_from."\r\n".
    'Reply-To: '.$email_from."\r\n" .
    'X-Mailer: PHP/' . phpversion();
    mail($email_to, $email_subject, $email_message, $headers);

    // Confirmation Message
    echo "Thank you! I will contact you as soon as possible.";

}
?>
<commit_msg>configured mailer, still returns 405 error<commit_after><?php
if(isset($_POST['submit'])) {

    // Personal Info
    $email_to = "<EMAIL>";
    $email_subject = "Message from Portfolio";

    // Error
    // function died($error) {
    //     echo "We are very sorry, but there were error(s) found with the form you submitted. ";
    //     echo "These errors appear below.<br /><br />";
    //     echo $error."<br /><br />";
    //     echo "Please go back and fix these errors.<br /><br />";
    //     die();
    // }

    // Validations
    // if(!isset($_POST['name']) ||
    //     !isset($_POST['email']) ||
    //     !isset($_POST['phone']) ||
    //     !isset($_POST['message'])) {
    //     died('We are sorry, but there appears to be a problem with the form you submitted.');
    // }

    // Guest's Info
    $name = $_POST['name']; // required
    $email_from = $_POST['email']; // required
    $phone = $_POST['phone']; // not required
    $message = $_POST['message']; // required

    // $error_message = "WHATATTTT";

    // Error parsing
    // $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
    //
    // if(!preg_match($email_exp,$email_from)) {
    //     $error_message .= 'The Email Address you entered does not appear to be valid.<br />';
    // }
    //
    // $string_exp = "/^[A-Za-z .'-]+$/";
    //
    // if(!preg_match($string_exp,$name)) {
    //     $error_message .= 'The First Name you entered does not appear to be valid.<br />';
    // }
    //
    // if(strlen($message) < 2) {
    //     $error_message .= 'The Comments you entered do not appear to be valid.<br />';
    // }
    //
    // if(strlen($error_message) > 0) {
    //     died($error_message);
    // }

    // Email
    $email_message = "Form details below.\n\n";

    function clean_string($string) {
        $bad = array("content-type","bcc:","to:","cc:","href");
        return str_replace($bad,"",$string);
    }

    $email_message .= "Name: ".clean_string($name)."\n";
    $email_message .= "Email: ".clean_string($email_from)."\n";
    $email_message .= "Phone: ".clean_string($phone)."\n";
    $email_message .= "Message: ".clean_string($message)."\n";

    // Email Headers
    $headers = 'From: '.$email_from."\r\n".
    'Reply-To: '.$email_from."\r\n" .
    'X-Mailer: PHP/' . phpversion();
    mail($email_to, $email_subject, $email_message, $headers);

    // Confirmation Message
    echo "Thank you! I will contact you as soon as possible.";

}
?>

{'fraction_non_alphanumeric': 0.21430014138557868, 'fraction_numerical': 0.0038376085639264795, 'mean_word_length': 2.2408376963350785, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 27, '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': '6395007', 'n_tokens_mistral': 1686, 'n_tokens_neox': 1630, 'n_words': 369}