include("config_somno_getupfresh.php");
if(!isset($_GET['js']) || $_GET['js'] == ""){
$link = $url.$_GET['id'];
}
else if($_GET['js'] == "on"){
$link = $_GET['id'];
}
$link = str_replace(" ","+", $link); // get rid of spaces
if(!isset($_POST['action']) || $_POST['action'] == ""){
if(!isset($link)){
print "No Link Specified";
}
else{
printpage("","","","");
}
}
else if($_POST['action'] == "submit"){
$send = true;
function is_valid_email($sender_mail) {
if(ereg("([[:alnum:]\.\-]+)(\@[[:alnum:]\.\-]+\.+)", $sender_mail)) {
return 0;
}
else{
return 1;
}
}
$admin_mail = $_POST['admin_mail'];
$sender_mail = $_POST['sender_mail'];
$friend_mail = $_POST['friend_mail'];
$sender_name = $_POST['sender_name'];
$optional_message = $_POST['optional_message'];
$link = $_POST['link'];
$js = $_POST['js'];
$id = $_POST['id'];
$s_emailvalid = is_valid_email($sender_mail); // check email
$f_emailvalid = is_valid_email($friend_mail); // check email
$emsg = "There were errors in your form:
\n";
if ($sender_name == ""){
$emsg .= "Please enter your name
\n";
$send = false;
}
if ($sender_mail == "" || $s_emailvalid == 1){
$emsg .= "Please enter your valid email address
\n";
$send = false;
}
if ($friend_mail == "" || $f_emailvalid == 1){
$emsg .= "Please enter your friends valid email address
\n";
$send = false;
}
if($send){
$recipient = "$friend_mail";
$message .= "$sender_name wanted to share the following link with you:\n$link\n\n";
if($optional_message != ""){
$message .= "They added this message:\n$optional_message\n\n";
}
$message .= "Send Page - © http://www.getupfresh.com/index.html";
$headers = "From: $sender_name <$sender_mail>\r\nReply-To: $sender_mail\r\n";
mail ($admin_mail,$recipient, $send_subject, $message, $headers);
if($auto_responder == "yes"){
$recipient2 = "$sender_name <$sender_mail>";
$subject2 = "$thankyousubject";
$message2 = "$thankyoumessage\n\n$your_website\n$admin_mail\n\n» Note: This is an automated response, please do not reply to this\n\n";
$message2 .= "Send Page - © http://www.getupfresh.com/index.html";
$headers2 = "From: $your_website <$admin_email>\r\nReply-To: $admin_mail\r\n";
mail ($recipient2, $subject2, $message2, $headers2);
}
printthanks($sender_name,$friend_mail,$link);
exit;
}
else if(!$send){
printpage($admin_mail,$sender_name,$sender_mail,$friend_mail,$emsg);
}
}
else{
printpage("","","","");
}
function printpage($sender_name,$sender_mail,$friend_mail,$errors){
include("config_somno_getupfresh.php");
global $link, $id, $js;
?>