Skip to content

Instantly share code, notes, and snippets.

@mcnitt
mcnitt / email_form_script_simple.php
Last active August 29, 2015 14:02
PHP: Email Form Submit: Basic PHPMailer Plain Text
<?php
//Email Form Process
if ($_SERVER["REQUEST_METHOD"] == "POST") {
//var_dump($_POST); //testing
// PHP Email Form Sanitizer + SPAM Bot Honeypot
// Email header injection exploit code explained at
// http://www.nyphp.org/phundamentals/8_Preventing-Email-Header-Injection
@mcnitt
mcnitt / .gitignore
Last active August 29, 2015 14:02 — forked from redoPop/.gitignore
Git: .gitignore for WordPress projects
*~
.DS_Store
.svn
.cvs
*.bak
*.bak.*
*.swp
*.swo
*.swm
*.swn
@mcnitt
mcnitt / gist:3dd90befd9a73546e3f2
Last active August 29, 2015 14:02
PHP: Email Form Sanitizer + SPAM Bot Honeypot
// PHP Email Form Sanitizer + SPAM Bot Honeypot
// Email header injection exploit code explained at http://www.nyphp.org/phundamentals/8_Preventing-Email-Header-Injection
// Add hidden honeypot div to your form
foreach( $_POST as $value ){
if (stripos($value, 'Content-Type:') !== FALSE || !empty($_POST["spam_bot_honeypot"])) {
echo "There was a problem with the information you entered.";
exit;
}
}
<!-- SPAM Bot Honey Pot -->