dinsdag 22 december 2009
Welcome to this Tell-a-Friend Offer
Sorry for Suddenly
'Popping-Up' like this,
It's just that I would like to show you a way how
you can get 'The VISION eBook' for FREE!!!
Abonneren op:
Posts (Atom)
//config file
include"config.php";
//validating email
function checkEmail($email) {
// First, we check that there's one @ symbol, and that the lengths are right
if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $email))
{
// Email invalid because wrong number of characters in one section, or wrong number of @ symbols.
return false;
}
// Split it into sections to make life easier
$email_array = explode("@", $email);
$local_array = explode(".", $email_array[0]);
for ($i = 0; $i < sizeof($local_array); $i++)
{
if (!ereg("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$", $local_array[$i]))
{
return false;
}
}
if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1]))
{ // Check if domain is IP. If not, it should be valid domain name
$domain_array = explode(".", $email_array[1]);
if (sizeof($domain_array) < 2)
{
return false; // Not enough parts to domain
}
for ($i = 0; $i < sizeof($domain_array); $i++)
{
if (!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]+))$", $domain_array[$i]))
{
return false;
}
}
}
return true;
}
//end
$mail_body=$_POST['mail_body'];
$mail_subject=$_POST['subject'];
//referer
$ref = $_SERVER['HTTP_REFERER'];
//values from form
$your_email=$_POST['your_email'];
$your_name=$_POST['your_name'];
$friend1_name=$_POST['friend1_name'];
$friend1_email=$_POST['friend1_email'];
$friend2_name=$_POST['friend2_name'];
$friend2_email=$_POST['friend2_email'];
$friend3_name=$_POST['friend3_name'];
$friend3_email=$_POST['friend3_email'];
$friend4_name=$_POST['friend4_name'];
$friend4_email=$_POST['friend4_email'];
$friend5_name=$_POST['friend5_name'];
$friend5_email=$_POST['friend5_email'];
//setting array to be compare
$emails= array("$friend1_email","$friend2_email","$friend3_email","$friend4_email","$friend5_email");
//friend1
if($friend1_email != $friend2_email && $friend1_email != $friend3_email && $friend1_email != $friend4_email && $friend1_email != $friend5_email)
{ $match="no"; } else { $match="yes"; }
//friend2
if($friend2_email != $friend1_email && $friend2_email != $friend3_email && $friend2_email != $friend4_email && $friend2_email != $friend5_email)
{ $match="no"; } else { $match="yes"; }
//friend3
if($friend3_email!=NULL)
{
if($friend3_email != $friend1_email && $friend3_email != $friend2_email && $friend3_email != $friend4_email && $friend3_email != $friend5_email) { $match="no"; } else { $match="yes"; }
}
//friend4
if($friend4_email!=NULL)
{
if($friend4_email != $friend1_email && $friend4_email != $friend2_email && $friend4_email != $friend3_email && $friend4_email != $friend5_email) { $match="no"; } else { $match="yes"; }
}
//friend5
if($friend5_email!=NULL)
{
if($friend5_email != $friend1_email && $friend5_email != $friend2_email && $friend5_email != $friend3_email && $friend5_email != $friend4_email) { $match="no"; } else { $match="yes"; }
}
//replacing
$search = array('[friend_name]', '[website]', '[your_name]');
if($your_email!=NULL && $your_name!=NULL && $friend1_name!=NULL && $friend1_email!=NULL && $friend2_email!=NULL && $friend2_name!=NULL && $mail_body!=NULL && $mail_subject!=NULL)
{
if($match==no)
{
if(preg_match("/\[website\]/", $mail_body))
{
if(checkEmail($your_email) && checkEmail($friend1_email) && checkEmail($friend2_email))
{
//friend1
if($friend1_email!=NULL && $friend1_name!=NULL)
{
$replace = array("$friend1_name", "$trafic_url", "$your_name");
$mail_subject=str_replace($search, $replace, $mail_subject);
$mail_body=str_replace($search, $replace, $mail_body);
$mail_body=stripslashes($mail_body);
mail("$friend1_email", "$mail_subject", "$mail_body", "From: $your_email"); //seding friend1
}
//friend2
if($friend2_email!=NULL && $friend2_name!=NULL)
{
$replace = array("$friend1_name", "$trafic_url", "$your_name");
$mail_subject=str_replace($search, $replace, $mail_subject);
$mail_body=str_replace($search, $replace, $mail_body);
$mail_body=stripslashes($mail_body);
mail("$friend2_email", "$mail_subject", "$mail_body", "From: $your_email"); //seding friend2
}
//friend3
if($friend3_email!=NULL && $friend3_name!=NULL)
{
$replace = array("$friend1_name", "$trafic_url", "$your_name");
$mail_subject=str_replace($search, $replace, $mail_subject);
$mail_body=str_replace($search, $replace, $mail_body);
$mail_body=stripslashes($mail_body);
mail("$friend3_email", "$mail_subject", "$mail_body", "From: $your_email"); //seding friend3
}
//friend4
if($friend4_email!=NULL && $friend4_name!=NULL)
{
$replace = array("$friend1_name", "$trafic_url", "$your_name");
$mail_subject=str_replace($search, $replace, $mail_subject);
$mail_body=str_replace($search, $replace, $mail_body);
$mail_body=stripslashes($mail_body);
mail("$friend4_email", "$mail_subject", "$mail_body", "From: $your_email"); //seding friend4
}
//friend5
if($friend1_email5=NULL && $friend5_name!=NULL)
{
$replace = array("$friend1_name", "$trafic_url", "$your_name");
$mail_subject=str_replace($search, $replace, $mail_subject);
$mail_body=str_replace($search, $replace, $mail_body);
$mail_body=stripslashes($mail_body);
mail("$friend5_email", "$mail_subject", "$mail_body", "From: $your_email"); //seding friend5
}
//sending the visitors
header("Location: $final_url");
} else {
$error="Invalid email.";
}//corect email
}else{
$error="You must include [website] in your body.";
}//website check
}else{
$error="You have entered a duplicate email.";
}//duplicate check
} else {
$error="All * are required.";
} //all fields
?>
!doctype>
|