###########################################
#Very simple PHP formmail script.
#Script send datas like ip number and remote host.
#Also after posting details it thanks user for posting.
#Do not forget to change details like your mail, url(in thank.htm).
#If you have problems you can contact webmaster@dony.com.kg
#This script is free of charge. Do not hesitate to suggest this script to your friends.
#Thanks for using this script.
#www.dony.com.kg
###########################################
$mail='chakku@iitb.ac.in'; //Type your mail here
$subject="Form details-testing forms-brijesh"; //Change subject here
$thank="thank.htm"; //Your thank you page
$min_size="10"; //Minimum length of message
$max_size="1000"; //Maximum length of message
$telsize=12; //size of tel number
$max_tel_size=12; //maximum size of tel. number.
$banlist="127.0.0.5,second,third,"; //if you do not want some ips to spam you add them here.
//You can change error messages here
$no_number="You forgot to write your tel number."; //If tel number is forgotten
$no_message="You forgot to write your message"; //If message is forgotten
$no_name="You forgot to write your name"; //If no name
$mail_error="Your mail is wrong. Check this."; //If mail is wrong
$number_error="Your tel number is wrong. Check this"; //If number is wrong
$max_error="Your message is too long"; //If message is long.
$min_error="Your message is too short"; //If message is short.
$banned="You cant send me message because you are BANNED!!"; //if banned.
//here is error page parameters.
$error_title="wrong parameters"; //title of page
$back='#0000cc'; //background of error page
$text='#ffffff'; //text colour of error page
$h2='#ccccc'; //heading colour of error page
$error_message="the folowing fields are wrong please check them."; //message for visitor.
//Nothing else to change leave it as is.
$result=1;
if($name==""){
$result=0;
$error="
$no_name";
}
else{
$mailbody="Name : $name\n";
}
$mailbody.="1.: $radio1\n";
$mailbody.="2.: $radio2\n";
$mailbody.="3.: $radio3\n";
$mailbody.="4.: $radio4\n";
$mailbody.="5.: $radio5\n";
$mailbody.="6. : $radio6\n";
$mailbody.="7. : $radio7\n";
$mailbody.="8. : $radio8\n";
$mailbody.="9. : $radio9\n";
$mailbody.="10. : $radio10\n";
$mailbody.="11. : $radio11\n";
$mailbody.="12. : $radio12\n";
$mailbody.="13. : $radio13\n";
$mailbody.="14. : $radio14\n";
$mailbody.="15. : $radio15\n";
$mailbody.="16. : $radio16\n";
$mailbody.="17. : $radio17\n";
$mailbody.="18. : $radio18\n";
$mailbody.="19. : $radio19\n";
$mailbody.="20. : $radio20\n";
$mailbody.="21. : $radio21\n";
if($message==""){
$result=0;
$error1="$no_message";
}
elseif (strlen($message) <= $min_size) {
$error2="$min_error";
$result=0;
}
elseif (strlen($message) >= $max_size) {
$error3="$max_error";
$result=0;
}
else{
$mailbody.="Message : $message\n";
}
if ($email!==""){
if (!eregi("^.+@.+\\..+$", $email)){
$error4="$mail_error";
$result=0;
}
}
else{
$email=trim($email);
}
$ip=$REMOTE_ADDR;
$bans=array(explode(",","$banlist"));
foreach($bans as $banned_ip){
for($i=0;$i<=count($banned_ip);$i++){
if($ip==$banned_ip[$i]){
$result=0;
$error7="$banned";
}}}
if($number==""){
$error5="$no_number";
$end=1;
}
elseif(!eregi("^[0-9]{{$telsize},{$max_tel_size}}$", $number)){
$error6="$number_error";
$result=0;
$end=1;
}
else{
$mailbody.="Tel number : $number\n";
}
$mailbody.="---------------\n";
$mailbody.="Extra information\n";
$mailbody.="---------------\n";
$mailbody.="Visitor's country : $country\n";
$mailbody.="Visitor's city : $city\n";
$mailbody.="Visitor's company : $company\n";
$mailbody.="Where visitor found us : $list\n";
$mailbody.="other : $other\n";
$mailbody.="Visitors interests : \n";
for ($count=1;$count<=10;$count++){
$mailbody.="$checkbox[$count]\n";
}
$mailbody.="---------------\n";
$mailbody.="USER INFO\n";
$mailbody.="---------------\n";
$mailbody.="User use :$HTTP_USER_AGENT";
$mailbody.="Send via :$HTTP_VIA\n";
$mailbody.="ip adress is :$ip\n";
$mailbody.="Remote host is : $REMOTE_HOST\n";
$mailbody.="-------------\n";
$date=date("m/d/Y H:i:s");
$mailbody.="SERVER INFO\n";
$mailbody.="send date/time : $date\n";
$mailbody.="Came From web : $HTTP_HOST\n";
$mailbody.="Came from Ip number : $SERVER_ADDR\n";
$mailbody.="FILE name : $SCRIPT_FILENAME\n";
if ($result==1){
mail($mail,$subject,$mailbody,"From: $email\n");
Header ("Location: $thank");
}
if ($result!==1){
echo ("$error_title
$error_message
$error$error1$error2$error3$error4
$error5$error6$error7
");
}
?>