0 and $act_type == "" ){ $act_type = "disp"; } // //$moji_code = "UTF-8"; $moji_code = "UTF-8"; if($_POST['from_code']){ $from_code = $_POST['from_code']; }else{ $from_code = $moji_code; } $no_chk_flg = $_POST['no_chk_flg']; $act_type = $_POST['act_type']; #if( count($_POST) > 0 and $act_type == "" ){ $act_type = "disp"; } #入力項目を必須項目かどうかで分ける $arr_hissu = array(); $arr_db_name = array(); foreach($arr_input as $post_name => $post_value){ list($reg_id,$reg_name,$hissu_flg,$tmp_rfm_data) = split(",",$post_value); $arr_db_name[$reg_id] = $reg_name; if( $hissu_flg == "1" ){ $arr_hissu[] = $reg_id; } } #アクセスしてきたのがPC、携帯、iphoneかを判断する $keitai_flg = sub_data_isKeitai(); switch( $keitai_flg ) { case "1": #携帯 $form_page = $m_form_page; $disp_page = $m_disp_page; $end_page = $m_end_page; $err_page = $m_err_page; break; case "2": #iPhone $form_page = $i_form_page; $disp_page = $i_disp_page; $end_page = $i_end_page; $err_page = $i_err_page; break; default: $form_page = $p_form_page; $disp_page = $p_disp_page; $end_page = $p_end_page; $err_page = $p_err_page; break; } #if( $act_type == "disp" ) { $num = 0; $db_data = array(); # foreach($_POST as $post_name => $post_value){ # $num++; # echo "post_name,$post_name
\n"; # echo "post_value,$post_value
\n"; # echo "
"; # break; # } # $num = count($_POST); $arr_send_data = array(); foreach($arr_input as $post_name => $post_value){ list($reg_id,$reg_name,$hissu_flg,$tmp_rfm_data) = split(",",$post_value); $tmp_value = ""; if( is_array($_POST[$reg_id]) ){ $tmp_cnt = count($_POST[$reg_id]); for($j=0;$j<$tmp_cnt;$j++){ if( $tmp_value == "" ){ $tmp_value = $_POST[$reg_id][$j]; }else{ $tmp_value .= ",".$_POST[$reg_id][$j]; } } }else{ $tmp_value = $_POST[$reg_id]; } # echo "reg_id,$reg_id
\n"; # echo "tmp_value,$tmp_value
\n"; # echo "
"; switch( $reg_id ){ case 'act_type': case 'from_code': break; default: $html_hidden .= "\n"; if( $from_code != $moji_code ){ # $reg_id = mb_convert_encoding($reg_id, $moji_code , $from_code); # $tmp_value = mb_convert_encoding($tmp_value, $moji_code , $from_code); } if( $db_data["$reg_id"] != "" ){ $db_data["$reg_id"] .= ",".$tmp_value; }else{ $db_data["$reg_id"] = $tmp_value; } #m_adが入力されてた場合、m_ad2と一致しない場合はエラー // if( ($act_type == "disp" ) and ($reg_id == 'm_ad') and ($tmp_value != "") and ($tmp_value != $_POST[m_ad2]) ){ // $act_type = "err"; // $err_msg = MSG_MAIL_ERR; // } # echo "reg_id,$reg_id
\n"; # echo "tmp_value,$tmp_value
\n"; $tmp_inp_data = $tmp_value; if( $from_code != $moji_code ){ $tmp_inp_data = mb_convert_encoding($tmp_inp_data, $moji_code , $from_code); } $arr_send_data[$tmp_rfm_data] = $tmp_inp_data; break; } } if( $act_type == "disp" ){ for($i=0;$i\n"; } } } } #echo "from_code,$from_code
"; #確認画面なしの場合、そのまま送信処理 if( $no_chk_flg ){ $act_type = "send"; } #if( $num == 0 ) { # $page_name = $form_page; #}else{ if( $act_type == "" ){ $page_name = $form_page; }elseif( $act_type == "disp" ){ $page_name = $disp_page; }elseif( $act_type == "send" ){ $page_name = $end_page; }else{ $page_name = $err_page; } #} #確認画面からの遷移の時、メールを送信する if( $act_type == "send" ){ $to = $db_data["m_ad"]; if( $to == "" ){ $to = $moto_mail; } $to_name = $db_data["name1"].$db_data["name2"]; if( $from_code != $moji_code ){ $to_name = mb_convert_encoding($to_name, $moji_code , $from_code); } $tmp_data = "-------------------------\r\n"; foreach($db_data as $post_name => $post_value){ if( $post_name == 'm_ad2' ){ continue; } if( $from_code != $moji_code ){ $post_value = mb_convert_encoding($post_value, $moji_code , $from_code); } $tmp_name = $arr_db_name[$post_name]; $tmp_data .= "$tmp_name : $post_value \r\n"; } $tmp_data .= "-------------------------\r\n"; // $body .= $tmp_data; $f_body .= $tmp_data; if( DEF_MAIL_SEND_FLG ){ #メールを送信(管理人→ユーザー) sendmail_to($to,$to_name,$moto_mail,$moto_name,$subject,$body,"","",1); } if( DEF_MAIL_SEND_ADMIN_FLG ){ #メールを送信(ユーザー→管理人) sendmail_to($moto_mail,$moto_name,$to,$to_name,$f_subject,$f_body,$cc,$bcc,2); } #一斉メール配信プログラムを呼び出す if( DEF_ISSEI_REN ){ main_call_issei(); } } require($page_name); exit(); #======================================================================================= #メールを送信 #======================================================================================= function sendmail_to($to,$to_name,$from,$from_name,$subject,$body,$cc,$bcc,$kind) { global $moji_code; // 半角カナを全角にする $subject = mb_convert_kana($subject, "KV" , $moji_code); $body = mb_convert_kana($body, "KV" , $moji_code); $from_name = mb_convert_kana($from_name, "KV" , $moji_code); $to_name = mb_convert_kana($to_name, "KV" , $moji_code); mb_language("Ja") ; mb_internal_encoding($moji_code) ; #ヘッダー $tmp_name = mb_encode_mimeheader($from_name); $header = "From: \"".$tmp_name."\" <".$from.">\n"; if( $cc != "" ){ $header .= "Cc: ".$cc."\n"; } if( $bcc != "" ){ $header .= "Bcc: ".$bcc."\n"; } if( $man_err_mail != "" ){ $header .= "Errors-To: ".$man_err_mail."\n"; $header .= "Return-Path: ".$man_err_mail."\n"; } #名前を置き換える if( $kind == "1" ){ $tmp_name = $to_name; }else{ $tmp_name = $from_name; } #メールタイトル $subject = str_replace("[name]", $tmp_name, $subject); #メール内容 $body = str_replace("[name]", $tmp_name, $body); if( ($body != "") and ($from != "") and ($to != "") ){ mb_language("Japanese"); mb_send_mail($to, $subject, $body, $header); } } //----------------------------------------------------- // アクセスしてきているのがケータイかどうか調べる // 現在判明している HTTP_USER_AGENT の値です // @return 0:携帯でない //      1:携帯 //      2:スマートフォン //----------------------------------------------------- function sub_data_isKeitai() { # return 1; # return 2; //iPhone if (preg_match("/iPhone/", $_SERVER['HTTP_USER_AGENT'])) return 2; //iPod if (preg_match("/iPod/", $_SERVER['HTTP_USER_AGENT'])) return 2; //iPad if (preg_match("/iPad/", $_SERVER['HTTP_USER_AGENT'])) return 0; //Android if (preg_match("/Android/", $_SERVER['HTTP_USER_AGENT'])) return 2; //NTT DoCoMo if (preg_match("/DoCoMo/", $_SERVER['HTTP_USER_AGENT'])) return 1; //旧J-PHONE~vodafoneの2G if (preg_match("/J-PHONE/", $_SERVER['HTTP_USER_AGENT'])) return 1; //vodafoneの3G if (preg_match("/Vodafone/", $_SERVER['HTTP_USER_AGENT'])) return 1; //vodafoneの702MOシリーズ if (preg_match("/MOT/", $_SERVER['HTTP_USER_AGENT'])) return 1; //SoftBankの3G if (preg_match("/SoftBank/", $_SERVER['HTTP_USER_AGENT'])) return 1; //au (KDDI) if (preg_match("/PDXGW/", $_SERVER['HTTP_USER_AGENT'])) return 1; if (preg_match("/UP\.Browser/", $_SERVER['HTTP_USER_AGENT'])) return 1; //ASTEL if (preg_match("/ASTEL/", $_SERVER['HTTP_USER_AGENT'])) return 1; //DDI Pocket if (preg_match("/DDIPOCKET/", $_SERVER['HTTP_USER_AGENT'])) return 1; //Googlebot-Mobile if (preg_match("/Googlebot-Mobile/", $_SERVER['HTTP_USER_AGENT'])) return 1; //WILLCOM if (preg_match("/WILLCOM/", $_SERVER['HTTP_USER_AGENT'])) return 1; return 0; } #======================================================================================= #一斉メール配信プログラムを呼び出す #======================================================================================= function main_call_issei(){ global $call_to_pgm,$fom_id,$arr_send_data,$arr_input; $data = array(); // 確認画面無し $data[act_type] = 'inp'; // フォームID $data[fom_id] = $fom_id; // メール非送信フラグON $data[nosend_flg] = '1'; // 文字コード判別用 $data[hanbetu] = '有朋自遠方来'; foreach($arr_input as $post_name => $post_value){ list($reg_id,$reg_name,$hissu_flg,$tmp_rfm_data) = split(",",$post_value); $data[$tmp_rfm_data] = $arr_send_data[$tmp_rfm_data]; } $options = array('http' => array( 'method' => 'POST', 'content' => http_build_query($data), )); $contents = file_get_contents($call_to_pgm, false, stream_context_create($options)); return; } ?>