check_flag="true"; Ota_init_object::data_check(); if($this->check_flag=="false"){ return false; } if(Ota_init_object::Mailaddress_check()==false){ return false; } if(Ota_init_object::Ota_Send_mail()){ Ota_init_object::Close_Display(); return "OK"; } } return false; } /************************************************************************************/ /* チェック関数 */ /************************************************************************************/ function ota_check(){ Ota_init_object::GET_Color(); Ota_init_object::Taking_over(); $this->check_flag="true"; Ota_init_object::data_check(); if($this->check_flag=="false"){ return false; } if(Ota_init_object::Mailaddress_check()==false){ return false; } return true; } /************************************************************************************/ /* Send関数 */ /************************************************************************************/ function Mail_send(){ Ota_init_object::Taking_over(); Ota_init_object::data_check(); if(Ota_init_object::Ota_Send_mail()){ return true; } return false; } /************************************************************************************/ /* POSTデータ取得関数 */ /************************************************************************************/ function Taking_over(){ $this->form_value = array($_POST["cname"],$_POST["div"],$_POST["pname"],$_POST["title"],$_POST["zip"],$_POST["addr"],$_POST["tel"],$_POST["email"],$_POST["comment"]); /* 0 => $_POST["cname"], 1 => $_POST["div"], 2 => $_POST["pname"], 3 => $_POST["title"], 4 => $_POST["zip"], 5 => $_POST["addr"], 6 => $_POST["tel"], 7 => $_POST["email"], 8 => $_POST["comment"] */ } /************************************************************************************/ /* データ取得関数 */ /************************************************************************************/ function Taking_over2(){ $this->form_value = array($_REQUEST["cname"],$_REQUEST["div"],$_REQUEST["pname"],$_REQUEST["title"],$_REQUEST["zip"],$_REQUEST["addr"],$_REQUEST["tel"],$_REQUEST["email"],$_REQUEST["comment"]); } /************************************************************************************/ /* カラー取得関数 */ /************************************************************************************/ function GET_Color(){ $this->form_color = array( "cname" => "#333333", "div" => "#333333", "pname" => "#333333", "title" => "#333333", "zip" => "#333333", "addr" => "#333333", "tel" => "#333333", "email" => "#333333", "comment" => "#333333" ); } /************************************************************************************/ /* 入力項目の監査&メールデータの加工 */ /************************************************************************************/ function data_check(){ $err_color="#FF0000"; $this->err_message=array(); $temp_body[0] = "社名:"; $temp_body[1] = "所属部署:"; $temp_body[2] = "名前:"; $temp_body[3] = "役職:"; $temp_body[4] = "郵便番号:"; $temp_body[5] = "住所:"; $temp_body[6] = "電話番号:"; $temp_body[7] = "E-mailアドレス:"; $temp_body[8] = "内容:"; $array_cnt = count($this->form_value); for($i=0;$i<$array_cnt;$i++){ if(is_null($this->form_value[$i]) or $this->form_value[$i]==""){ if($i==1 or $i==3 or $i==4 or $i==5){ $this->body_message .= $temp_body[$i] . "記入無し\r\n\r\n"; } switch ($i){ case 0: $this->form_color["cname"]=$err_color; $this->err_message[]="TRUE"; $this->check_flag="false"; break; case 2: $this->form_color["pname"]=$err_color; $this->err_message[]="TRUE"; $this->check_flag="false"; break; case 6: $this->form_color["tel"]=$err_color; $this->err_message[]="TRUE"; $this->check_flag="false"; break; case 7: $this->form_color["email"]=$err_color; $this->err_message[]="TRUE"; $this->check_flag="false"; break; case 8: $this->form_color["comment"]=$err_color; $this->err_message[]="TRUE"; $this->check_flag="false"; break; } }else{ $this->body_message .= $temp_body[$i] . $this->form_value[$i] . "\r\n\r\n"; } } } /************************************************************************************/ /* 入力項目(メールアドレス)の監査関数 */ /************************************************************************************/ function Mailaddress_check(){ $err_color="#FFCCCC"; $temp_array=explode("@",$_POST["email"]); if(count($temp_array)<2){ $this->form_color["email"]=$err_color; $this->err_message[]="「Email アドレス」が不正です。ご確認ください。"; $this->check_flag="false"; return false; } $address=$temp_array[0]; $domain=$temp_array[1]; if(strlen($address)<1){ $this->err_message[]="「Email アドレス」が不正です。ご確認ください。"; $this->form_color["email"]=$err_color; $this->check_flag="false"; return false; } if(strlen($domain)<1){ $this->err_message[]="「Email アドレス」が不正です。ご確認ください。"; $this->form_color["email"]=$err_color; $this->check_flag="false"; return false; } $str_cnt = strlen($address); //文字数制限 //if($str_cnt<3 or $str_cnt>32){ // return "FALSE"; //} //メールアドレスを一文字ずつ分解して判定 不正な文字がある場合エラーを返す for($i=0;$i<=$str_cnt-1;$i++){ //2バイト文字の場合エラー if(mb_strwidth(mb_substr($address,$i,1))==2){ $this->err_message[]="「Email アドレス」が不正です。ご確認ください。"; $this->form_color["email"]=$err_color; $this->check_flag="false"; return false; } //メールサーバー自体が使えない文字等はここに記述する。その際はasciiコードで判別することとした。::34=" 39=' 40=( 41=) $temp_code=ord(substr($address,$i,$i+1)); if($temp_code==34 or $temp_code==39 or $temp_code==40 or $temp_code==41){ $this->err_message[]="「Email アドレス」が不正です。ご確認ください。"; $this->form_color["email"]=$err_color; return false; } } return true; } /************************************************************************************/ /* メールの送信 */ /************************************************************************************/ function Ota_Send_mail(){ //送信先の設定変更やサーバーによって変更を加えてください。 // $to_address= $this->form_value[7]; $to_address= "mkt@acutelogic.co.jp,inquire@acutelogic.co.jp"; // $from_address= "From: " . ""; // $temp_host="localhost"; // $temp_sendmail_from=""; // $temp_port="25"; // $temp_path="/usr/local/sbin/sendmail -t -i"; mb_language(Japanese); // ini_set ("SMTP",$temp_host); // ini_set ("smtp_port",$temp_port); // ini_set ("sendmail_from",""$temp_sendmail_from); // ini_set ("sendmail_path",$temp_path); if(mb_send_mail($to_address,"お問い合わせ",$this->body_message,"From: auto-contact@acutelogic.co.jp","-finfo@acutelogic.co.jp")){ return true; }else{ print("送信失敗!!システム管理者にお問い合わせください。
\n"); return false; } return false; } } ?>