andierue Posted October 15, 2012 Share Posted October 15, 2012 keep getting this in my code Warning: preg_match() [function.preg-match]: Unknown modifier 'd' in /home/content/52/9922952/html/sg_contact_content/contact_i51contact.php on line 38 <?php /* This PHP form mailing script created by SiteGrinder 3.1.2 s_239 http://www.medialab.com/sitegrinder3 */ function stripFormSlashes($arr) { if(!is_array($arr)) { return stripslashes($arr); } else { return array_map('stripFormSlashes', $arr); } } if(get_magic_quotes_gpc()) { $_POST = stripFormSlashes($_POST); } if(($_POST['email']=="")) { echo "<html><body><p>The following fields are <strong>required</strong>.</p><ul>"; if($_POST['email'] == ""){ echo "<li>*Email</li>"; } echo "</ul><p>Please use your browsers <a href=\"javascript:history.back();\">Back</a> button and fill out these fields.</p></body></html>"; } else { $message = ""; $message .= "Name: " . htmlspecialchars($_POST['name'], ENT_QUOTES) . "<br>\n"; $message .= "*Email: " . htmlspecialchars($_POST['email'], ENT_QUOTES) . "<br>\n"; $message .= "Inquiring: " . htmlspecialchars($_POST['inquiring'], ENT_QUOTES) . "<br>\n"; $message .= "Comments: " . htmlspecialchars($_POST['comments'], ENT_QUOTES) . "<br>\n"; $lowmsg = strtolower($message); $injection_strings = array ( "content-type:","charset=","mime-version:","multipart/mixed","bcc:","cc:"); foreach($injection_strings as $suspect) { if((preg_match("/$suspect/",$lowmsg)) || (preg_match("/$suspect/", strtolower($_POST['name']))) || (preg_match("/$suspect/", strtolower($_POST['email'])))) { die ( 'Illegal Input. Go back and try again. Your message has not been sent.' ); } } $headers = "MIME-Version: 1.0\r\nContent-type: text/html; charset=iso-8859-1\r\n"; $headers .= "From: \"" . $_POST['name'] . "\" <" . $_POST['email'] . ">\r\n"; $headers .= "Reply-To: " . $_POST['email'] . "\r\n"; $message = utf8_decode($message); mail("andierue@yahoo.com", "Authentic Health Inquiry", $message, $headers); header("Location: http://www.authentichealthbykate/thank-you.html"); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/269505-what-is-warning-preg_match-functionpreg-match-unknown-modifier-d/ Share on other sites More sharing options...
ManiacDan Posted October 15, 2012 Share Posted October 15, 2012 You need to use preg_quote when you're building your list of suspects. There's a slash in one of them. Quote Link to comment https://forums.phpfreaks.com/topic/269505-what-is-warning-preg_match-functionpreg-match-unknown-modifier-d/#findComment-1385404 Share on other sites More sharing options...
andierue Posted October 16, 2012 Author Share Posted October 16, 2012 what do you mean? how do i do this? what is the correct coding for my form? Quote Link to comment https://forums.phpfreaks.com/topic/269505-what-is-warning-preg_match-functionpreg-match-unknown-modifier-d/#findComment-1385410 Share on other sites More sharing options...
requinix Posted October 16, 2012 Share Posted October 16, 2012 There's nothing in there that actually needs regular expressions. Use strpos instead of preg_match(). Quote Link to comment https://forums.phpfreaks.com/topic/269505-what-is-warning-preg_match-functionpreg-match-unknown-modifier-d/#findComment-1385440 Share on other sites More sharing options...
andierue Posted October 16, 2012 Author Share Posted October 16, 2012 THANKS SO MUCH requinix--you did it!!!! Quote Link to comment https://forums.phpfreaks.com/topic/269505-what-is-warning-preg_match-functionpreg-match-unknown-modifier-d/#findComment-1385446 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.