feha
Posts: 712
|
| Posted: 02/08/2005, 11:07 PM |
|
<?php
/*
<!--
****************************************************
* Website: http://www.vision.to
* Copyright © by WWW.VISION.TO
* All Rights Reserved
* Author:Femi Hasani
* Contact:info@vision.to
* Freeware/Donateware
*****************************************************
-->
*/
//===================| FREE TO CUSTOMISE |=====================
$name="n/a";//If client don't write a name or is not required (Survey)
$email_webform="webform@vision.to";//if client don't leave e-mail or is not required
$your_name="Vision.To Design";//Your or Company name
$email_to="info@vision.to";
$email_body="";//Clean Up variable ...
$email_subject="NO SUBJECT";//if Subject is empy or not required
//validate e-mailaddress format no check with the servers
$verify_email='1';//If you have in Your form field with name="mail" it will chek this option too
$notify_client='1';//1 for Yes else NO, It will notify Client if e-mail field not Empty
//Header can perosnilize senders name too/DON'T CHANGE OR REMOVE <NAME>
// <NAME> vill be replaced by our application with senders name
//Header will personalize e-mail message
$email_header="Hi <NAME>";
//Your Company Footer included on clinet notify
$email_footer="
Vision.To Design
www.vision.to
";
$ThankyouURL = "";//Your Thank You Page if Empty it will use processor message
$ErrorURL = "";//Your Error Page if Empty it will use processor message
//Describe all required fields and formats
$RequredURL = "";//Your Required Fields Page if Empty it will use processor message
//Write address or domain names you want to allow access to form processor
//SELECTED SCRIPT ACCESS WILL PREVENT REMOTE "HACK" ...
global $allow_domains;
$allow_domains="192.168.253.102|vision.to|coder24|visiontodesign.com|212.31.160.202";
//$allow_domains="";//un-comment this line if You want to allow remote access
//======================| END CUSTOMISE |============================
//===================================================================
global $REMOTE_ADDR;
global $HTTP_REFERER;
global $SERVER_NAME;
function allow_domains()
{
global $allow_domains;
global $HTTP_REFERER;
if($allow_domains !="")
{
$HTTP_REFERER=substr(addslashes(strip_tags($HTTP_REFERER)),0,255);
eregi("^https?://([a-zA-Z0-9_.-]+)",$HTTP_REFERER,$in);
if(!eregi($allow_domains,$in[1])) {
echo("Remote Access Is Not Allowed! Except: [ $allow_domains ]");
exit;
}
}
}
//calling this function
allow_domains();
//WILL CHECK ALLOWED REFFERER IF HTML FORM IS ON OTHER SERVER OPTIONAL
//if (!eregi($allowed,$HTTP_REFERER)){echo "REMOTE ACCESS IS NOT ALLOWED";exit;}
//THIS WILL CHECK IF SCRIPT IS RUNNING WITHIN YOUR SERVER OPTIONAL
//if (!eregi($SERVER_NAME,$HTTP_REFERER)){echo "REMOTE ACCESS IS NOT ALLOWED";exit;}
//IF NOTHING SUBMITED NO PROCESSING IS REQUIRED
if (!$_POST && !$_GET ) {echo "THE FORM IS EMPTY, NOTHING TO PROCESS!";exit;}
//=======================================================================
if ( $_SERVER['REQUEST_METHOD'] == "POST") {
foreach ($_POST as $key => $value) {
if (eregi("r_",$key)){
if($value=="")
{
$key=str_replace("r_"," ",$key);
$key=str_replace("_"," ",trim($key));
if($RequredURL !=""){header ("Location:$RequredURL");exit;}
echo "<b>".strtoupper($key)."</b> IS REQUIRED<br>";
echo "<a href=".$HTTP_REFERER.">OK</a><br>";exit;
}
}
$key=str_replace("r_"," ",$key);
if (eregi("subject",$key)){$email_subject=$value;}
if (eregi("mail",$key)){$email_from=$value;
if ($verify_email=='1')
{
if(!eregi('^[a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.([a-zA-Z]{2,4})$', $email_from))
{
if($RequredURL !=""){header ("Location:$RequredURL");exit;}
echo "<b>".strtolower($email_from)."</b> e-mail address format is wrong!";exit;
}
}
}
if (eregi("name",$key)){$name=$value;}
$key=str_replace("_"," ",trim($key));
$email_body .= ucfirst ($key) ." : ". $value . "\n";
}
} else {
foreach ($_GET as $key => $value) {
if (eregi("r_",$key)){
if($value=="")
{
$key=str_replace("r_"," ",$key);
$key=str_replace("_"," ",trim($key));
if($RequredURL !=""){header ("Location:$RequredURL");exit;}
echo "<b>".strtoupper($key)."</b> IS REQUIRED<br>";
echo "<a href=".$HTTP_REFERER.">OK</a><br>";exit;
}
}
$key=str_replace("r_"," ",$key);
if (eregi("subject",$key)){$email_subject=$value;}
if (eregi("mail",$key)){$email_from=$value;
if ($verify_email=='1')
{
if(!eregi('^[a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.([a-zA-Z]{2,4})$', $email_from))
{
if($RequredURL !=""){header ("Location:$RequredURL");exit;}
echo "<b>".strtolower($email_from)."</b> e-mail address format is wrong!";exit;
}
}
}
if (eregi("name",$key)){$name=$value;}
$key=str_replace("_"," ",trim($key));
$email_body .= ucfirst ($key) ." : ". $value . "\n";
}
}
//==============================================================================
if (!$email_body) {echo "THE FORM IS EMPTY, NOTHING TO PROCESS!";exit;}
//Notify Your Client
if($notify_client='1'&& $email_from !="")
{
$email_header=str_replace("<NAME>",$name,$email_header);
$email_body_client= $email_header."\n";
$email_body_client .=$email_body;
$email_body_client .=$email_footer."\n";
//$email_body_client .= "-------------------------------------------\n";
//$email_body_client .= " get free form processor at www.vision.to \n";
//$email_body_client .= "-------------------------------------------\n";
$email_subject_client="Re:CFM - ".$email_subject;
mail($email_from, $email_subject_client, $email_body_client, "From: \"$your_name\" <$email_to>\nReply-To: \"$name\" <$email_from>\nX-Mailer: www.vision.to" );
}
$email_body .= "---------------------------------------------\n";
$email_body .= date ("Y-m-d")."/".date ("H:m:s")."\n";
$email_body .= "IP:".$REMOTE_ADDR."\n";
$email_body .= "Referer: " .$HTTP_REFERER. "\n".$SERVER_NAME."\n";
$email_body .= "----------------------------------------------\n";
//$email_body .= "get free form processor at www.vision.to \n";
if($email_from =="")
{
$email_from = $email_to;
}
$OK=mail($email_to, $email_subject, $email_body, "From: \"$name\" <$email_from>\nReply-To: \"$your_name\" <$email_from>\nX-Mailer: www.vision.to" );
if($OK=='true')
{
if($ThankyouURL!="")
{
header ("Location:$ThankyouURL");
}
else
{
echo "Your message has been sent<br>Thank You<br>";
echo "<a href=".$HTTP_REFERER.">OK</a><br>";
//header ("Location:$HTTP_REFERER");
}
}
else
{
if($ErrorURL !="")
{
header ("Location:$ErrorURL");
}
else
{
echo "Message could not be sent might be a problem with server connection!<br>Please try again (later)!Thank You";
echo "<a href=".$HTTP_REFERER.">OK</a><br>";
}
}
//echo "<a href=".$HTTP_REFERER.">OK</a><br>";
if($ThankyouURL!="")
{
header ("Location:$ThankyouURL");
}
else
{
//echo "<a href=".$HTTP_REFERER.">OK</a><br>";
//header ("Location:$HTTP_REFERER");
}
?>
_________________
Regards
feha
www.vision.to
feedpixel.com |