All pastes #221885 Raw Edit

Something

public text v1 · immutable
#221885 ·published 2006-10-25 22:52 UTC
rendered paste body
<?php
			  
// Obtain file upload vars
$fileatt      = $_FILES['file']['tmp_name'];
$fileatt_type = $_FILES['file']['type'];
$fileatt_name = $_FILES['file']['name'];

if (is_uploaded_file($fileatt)) {

  // Add file attachment to the message
  $message .= "--{$mime_boundary}\n" .
              "Content-Type: {$fileatt_type};\n" .
              " name=\"{$fileatt_name}\"\n" .
              //"Content-Disposition: attachment;\n" .
              //" filename=\"{$fileatt_name}\"\n" .
              $data . "\n\n" .
              "--{$mime_boundary}--\n";
}
   if ($_SERVER['REQUEST_METHOD']=="POST"){ 
      foreach($_POST as $key => $val){
         if (is_array($val)){
            $msg.="Item: $key\n";
            foreach($val as $v){
               $v = stripslashes($v);
               $msg.="   $v\n";
            }
         } else {
            $val = stripslashes($val);
            $msg.="$key: $val\n";
         }
      }
      $recipient="contactform@domain.com";
      $subject="domain.com - Form Submission";
      error_reporting(0);
      if (mail($recipient, $subject, $msg)){
         echo nl2br($input);
      } else
         echo "An error occurred and the message could not be sent.";
   } else
      echo "Bad request method";
?>