This is absolute magic. Props
to this
site and its author
<?php
if ($_SERVER['REQUEST_METHOD']=="POST"){
if (strpos($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST'])>7
||
!strpos($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST']))
die("Bad referer");
$msg="Values submitted by the user:\n";
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="me@myaddress.com";
$subject="Form submission";
error_reporting(0);
if (mail($recipient, $subject, $msg)){
echo "<h1>Thank you</h1><p>Message
successfully sent:</p>\n";
echo nl2br($input);
} else
echo "An error occurred and the message could not be
sent.";
} else
echo "Bad request method";
?>
|
|
Blackcomb.ca
My little corner of the web
- Home
- Josh
- Work
- Linux
"The secret to creativity is knowing how to
hide your sources."
A. Einstein
NEWS:
New site
|