All pastes #32848 Raw Edit

contact_form

public text v1 · immutable
#32848 ·published 2005-12-07 22:00 UTC
rendered paste body
--- plugins/function.contact_form.php  2005-11-04 14:51:13.000000000 -0700
+++ plugins/function.contact_form.php   2005-12-07 14:58:57.000000000 -0700
@@ -37,6 +37,10 @@
        if (!empty($_POST['message'])) $message = trim($_POST['message']);
 
        if($_SERVER['REQUEST_METHOD']=='POST'){
+                $name = sanitize ($name);
+                $email = sanitize ($email);
+                $subject = sanitize ($subject);
+
                $extra = "From: $name <$email>\r\nReply-To: $email\r\n";
                echo '<div class="contactMessage"';
                echo ($style)?' style="font-weight: bold; color: red;"':'';
@@ -111,4 +115,8 @@
        return true;
 }
 
+function sanitize($content) {
+         return str_replace(array("\r", "\n"), "", $content);
+}
+
 ?>