include_once("script/include_common_file.php");
include_once "./SMS/xmlrpc.inc.php";
include_once "./SMS/class.EmmaSMS.php";
reset($_POST);while(list($key,$val)=each($_POST)){ $_POST[$key] = secu($_POST[$key]);}reset($_POST);
reset($_GET);while(list($key,$val)=each($_GET)){ $_GET[$key] = secu($_GET[$key]);}reset($_GET);
$_SESSION["anti_spam"]=session_id();
//if(strstr("@14.37.242.84@221.154.216.133@","@".$_SERVER["REMOTE_ADDR"]."@")){checkVar("CP_PHONE_STAFF",$CP_PHONE_STAFF);}
If($mode=="save"){
if($_SESSION["anti_spam"]!=session_id()){error("잘못된 접근입니다1.");exit;}
if(!$nation){error("희망국가를 선택해 주세요.");exit;}
$nation = secu($nation);
$area = secu($area);
$reg_date = date('Y/m/d');
$reg_date2 = date('H:i:s');
$phone = "${phone1}-${phone2}-${phone3}";
$ip=$_SERVER[REMOTE_ADDR];
$status="접수";
$assort="개별맞춤여행";
$sql = "
select
*
from ez_request
where
phone='$phone'
and reg_date='$reg_date'
and reg_date2='$reg_date2'
and CID='$CID'
";
$dbo->query($sql);
$rs=$dbo->next_record();
if($rs[id_no]){
error("이미 접수되었습니다.");
exit;
}
$source_tid = intval($source_tid);
$_ad_channel = isset($_SESSION["ad_channel"]) ? secu($_SESSION["ad_channel"]) : "";
// 신규 필드: 희망 통화시간 / 문의 경로
$consult_time = secu($_POST["consult_time"]);
$inflow_path = secu($_POST["inflow_path"]);
if($inflow_path == "기타" && trim($_POST["inflow_path_etc"]) != ""){
$inflow_path = "기타: " . secu(trim($_POST["inflow_path_etc"]));
}
$sql="
insert into ez_request (
CID,
id,
date_s,
date_e,
people,
nation,
area,
org,
name,
gender,
phone,
email,
assort,
assort_memo1,
assort_memo2,
content,
etc1,
etc2,
etc3,
etc4,
etc5,
memo,
ip,
status,
reg_date,
reg_date2,
s_airport,
source_tid,
ad_channel,
consult_time,
inflow_path
) values (
'$CID',
'$user_id',
'$date_s',
'$date_e',
'$people',
'$nation',
'$area',
'$org',
'$name',
'',
'$phone',
'$email',
'$assort',
'$assort_memo1',
'$assort_memo2',
'$content',
'$etc1',
'',
'',
'',
'',
'$memo',
'$ip',
'$status',
'$reg_date',
'$reg_date2',
'$s_airport',
'$source_tid',
'${_ad_channel}',
'$consult_time',
'$inflow_path'
)";
if($dbo->query($sql)){
$company_name = $SITE_NAME2;
if($CID){
$company_name = $CP_COMPANY;
$WEBMASTER = $CP_EMAIL;
if(substr($CP_PHONE_STAFF,0,3)=="010"){
$sms_id="irumplace";
$sms_passwd="00615cmy!";
$OFFICE_TEL="025127705";
$sms_type = "L";
$sms = new EmmaSMS();
$sms->login($sms_id, $sms_passwd);
$message = "[${CID}] 골프투어문의(${name})가 접수되었으니 확인해주시기 바랍니다.";
$ret = $sms->send($CP_PHONE_STAFF, $OFFICE_TEL, $message, $sms_date, $sms_type);
}
}else{
$OFFICE_TEL_PARTNER = "01082277653";
$OFFICE_TEL="025127705";
if($OFFICE_TEL_PARTNER){
$sms_id="irumplace";
$sms_passwd="00615cmy!";
$sms_type = "L";
$sms = new EmmaSMS();
$sms->login($sms_id, $sms_passwd);
$message = "골프투어 문의(${name}님)가 접수되었습니다.";
$ret = $sms->send($OFFICE_TEL_PARTNER, $OFFICE_TEL, $message, $sms_date, $sms_type);
}
}
$fromMail = $WEBMASTER;
$fromName = $company_name;
$toMail = $WEBMASTER;
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
$headers .= 'From: ' . $fromName . ' <' . $fromMail . '>' . "\r\n";
$mailContent ="문의 날짜 : $reg_date
";
$mailContent .="문의구분 : $assort
";
$mailContent .="여행일정 : $date_s ~ $date_e
";
$mailContent .="국내 출발 공항 : $s_airport
";
$mailContent .="예상인원 : $people
";
$mailContent .="희망국가 : $nation
";
$mailContent .="희망지역 : $area
";
$mailContent .="성명 : $name
";
$mailContent .="연락처 : $phone
";
$mailContent .="이메일주소 : $email
";
$mailContent .="여행테마 : $etc1
";
$mailContent .="라운드 희망 횟수 : $org
";
$mailContent .="기타 요청사항 : $content
";
$_ct_label = array("morning"=>"오전 (09:00~12:00)","lunch"=>"점심 (12:00~14:00)","afternoon"=>"오후 (14:00~18:00)","any"=>"아무때나 연락해주세요","kakao"=>"카카오톡으로 연락주세요");
$mailContent .="희망 통화시간 : ".($_ct_label[$consult_time] ? $_ct_label[$consult_time] : $consult_time)."
";
$mailContent .="문의 경로 : $inflow_path
";
mail($toMail, $assort . "문의", $mailContent, $headers );
//msggo("접수가 완료되었습니다. 빠른 시간내에 담당자가 연락드리겠습니다.","index.html");
redirect2("/renew/comty02_result.html");
}
exit;
}
// source_tid로 상품 정보 조회 (자동 입력용)
$source_nation = '';
$source_city = '';
$source_subject = '';
$source_etc1 = '';
$source_tid = intval($source_tid);
if($source_tid){
$sql_src = "select * from ez_tour where tid=$source_tid limit 1";
$dbo9->query($sql_src);
$rs_src = $dbo9->next_record();
$source_subject = $rs_src[subject];
// 골프장에서 국가/지역 가져오기
if($rs_src[golf2_1_id_no]){
$sql_g = "select nation, city from cmp_golf2 where id_no=$rs_src[golf2_1_id_no] limit 1";
$dbo9->query($sql_g);
$rs_g = $dbo9->next_record();
$source_nation = trim($rs_g[nation]);
$source_city = trim($rs_g[city]);
}
// 리조트/시내 자동 판별
if(strstr($source_subject, '리조트') || strstr($source_subject, 'resort') || strstr($source_subject, 'Resort')){
$source_etc1 = '골프리조트';
} elseif(strstr($source_subject, '시내')){
$source_etc1 = '시내호텔';
}
}
// 로그인 시 이름/전화번호 자동 입력 (sessMember 우선)
$auto_name = '';
$auto_phone1 = ''; $auto_phone2 = ''; $auto_phone3 = '';
if($_SESSION["sessMember"]["name"]){
$auto_name = $_SESSION["sessMember"]["name"];
} elseif($_SESSION["name"]){
$auto_name = $_SESSION["name"];
}
$_tmp_phone = '';
if($_SESSION["sessMember"]["phone"]){
$_tmp_phone = $_SESSION["sessMember"]["phone"];
} elseif($_SESSION["phone"]){
$_tmp_phone = $_SESSION["phone"];
}
if($_tmp_phone){
$_tmp_phone = preg_replace("/[^0-9]/", "", $_tmp_phone);
if(strlen($_tmp_phone)==11){
$auto_phone1 = substr($_tmp_phone,0,3);
$auto_phone2 = substr($_tmp_phone,3,4);
$auto_phone3 = substr($_tmp_phone,7,4);
} elseif(strlen($_tmp_phone)==10){
$auto_phone1 = substr($_tmp_phone,0,3);
$auto_phone2 = substr($_tmp_phone,3,3);
$auto_phone3 = substr($_tmp_phone,6,4);
}
}
?>