', '>', $ret); $ret=str_replace ('&', '&', $ret); $ret=str_replace ("'", "’" ,$ret); return $ret; } #POST/GETパラメータを取得します。 function fnc_req($str){ $retval=""; $retval=fnc_post($str); if ($retval==""){ $retval=fnc_get($str); } return $retval; } #POSTパラメータを取得します。 function fnc_post($str){ $retval=""; if (isset($_POST[$str]))$retval=$_POST[$str]; if (strlen($retval)>80000){ echo 'too largedata1'; exit; } return fnc_changestr($retval); } #GETパラメータを取得します。 function fnc_get($str){ $retval=""; if (isset($_GET[$str]))$retval=$_GET[$str]; if (strlen($retval)>800){ echo 'too largedata2'; exit; } if (TESTMODE=='0'){ $retval=mb_convert_encoding($retval,"UTF-8"); } return fnc_changestr($retval); } #危険な文字の変換 function fnc_changestr($str){ global $mobflg; $ret=stripcslashes("{$str}"); if ($mobflg=='1'){ $ret=mb_convert_encoding( $ret, "UTF-8"); } $ret=str_replace ("\0", '', $ret); $ret=str_replace ("\t", ' ', $ret); $ret=str_replace ('"', '”', $ret); $ret=str_replace ('<', '<', $ret); $ret=str_replace ('>', '>', $ret); $ret=str_replace ('&', '&', $ret); $ret=str_replace ("'", "’" ,$ret); $ret = htmlspecialchars($ret, ENT_QUOTES); return trim($ret); } #機種依存チェック用関数 function fnc_kisyuizon($str){ $ret=true; $str=str_replace ('~', '', $str); $str=str_replace ('-', '', $str); $str=str_replace ('Ⅰ', '', $str); $str=str_replace ('Ⅱ', '', $str); $str=str_replace ('Ⅲ', '', $str); $str=str_replace ('Ⅳ', '', $str); $str=str_replace ('Ⅴ', '', $str); $str=str_replace ('Ⅵ', '', $str); $str=str_replace ('Ⅶ', '', $str); $str=str_replace ('Ⅷ', '', $str); $str=str_replace ('Ⅸ', '', $str); $str=str_replace ('Ⅹ', '', $str); $test=$str; #-と~は除く $test=mb_convert_encoding( $test, "UTF-8"); if ($test!=$str)$ret=false; return $ret; } #日付型チェック function check_date($str){ list ($y,$m,$d) = explode("/",$str . '//'); if ($str=="" || $str=='//'){ #未入力はOK }elseif(is_numeric($m)==false || is_numeric($y)==false || is_numeric($d)==false){ return false; }else{ $y=$y + 0; $m=$m + 0; $d=$d + 0; if ($y > 3000 || $y < 1900 || $m >12 || $m<1 || $d>31 || $d<1){ return false; } if ($d>30 && ($m==4 || $m==6 || $m==9 || $m==11)){ return false; } if ($d>29 && $m==2){ return false; } if ($d==29 && $m==2){ if (($y % 400)==0){ #ok }elseif (($y % 100)==0){ return false; }elseif(($y % 4)!=0){ return false; } } } return true; } #日付型チェック function check_datetime2($str){ $str=ereg_replace(' ',"-",$str); $str=ereg_replace('-',"/",$str); $y=2000; list ($m,$d,$ushiro) = explode("/",$str . '///'); if ($str=="" || $str=='//時頃'){ #未入力はOK return true; }elseif(is_numeric($m)==false || is_numeric($y)==false || is_numeric($d)==false){ return false; }else{ $y=$y + 0; $m=$m + 0; $d=$d + 0; if ($y > 3000 || $y < 1900 || $m >12 || $m<1 || $d>31 || $d<1){ return false; } if ($d>29 && $m==2){ return false; } if ($d==29 && $m==2){ if (($y % 400)==0){ #ok }elseif (($y % 100)==0){ return false; }elseif(($y % 4)!=0){ return false; } } } $ushiro=str_replace("時頃", "", $ushiro); list ($h,$m,$s) = explode(":",$ushiro . '::'); $s=0; $m=0; if ($ushiro==""){ #未入力はOK }elseif(is_numeric($h)==false || is_numeric($m)==false || is_numeric($s)==false){ return false; }else{ $h=$h + 0; $m=$m + 0; $s=$s + 0; if ($h > 23 || $h < 0 || $m >59 || $m<0 || $s>59 || $s<0){ return false; } } return true; } #メールアドレス型チェック function check_mail($str){ $value=$str; if (preg_match("/^[a-zA-Z0-9\"\._\?\+\/-]+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/", $value)) { return true; } else { return false; } } #TEL,ZIP型チェック function check_prm_f($val){ if ($val==''){ return ''; } if ( ereg("^[0-9\-]+$", $val) ) { return true; }else{ return false; } } #メール送信 function fnc_sendmail($tomail,$adminmail,$mailtitle,$mailbody){ #あて先 $strTo=trim($tomail); #送り先を取得する $from=trim($adminmail); #タイトル $strSbj=$mailtitle; #本文 $strBody=$mailbody; $strBody=mb_convert_encoding( $strBody, "UTF-8", "UTF-8"); $strSbj=mb_convert_encoding( $strSbj, "UTF-8", "UTF-8"); #ヘッダ $headers = "MIME-Version: 1.0\n" ; $headers .= "Return-Path: <$adminmail>\n" ; $headers .= "Reply-To: $from \n"; $headers .= "From: $adminmail\n"; $headers .= "Content-Type: text/plain;charset=UTF-8\n"; $strBody =str_replace("\r", "\n", str_replace("\r\n", "\n", $strBody)); mb_language("uni"); mb_language("uni") ; mb_internal_encoding("UTF-8") ; mb_send_mail($strTo,$strSbj,$strBody,$headers); mb_internal_encoding("UTF-8") ; } function sub_check_input(){ global $aryp,$p,$mode,$hidden,$arrayerror; $errmsg=''; for ($i=1;$i<=MAXCNT;$i++){ $arrayerror[$i]=''; } for ($i=1;$i<=MAXCNT;$i++){ $n=$aryp[(($i*10) + 1)]; $k=$aryp[(($i*10) + 3)]; $c=$aryp[(($i*10) + 5)]; #パラメータ取得 $p[$n]=fnc_post('p'.$n); if (is_numeric($aryp[(($i*10) + 8)]) && $p[$n]==''){ for ($ii=1;$ii<=$aryp[(($i*10) + 8)];$ii++){ $tmp=fnc_post('p'.$n.'_'.$ii); if ($tmp!=''){ $hidden.=''; if ($p[$n]==''){ $p[$n]=$tmp; }else{ $p[$n].=',' . $tmp; } } } }else{ if ($aryp[(($i*10) + 7)]=='1' && $p[$n]!='1'){ $p[$n]='0'; } } #必須チェック if ($aryp[(($i*10) + 4)]=='1' && ($p[$n]=='' || (($c=='g' || $c=='h' || $c=='i') &&($p[$n]=='//' || $p[$n]=='//:' || $p[$n]=='/ 時頃' || $p[$n]=='/ :')))){ $errmsg.='請輸入您的 '.$k.'
'."\n" ; $arrayerror[$n]='請輸入您的 '.$k.''; } #機種依存文字チェックおよび半角化 if ($c=='a'){ if (fnc_kisyuizon($p[$n])==false){ $errmsg.=' '.$k.'包含無法顯示的文字。
'."\n" ; $arrayerror[$n].='包含無法顯示的文字。'; } }else{ $p[$n]=fnc_han($p[$n]); } #長さチェック if (strlen($p[$n])>$aryp[(($i*10) + 6)]){ if (!is_numeric($p[$n])){ $errmsg.='・「'.$k.'」が長すぎます。
'."\n"; $arrayerror[$n].='長すぎます'; } } #型チェック(数字) if ($c=='b' && $p[$n]!=''){ if (!is_numeric($p[$n])){ $errmsg.=''.$k.'請輸入半角文字。
'."\n"; $arrayerror[$n].='請輸入半角數字。'; } } #型チェック(半角英数) if ($c=='c' && $p[$n]!=''){ $test=$p[$n]; $test=str_replace("-", "", $test); if (!check_prm_c($p[$n])){ $errmsg.=' '.$k.' field only accepts half-width characters.
'."\n"; $arrayerror[$n].='Please type using half-width characters.'; } } #型チェック(MAIL) if ($c=='d' && $p[$n]!=''){ $p[$n]=str_replace(" ", "", $p[$n]); if (!check_mail($p[$n]) ){ $errmsg.='・「'.$k.'」をご確認下さい。
'."\n"; $arrayerror[$n].='アドレス書式をご確認下さい'; } } #型チェック(URL ) if ($c=='e' && $p[$n]!=''){ if (!ereg("^http.+$", $p[$n])){ $errmsg.='・「'.$k.'」をご確認下さい。
'."\n"; $arrayerror[$n].='URLをご確認下さい'; } } #型チェック(tel.zip) if ($c=='f' && $p[$n]!=''){ if (!check_prm_f($p[$n])){ $errmsg.='Please enter numeric value in '.$k.' field.
'."\n"; $arrayerror[$n].='Please input a numerical value.'; } } #型チェック(date) if ($c=='g' && $p[$n]!=''){ if (!check_date($p[$n])){ $errmsg.='・「'.$k.'」をご確認下さい。
'."\n"; $arrayerror[$n].='書式をご確認下さい'; } } #型チェック(カンマ区切り数字又は-) if ($c=='h' && $p[$n]!=''){ if (!check_prm_f(str_replace(",", "", $p[$n]))){ $errmsg.='・「'.$k.'」をご確認下さい。(カンマ区切り数字又は-)
'."\n"; $arrayerror[$n].='書式をご確認下さい'; } } #型チェック(date) if ($c=='i' && $p[$n]!=''){ if (!check_datetime2($p[$n])){ $errmsg.='・「'.$k.'」をご確認下さい。
'."\n"; $arrayerror[$n].='値をご確認下さい'; } } #型チェック(float) if ($c=='j' && $p[$n]!=''){ if (!is_numeric($p[$n])){ $errmsg.='・「'.$k.'」をご確認下さい。
'."\n"; $arrayerror[$n].='値をご確認下さい'; } } } if ($p[11]!=fnc_post('p12')){ $errmsg.='・「e-mail」が確認用と一致しません。
'; $arrayerror[12].='一致しません'; } return $errmsg; } #get param $mode=fnc_req('mode'); error_reporting(2047); $pcol=array(); for ($i=1;$i<=MAXCNT;$i++){ $n=$aryp[(($i*10) + 1)]; $pcol[$n]=$aryp[(($i*10) + 2)]; $arrayerror[$i] =''; } $errmsg=''; $msg=''; $hidden=''; #送信・サンキュー画面表示 if ($mode=='reg'){ #エラーチェック・データ整形 $errmsg=sub_check_input(); if ($errmsg=='' && fnc_post('back')!='on'){ $adminmail=ADMIN_MAIL; $tile=MAIL_ADMIN_TITLE; $body=MAIL_CONTACT_BODY; for ($i=1;$i<=MAXCNT;$i++){ if ($p[$i]=='')$p[$i]='(Null)'; $body=str_replace("__p".$i."__",$p[$i],$body); } # 管理者向けメール送信 if (TESTMODE=='0'){ fnc_sendmail($adminmail,$adminmail,$tile,$body); } # 自動返信メール送信 $tile=MAIL_CONTACT_TITLE; $uname=$p[4].' '.$p[5]; $body=MAIL_CONTACT_HEADER.$body.MAIL_CONTACT_FOOTER; $body=str_replace("__PERSON_NAME__",$uname,$body); if (check_mail($p[11])){ fnc_sendmail($p[11],$adminmail,$tile,$body); } # CSVファイル出力 if (CSVMODE=='0'){ if(file_exists(CSV_FILE)){ $fp = fopen(CSV_FILE,"a"); }else{ $fp = fopen(CSV_FILE,"w"); } $cstr='"'.date("Y/m/d H:i:s") .'"'; for ($i=1;$i<=MAXCNT;$i++){ $cstr.=',"'.$p[$i].'"'; } $cstr=mb_convert_encoding( $cstr, "SJIS", "UTF-8"); fputs($fp,$cstr."\n"); fclose($fp); } # 送信完了画面表示 include ('thanks.php'); exit; } $mode='newconf'; #内容確認時 }elseif($mode=='newconf'){ $errmsg=sub_check_input(); if ($errmsg==''){ #hidden設定 for ($i=1;$i<=MAXCNT;$i++){ $hidden.=''; if ($p[$i]=='')$p[$i]='(Null)'; if (($i==5 || $i==6) && is_numeric($p[$i]))$p[$i]=number_format($p[$i]); } #HTML取得 include ('conf.php'); exit; } }else{ $mode='newconf'; } ?> 日本買房的絕好機會已經到來 - MINAMIAOYAMA REAL ESTATE
contact-us
姓名*