50){ $error_type = "cust_subj"; }elseif(strlen($cust_mail) < 5 || strlen($cust_subj) > 50){ $error_type = "cust_mail"; }elseif($cust_city_id=="0"){ $error_type = "cust_city_id"; echo "| $cust_city_id |"; }elseif($cust_city_id=="other" && (strlen($cust_city_text) < 2 || strlen($cust_city_text) >50)){ $error_type = "cust_city_text"; }elseif(strlen($quest1) < 5 || strlen($cust_subj) > 1000){ $error_type = "quest"; }elseif($rand_question[1]!=$answer){ $error_type = "spam_protec"; } if(strlen($error_type)>0){ require('include/setup.php'); $smarty = new MySmartySetup; include("include/connect.php"); include("include/load_info.php"); $page_title = "Контакты"; $smarty->assign('page_title',$page_title); $smarty->assign('part_name',$page_title); $smarty->assign('error_type',"$error_type"); $len_ = count($quest)-1; $quest_num = rand(0,$len_); $rand_question = preg_split ("/\|/", $quest[$quest_num]); $smarty->assign('rand_q',$quest_num); $smarty->assign('question',$rand_question[0]); $smarty->assign('template_file',"index_contacts.tpl"); $smarty->display('index_main.tpl'); }else { include("include/connect.php"); if(getenv("HTTP_X_FORWARDED_FOR") && getenv("HTTP_X_FORWARDED_FOR")!="unknown"){ $IP=getenv("HTTP_X_FORWARDED_FOR"); }else{ $IP=getenv("REMOTE_ADDR"); } function my_s($s){ return trim(stripslashes(str_replace("`",'',str_replace("\n",' ',str_replace("|",'_',str_replace("..",'',htmlspecialchars($s,ENT_QUOTES))))))); } $INFO = "User Agent: ".my_s(getenv("HTTP_USER_AGENT"))."
User ip: ".my_s($IP)."
Language: ".my_s(getenv("HTTP_ACCEPT_LANGUAGE"))."
Host: ".my_s(gethostbyaddr(getenv("REMOTE_ADDR"))); $cust_city_id = intval($_REQUEST['cust_city_id']); require('include/mail.functions.php'); $zp="INSERT INTO Feeds (Mail,Cust_subj,Icq,Skype,Yahoo,Aim,MSN,Feed_text,Date,Is_show,Tech_info,City_id,City_text) values ('".mysql_real_escape_string($cust_mail)."','".mysql_real_escape_string($cust_subj)."','".mysql_real_escape_string($icq)."','".mysql_real_escape_string($skype)."','".mysql_real_escape_string($yahoo)."','".mysql_real_escape_string($aim)."','".mysql_real_escape_string($msn)."','".mysql_real_escape_string($quest1)."',NOW(),0,'$INFO','$cust_city_id','".mysql_real_escape_string($cust_city_text)."')"; $res=mysql_query($zp); if (mysql_error()){ send_error(mysql_errno().":".mysql_error(),$zp,1); header("Location: contacts.html?a=no"); }else{ $last_id=mysql_insert_id($link); if($cust_city_id==1){ send_mail_to("nsk@planetwm.ru","Новое сообщение на сайте PlanetWM","Новое сообщение : https://planet-wm.com/wm-panel/feeds.php?a=show&id=$last_id"); }elseif($cust_city_id==2){ send_mail_to("spb@planetwm.ru","Новое сообщение на сайте PlanetWM","Новое сообщение : https://planet-wm.com/wm-panel/feeds.php?a=show&id=$last_id"); }else{ send_mail("Новое сообщение на сайте PlanetWM","Новое сообщение : https://planet-wm.com/wm-panel/feeds.php?a=show&id=$last_id"); } header("Location: contacts.html?a=ok"); } } } else { require('include/setup.php'); $smarty = new MySmartySetup; include("include/connect.php"); include("include/load_info.php"); $page_title = "Контакты"; $smarty->assign('page_title',$page_title); $smarty->assign('part_name',$page_title); $quest = file("include/questions.dat"); $len_ = count($quest)-1; $quest_num = rand(0,$len_); $rand_question = preg_split ("/\|/", $quest[$quest_num]); $smarty->assign('rand_q',$quest_num); $smarty->assign('question',$rand_question[0]); $smarty->assign('template_file',"index_contacts.tpl"); $smarty->display('index_main.tpl'); } ?>