$title="Contact Us"; require_once "include/config.php"; include "head.php"; include "top.php"; $action=$_POST["action"]; if ($action=="Send"){ if (isset($_POST["captcha_phrase"]) && $_POST["captcha_phrase"] == $_SESSION["captcha_phrase"]) { foreach($_POST as $name=>$value){ $$name=mysql_real_escape_string(trim(strip_tags("",$value))); } $sql="insert into contact (to_user_id,from_name,from_email,from_phone,from_address,message)". "values($to_user_id,'$from_name','$from_email','$from_phone','$from_address','$message')"; @mysql_query($sql); $u=get_user_by_id($to_user_id); $to_email=$u["email"]; $to_user=$u["first_name"] . " " . $u["last_name"]; if (strpos($from_email,"@")<2 || strpos($from_email," ")>0 || strpos($from_email,".")<2){ $from_email=""; } if (empty($from_email)){ $u=get_user_by_id(1); $from_email=$u["email"]; } $subject="Contact us submission"; foreach($_POST as $name=>$value){ $$name=trim(strip_tags($value)); } $message="Name: $from_name\nPhone: $from_phone\nAddress:\n$from_address\n\nMessage:\n".$message; $mr=send_mail($from_email,$to_email,$subject,$message); $msg="