And save. For example, if you want it on each individual post, then place the
above stuff with your postmetadata content.
You may use your own stylesheet to style the form however you wish: I kept it
as neutral as possible for the most flexibility. However, you want to be *sure*
you add the following (at the very least) to your stylesheet - the "surprise"
area is supposed to be a hidden field to trick spammers, but Firefox sometimes
like to show hidden input fields. So be sure to add the following to your
stylesheet to keep this from happening:
input[type=hidden] { /* for Mozilla - likes to show borders on hidden input fields */
display:none;
}
form#bbSTF input#surprise {
visibility:hidden;
height:0;
width:0;
}
Enjoy!
*/
function bb_STF() {
// draw the form ?>
All fields are required, but you can use secret spy names in place of your own if you are shy
or need to keep a secret. For the record, we DO NOT harvest these emails - we'll never even know
you were here.
";
$thanks .= "Thanks! The notification has been sent.";
$thanks .= "";
// get the Page URL
$pageURL = "http://" . $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
// start the script
foreach($_POST as $k => $v);
$_POST[$k] = htmlentities($v);
isset($_POST['action']) ? $action = $_POST['action'] : $action = '';
isset($_POST['fromname']) ? $fromname = $_POST['fromname'] : $fromname = '';
isset($_POST['fromname_error']) ? $fromname_error = $_POST['fromname_error'] : $fromname_error = '';
isset($_POST['fromemail']) ? $fromemail = $_POST['fromemail'] : $fromemail = '';
isset($_POST['fromemail_error']) ? $fromemail_error = $_POST['fromemail_error'] : $fromemail_error = '';
isset($_POST['toname']) ? $toname = $_POST['toname'] : $toname = '';
isset($_POST['toname_error']) ? $toname_error = $_POST['toname_error'] : $toname_error = '';
isset($_POST['toemail']) ? $toemail = $_POST['toemail'] : $toemail = '';
isset($_POST['toemail_error']) ? $toemail_error = $_POST['toemail_error'] : $toemail_error = '';
isset($_POST['comments']) ? $comments = $_POST['comments'] : $comments = '';
isset($_POST['comments_error']) ? $comments_error = $_POST['comments_error'] : $comments_error = '';
isset($_POST['surprise']) ? $surprise = $_POST['surprise'] : $surprise = '';
isset($_POST['surprise_error']) ? $surprise_error = $_POST['surprise_error'] : $surprise_error = '';
isset($_POST['error']) ? $error = $_POST['error'] : $error = '';
isset($_POST['injection_error']) ? $injection_error = $_POST['injection_error'] : $injection_error = '';
isset($_POST['send']) ? $send = $_POST['send'] : $send = '';
if ($action == "sendmail") {
$find = array("/\r/", "/\n/", "/bcc\:/i", "/Content\-Type\:/i", "/cc\:/i", "/to\:/i", "/http\:/i");
$test_fromname = preg_replace($find, "", $fromname);
$test_toname = preg_replace($find, "", $toname);
$test_comments = preg_replace($find, "", $comments);
if (($fromname == "" ) || ($fromname != "")) {
if (!ereg('^[a-zA-Z\'\.-]', $fromname) || ($fromname != $test_fromname)) {
$fromname_error = "1";
$send = "no";
}
}
if (!ereg('^[-!#$%&\'*+\./0-9=?A-Z^_`a-z{|}~]+'.'@'.'[-!#$%&\'*+\/0-9=?A-Z^_`a-z{|}~]+\.'.'[-!#$%&\'*+\./0-9=?A-Z^_`a-z{|}~]+$', $fromemail) || ereg("'", $fromemail)) {
$fromemail_error = "1";
$send = "no";
}
if (($toname == "" ) || ($toname != "")) {
if (!ereg('^[a-zA-Z\'\.-]', $toname) || ($toname != $test_toname)) {
$toname_error = "1";
$send = "no";
}
}
if (!ereg('^[-!#$%&\'*+\./0-9=?A-Z^_`a-z{|}~]+'.'@'.'[-!#$%&\'*+\/0-9=?A-Z^_`a-z{|}~]+\.'.'[-!#$%&\'*+\./0-9=?A-Z^_`a-z{|}~]+$', $toemail) || ereg("'", $toemail)) {
$toemail_error = "1";
$send = "no";
}
if ($surprise != "") {
$surprise_error = "1";
$send = "no";
}
if ($send == "no") {
$error = "1";
echo "Invalid input was entered, or you left something blank.
";
echo "Go ahead and give it another shot. To help you find your boo-boo, we listed what was wrong below.
";
if ($surprise_error == "1") {echo "Spammy activity was detected. If you feel this was in error, please check your entries and try again.
"; }
if ($fromname_error == "1") { echo "your name was invalid.
"; }
if ($fromemail_error == "1") { echo "The entry for your email was invalid.
"; }
if ($toname_error == "1") { echo "The entry for your friend's name was invalid.
"; }
if ($toemail_error == "1") { echo "The entry for your friend's email was invalid.
"; }
if ($comments_error == "1") { echo "Your messagehas some invalid stuff in it, wanna try again?
"; }
return;
} else {
$subject = "An email from " . $fromname;
$message = nl2br("
$toname,
You have been sent something very special from $fromname.
To see it, please follow this link:
$pageURL
$fromname also sends a personal message:
$comments
");
$message = stripSlashes($message);
$mailheader = "From: $fromname <$fromemail>\nContent-Type: text/html";
mail("$toname <$toemail>", "$subject", "$message", "$mailheader");
}
{
echo $thanks;
return;
}
} // end "action = sendmail" section
} // end "Send to Friend"
?>