I’m using a pre-made contact form I found online. It generates an “Invalid characters” error whenever sending a message containing “that’s” instead of “thats”, “can’t” instead of cant, etc.
How can I remedy this?
…Thanks:
[php]
<?php #This line must remain here. Thankyou. 'Hacker Fighter' PHP contact form V 1.1. Copyright 2011 Joshua Luther Hunt-Smith, all rights reserved. Project page URL: servertosite.com/php-contact-forms-open-source hacker-fighter.html This project is released under the BSD license: creativecommons.org/licenses/BSD/ function mailio($chk){ if(preg_match('/^[\w.-]+@[\w.-]+\.([\w.]{2,10})\z/',$chk) && strlen($chk) < 70) {;}else if($chk===''){die('Email address input left empty. Please go back and put in your email address (!)
');}else{die('Invalid email address entered. Please go back and fix it before sending (!)
');}} function texti($zn){ if(!preg_match('/^([\w-\s]+)\z/',$zn) && strlen($chk) < 70){die('Invalid characters entered in a text/number field or else text exceeds 70 character limit (Note: The main message text area has a much larger 20000 character limit). Please go back and fix before sending (!)
');}} function txar($xa){ if(!preg_match('/^([\w$&!?.,-\s\:\/]+)\z/',$xa)){die('Invalid characters ( # @ ^ ' " \ * = ; % < > ` ~ + ) entered in text area (for example if you wrote the word that's take out the '). Please go back and fix, Then click send (!)
');}} $subject= $_SERVER['HTTP_HOST']; $sbot= $_POST['text']; $name= $_POST['name']; $email= $_POST['email']; $deps= $_POST['whd']; $msg= $_POST['message']; //The list of email addresses shown below need to be changed to your receiving email addresses, please only change between the two ' ' in each instance. if you want more or less email addresses, copy or remove the whole line that says case 3 and either paste it below case 3, but rename it as case 4, you can repeat this for as many as you want, or to remove just leave it out the line you removed. Just remember that your corrsponding inputs in the contact interface will need to match and have more options and numerically numbered values added or deleted. switch($deps){ case 1:$you='[email protected]';break; case 2:$you='[email protected]';break; case 3:$you='[email protected]';break; default:die('Hacking Attempted or a Processing Error Occured
');} if($sbot===''){$sbot;}else{die('You filled in an input, that was supposed to remain blank as an anti spam measure. Go back and fill in only labeled inputs (!)
');} if(strlen($msg) > 20000){die('20000 character text limit exceeded in message field, please go back and shorten message (!)
');} mailio($email); if($name===''){die('You left the name field empty. Please go back and check that all fields are filled out, then send (!)
');}else{texti($name);} if($msg===''){die('You didn\'t fill in a message. Please go back and check that all fields are filled out, then send (!)
');}else{txar($msg);} $br= nl2br($msg); $mx=<<<cbName:
$nameEmail:
$emailMessage:
$br cb; $hdrs = "From:$email\r\n"; $hdrs .= 'Content-type: text/html; charset=utf-8' . "\r\n"; mail($you,$subject,$mx,$hdrs); echo 'Thankyou. Your message has been sent
'; ?>[/php]