0){ foreach($buff as $value){ $log_tmp=explode("<>",rtrim($value)); for($j=0;$j<=count($key_r);$j++){ if($log_tmp[$j])$log_put[$log_tmp[0]][$key_r[$j]]=$log_tmp[$j]; }$i++; } }return $log_put; } function load_log1($file_path,$type=''){ if(file_exists($file_path)){ $fp=@fopen($file_path,"r"); if(!$fp){$err_str='open err '.$file_path;}else{ while(!feof($fp)){ $temp = fgets($fp); if($temp!="")$buff[]=$temp; }fclose($fp); } }$i=0; if(isset($buff) && count($buff)>0){ foreach($buff as $value){ if($type=='html'){ $value= str_replace("<",'<',$value); $value= str_replace(">",'>',$value); $value= str_replace(""",'"',$value); $value= str_replace("&",'&',$value); }$log_put[$i]=$value;$i++; } }return $log_put; } function check($arr,$names='') { foreach($names as $name_key => $name_val){ if(!$arr[$name_key] && $name_val['hissu']=='on')$arr[$name_val['name']]=''; } foreach($arr as $key => $val) { if(is_array($val)){ $key = htmlspecialchars($key); foreach($val as $key2 => $val2) { if($key=='email' && $val2<>$val[0]){ $error_name[$key]='on'; }else if($key=='email' && !ereg("^[a-zA-Z0-9!$&*.=^`|~#%'+\/?_{}-]+@([a-zA-Z0-9_-]+\.)+[a-zA-Z]{2,4}$", $val2) ){ $error_name[$key]='on'; }else if($key==$names[$key]['name'] && $names[$key]['hissu']=='on' && !$val2)$error_name[$key]='on'; $val2 = htmlspecialchars($val2); $ret[$key][$key2] = strip_tags($val2); } }else{ if($names[$key]['hissu']=='on' && $val==''){ $error_name[$key]='on'; }else if($key=='email' && !ereg("^[a-zA-Z0-9!$&*.=^`|~#%'+\/?_{}-]+@([a-zA-Z0-9_-]+\.)+[a-zA-Z]{2,4}$", $val) ){ $error_name[$key]='on'; } $val = htmlspecialchars($val); $ret[$key] = strip_tags($val); } } $ret['error']=$error_name; return $ret; } if(ereg("^DoCoMo",$_SERVER['HTTP_USER_AGENT'])){$tanmatsu='i'; }else if(ereg("^J-PHONE|^Vodafone|^SoftBank|^iPhone",$_SERVER['HTTP_USER_AGENT'])){$tanmatsu='s'; }else if(ereg("^UP.Browser|^KDDI",$_SERVER['HTTP_USER_AGENT'])){$tanmatsu='au'; }else{$tanmatsu='pc';} switch($tanmatsu){ case 'i': case 's': case 'au': if(file_exists('./mb.html'))$html=load_log1('./mb.html','html'); if(file_exists('./data/res_mb.dat'))$res_tmp=load_log1('./data/res_mb.dat','html'); $table_s="
\n"; $table_e="
\n"; $tr_s='';$tr_e="\n"; $th_s=''; $error_flg='on'; }else if($post['edit']){unset($post['status']);} $form_f=''; switch($post['status']){ case 'preview': $form='
'."\n"; $form.='
'.$mes['title_view'].' > '.$mes['title_preview'].' > '.$mes['title_send'].'
'; $form.=$table_s; $count=0; foreach($names as $val){ $option=explode(",",$val['option']); if($count==0){$tr_class=' class="top"';}else{$tr_class='';} if(is_array($post[$val['name']])){ $form.=$tr_s.$th_s.$tr_class.$th_s2.$val['title'].$th_e.$td_s.$tr_class.$td_s2; foreach($post[$val['name']] as $key2=>$val2){ if($val['name']=='zip' && $key2=='0'){$zip_c=$mes['zip_mark'];}else{$zip_c='';} if($val['name']=='email' && $key2<>'0'){ $form.=$zip_c.''; }else{ $form.=$zip_c.''.$val2.$option[$key2].' '; } }$form.=$td_e.$tr_e; }else{ if($val['name']=='youbou'){ $val_youbou = nl2br($post[$val['name']]); $form.=$tr_s.$th_s.$tr_class.$th_s2.$val['title'].$th_e.$td_s.$tr_class.$td_s2. ''.$val_youbou.$td_e.$tr_e; } else{ $form.=$tr_s.$th_s.$tr_class.$th_s2.$val['title'].$th_e.$td_s.$tr_class.$td_s2. ''.$post[$val['name']].$td_e.$tr_e; } }$count++; } $form.= $table_e; $form.='
'.$mes['preview_mess'].'
'."\n".' 
'; foreach($html as $html_tmp){ if(ereg('',$html_tmp) && $flag=='on'){$flag=''; }else if($flag=='on'){ }else{$html_v.=$html_tmp;} } break; case 'send': $form='
'."\n"; $form.='
'.$mes['title_view'].' > '.$mes['title_preview'].' > '.$mes['title_send'].'
'."\n"; $count=0; foreach($names as $val){ $option=explode(",",$val['option']); if($count==0){$tr_class=' class="top"';}else{$tr_class='';} $kakunin.='■'.$val['title']."\n"; if(is_array($post[$val['name']])){ foreach($post[$val['name']] as $key2=>$val2){ if($val['name']=='name' && $key2==0){$kyaku_name=$val2;} if($val['name']=='zip' && $key2=='0'){$zip_c=$mes['zip_mark'];}else{$zip_c='';} if($val['name']=='email' && $key2=='0'){ $kakunin.=$val2;$kyaku_mail=$val2; }else if($val['name']<>'email'){ $kakunin.=$zip_c.''.$val2.$option[$key2].' '; } } }else{ if($val['name']=='name'){$kyaku_name=$val;} if($val['name']=='email'){$kyaku_mail=$val;} $kakunin.=$post[$val['name']]; }$kakunin.="\n\n";$count++; } $form.='
'.$mes['send_mess'].'
'; foreach($html as $html_tmp){ if(ereg('',$html_tmp) && $flag=='on'){$flag=''; }else if($flag=='on'){ }else{$html_v.=$html_tmp;} } $date_now=date( "Y, m/d (D) H:i:s", time() ); foreach($res_tmp as $res_val){ $res_val= str_replace('{name}',$kyaku_name,$res_val); $res_val= str_replace('{subject}',$mes['subject'],$res_val); $res_val= str_replace('{kaisya_name}',$mes['kaisya_name'],$res_val); $res_val= str_replace('{kaisya_mail}',$mes['kaisya_mail'],$res_val); $res_val= str_replace('{kaisya_url}',$mes['kaisya_url'],$res_val); $res_val= str_replace('{kakunin}',$kakunin,$res_val); $res.=$res_val; } foreach($res_tmp2 as $res_val){ $res_val= str_replace('{name}',$kyaku_name,$res_val); $res_val= str_replace('{subject}',$mes['kaisya_subject'],$res_val); $res_val= str_replace('{kaisya_name}',$mes['kaisya_name'],$res_val); $res_val= str_replace('{kaisya_mail}',$mes['kaisya_mail'],$res_val); $res_val= str_replace('{kaisya_url}',$mes['kaisya_url'],$res_val); $res_val= str_replace('{kakunin}',$kakunin,$res_val); $res_val= str_replace('{DATE_NOW}',$date_now,$res_val); $res_val= str_replace('{SERVER_NAME}',$_SERVER['SERVER_NAME'],$res_val); $res_val= str_replace('{SCRIPT_NAME}','http://'.$_SERVER['SERVER_NAME'].$_SERVER["SCRIPT_NAME"],$res_val); $res_val= str_replace('{USER_AGENT}',$_SERVER['HTTP_USER_AGENT'],$res_val); $res_val= str_replace('{HOST}',gethostbyaddr($_SERVER["REMOTE_ADDR"]),$res_val); $res_val= str_replace('{REMOTE_ADDR}',$_SERVER['REMOTE_ADDR'],$res_val); $res_kanri.=$res_val; } switch($mes['char_set']){ case 'UTF8': case 'UTF8': $char_set='UTF8'; break; default: $char_set=$mes['char_set']; break; } $res_kanri=mb_convert_kana($res_kanri,"KV",$char_set); $res=mb_convert_kana($res,"KV",$char_set); mb_language("ja"); mb_internal_encoding($char_set); $mail_header="From: ".mb_encode_mimeheader($mes['kaisya_name'])."<".$mes['kaisya_mail'].">"; $kanri_header="From: <".$kyaku_mail.">"; mb_send_mail($kyaku_mail,$mes['subject'],$res,$mail_header); mb_send_mail($mes['kaisya_mail'],$mes['kaisya_subject'],$res_kanri,$kanri_header); mb_send_mail($mes['kaisya_mail_cc'],$mes['kaisya_subject'],$res_kanri,$kanri_header); break; default: foreach($html as $html_tmp){ $val=$key=$hissu_mess=$error_css=''; foreach($post as $key=>$val){ if(is_array($val)){ $key2=$val2=''; foreach($val as $key2 => $val2){ if(preg_match("/$key\[$key2\]/",$html_tmp) ){ if($post['error'][$key]=='on' && !$post['edit'] && $error_flg=='on'){ $hissu_mess=$mess['hissu']; $error_css=' style="background-color:#E68E8E;" '; }else{ $hissu_mess=$error_css='';} if(ereg('type="text"',$html_tmp) ){ $html_tmp= str_replace('name="'.$key.'['.$key2.']"','name="'. $key.'['.$key2.']" value="'.$val2.'"'.$error_css,$html_tmp); }else if(ereg('type="checkbox"',$html_tmp) ){ $html_tmp= str_replace('value="'.$val2.'"','value="'.$val2.'" checked',$html_tmp); }else if(ereg('','>'.$val2.'',$html_tmp); }else if(ereg('',$error_css.'>'.$val.'',$html_tmp); }else if(ereg('',''.$error_mess,$html_tmp); $select_flg=''; } } if($select_flg=='on'){ if(ereg('','"'.$val.'" selected>'.$val.'',$html_tmp); }else{ $html_tmp= str_replace('>'.$val.'',' value="'.$val.'" selected>'.$val.'',$html_tmp); } } } } $html_tmp= str_replace("",''.$form_f,$html_tmp); $html_v.=$html_tmp; if(ereg(' > '.$mes['title_preview']. ' > '.$mes['title_send'].''.$error_div."\n"; } } break; } echo $html_v; ?>