';
$name_from = $_POST['name_from'];
$email_from = $_POST['email_from'];
$name_to = $_POST['name_to'];
$email_to = $_POST['email_to'];
$msg = nl2br(strip_tags($_POST['msg']));
$n_friends = count($name_to);
$error = 0;
if ( empty($name_from) ) { echo " - Full your name
"; $error ++; }
if ( empty($email_from) ) { echo " - Full your email
"; $error ++; }
if ( !email($email_from)) { echo " - Full correctly your email
"; $error ++; }
if ( ($n_friends == 1) and (empty($email_to[0])) ) { echo " - Full your friends
"; $error ++;}
if ( $error != 0 ) { echo ' - Go back'; } else {
echo 'Thank\'s '.$name_from.' to invite your friends to vistit our website.
';
$subject = 'Indication';
$from = ''.$name_from.'< '.$email_from.' >';
for($i=0;$i<$n_friends;$i++){ $x = $i + 1;
if ((empty($name_to[$i])) or (empty($email_to[$i]))) { $this_mail = 'Don\'t send'; $this_status = 0; } else { $this_mail = 'Email sended correctly'; $this_status = 1;}
if (!email($email_to[$i])) { $this_mail = 'Don\'t send'; }
echo "$x - $name_to[$i] - $this_mail
";
if ($this_status == 0 ) { } else {
$email = $email_to[$i];
$msg_email = "Hello $name_to[$i], your friend $name_from send you a invite to visit our website and write this:
$msg
www.eletronicparty.com";
@ mail ($email, $subject, $msg_email, "From: $from\nContent-type:text/html;charset=ISO-8859-1;MULTIPART/related");
}
} // close for
} // close else send email
echo '
';
} // close if status==result
?>
Write in this box a message to your friend(s).