//======================================== // dehead(config/function/lib) Include //======================================== include $_SERVER['DOCUMENT_ROOT']."/front/include/dehead.php"; require_once PATH_LIB."FileUpload.php"; require_once PATH_LIB."Valid.php"; // 유효성 검사 클래스 require_once PATH_LIB."PasswordHash.php"; // 암호화 클래스 //======================================== // Class Connect //======================================== $Db = new Db(); $Valid = new Valid(); @extract(HttpVars('FILES')); // FILE 변수 정의 //======================================== // Data Process & Query //======================================== ?> function add_hyphen($tel) { $tel = preg_replace("/[^0-9]/", "", $tel); // 숫자 이외 제거 if (substr($tel,0,2)=='02') return preg_replace("/([0-9]{2})([0-9]{3,4})([0-9]{4})$/", "\\1-\\2-\\3", $tel); else if (strlen($tel)=='8' && (substr($tel,0,2)=='15' || substr($tel,0,2)=='16' || substr($tel,0,2)=='18')) // 지능망 번호이면 return preg_replace("/([0-9]{4})([0-9]{4})$/", "\\1-\\2", $tel); else return preg_replace("/([0-9]{3})([0-9]{3,4})([0-9]{4})$/", "\\1-\\2-\\3", $tel); } //휴대폰번호만 받도록 if(substr($qc_tel,0,3) != '010' && substr($qc_tel,0,3) != '011'){ echo ""; echo ""; exit; } if(!$qc_store){ $qc_store = 'X'; } if($qc_name && $qc_tel){ $param = array_merge($param, array( 'name' => $Valid->String($qc_name, "이름을 입력하세요."), 'tel' => $Valid->String(add_hyphen($qc_tel), "연락처를 입력하세요."), 'type' => $Valid->String($qc_type), 'ip' => $_SERVER['REMOTE_ADDR'], 'store' => $qc_store, 'subject' => 'X' )); $write = $Db->query("INSERT INTO $TABLE_KAKAOTALK (store,subject,name,phone, ip, reg_date, type) VALUES(:store,:subject,:name, :tel, INET_ATON(:ip), now(), :type)", $param); if($write > 0){ $Db->CloseConnection; } } ?>