Tell A Friend
5)
{
return false;
}; // no sub domains, no more than 4 dots in url
if (count(explode('/',$sendURL))>6)
{
return false;
}; // cannot contain more than 4 slashes
if (strstr($sendURL, $baseURL) == false)
{
return false;
}; // must contain the base URL
if (strstr($sendURL, '?') == true)
{
return false;
}; // cannot contain any '?' marks
if (strstr($sendURL, '&') == true)
{
return false;
}; // cannot contain any '&' marks
return true;
};
function validatePost($senderName, $senderEmail, $recipientName, $recipientEmail)
{
if ((!validEmail($senderEmail))||(is_null($senderEmail)))
{
return false;
};
if ((!validEmail($recipientEmail))||(is_null($recipientEmail)))
{
return false;
};
if ($senderName == "")
{
return false;
}
if ($recipientName == "")
{
return false;
};
return true;
};
if (($_SERVER['REQUEST_METHOD'] == 'POST')&&($_REQUEST['action'] == 'send'))
{
$success = false;
if ($_POST['productDesc'] !== "")
{
$product = escape($_POST['productDesc']);
}
else
{
$product = "website";
};
if (validateURL($_POST['sendURL'], $baseURL))
{
$url = $_POST['sendURL'];
}
else
{
$url = $baseURL;
};
if (validatePost($_POST['senderName'], $_POST['senderEmail'], $_POST['recipientName'],$_POST['recipientEmail']))
{
/* actually send the message */
$sendmail_path = "/usr/sbin/sendmail -oi -t";
$subject = "I saw this ".$product." at ".$baseURL." and thought of you...";
$mail_to = escape($_POST['recipientName'])." <".escape($_POST['recipientEmail']).">";
$msg = "Hi ".escape($_POST['recipientName']).", \r\n".escape($_POST['senderName'])." was browsing our website and wanted to send you a link. \r\n You can find our ".$product." at: ".$url.".\r\n\r\nJust so you know, we haven't added you to a mailing list. We just used your details to send you this message.\r\n\r\nEnjoy the site!\r\nSincerely, ".$baseURL;
$from = escape($_POST['senderName'])." <".escape($_POST['senderEmail']).">";
/*
Print("
Please try again. If the problem persists, please let us know."; } } else { $message .= "We couldn't send the message because some information was missing or incomplete.
please fill in all the boxes and try again"; }; }; if ($message) { print(""); }; ?>
from: ".escape($_POST['senderName'])." [".escape($_POST['senderEmail'])."] to: ".escape($_POST['recipientName'])." [".escape($_POST['recipientEmail'])."]
"); Print("subject: ".$subject."
"); Print("message: ".$msg."
"); */ if (@mail($mail_to, $subject, $msg, "From: $from\nX-Mailer: PHP/ . $phpversion()", "-f $from")) { $message .= "Thanks. We sent an email to ".escape($_POST['recipientName'])." on your behalf, linking them to ".$url; $success = true; } else { $message .= "Oops! It looks like our website couldn't send your message.Please try again. If the problem persists, please let us know."; } } else { $message .= "We couldn't send the message because some information was missing or incomplete.
please fill in all the boxes and try again"; }; }; if ($message) { print(""); }; ?>
| Use this form to send a link to our site to a friend. |




