e-mail address format error\n"; echo "click BACK at your brower and try it again
"; echo "

正しいe-mailアドレスの形式ではありません


"; echo "ブラウザのバックボタンで戻って正しく入力してください
"; exit; } if ($com==""){ echo "

Empty body not allowd

\n"; echo "click BACK at your brower and try it again
"; echo "空のメールは送れません
"; exit; } if ($name==""){ echo "

Empty name not allowd

\n"; echo "click BACK at your brower and try it again
"; echo "名前を入れてください
"; exit; } $rv=read_time(); if ($rv+60>time()){ echo "

Busy, wait for 1 min.

"; echo "

ビジーです。バックボタンで戻って1分お待ちください。

"; exit; } $ip = getenv("REMOTE_ADDR"); if($ip == "127.0.0.1") $ip = "$HTTP_X_FORWARDED_FOR"; $ip = "IP:" . gethostbyaddr($ip); $agent=getenv("HTTP_USER_AGENT"); $mail="From: $email"; $body = "Name: $name\n"; $body .= $com . "\n------------------\n" . $ip . "\n" . "agent: " . $agent; $add = mb_encode_mimeheader("wgbns980@ybb.ne.jp"); $from = mb_encode_mimeheader($mail); $body = mb_convert_encoding($body, "JIS", "EUC-JP");; $subject = mb_encode_mimeheader("Mail from www.hideaki-yoshioka.com"); mail($add, $subject, $body, $from . "\nMime-Version: 1.0\nContent-Type: text/plain; charset=iso-2022-jp"); write_time(); echo "Thanks
Top\n"; exit; } /* 3 functions can be used */ function valid_email($email) { $hostname=pickuphost($email); if ($hostname<0){ return $hostname; } $rv=isvalidmailhost($hostname); return $rv; } /* abc@www.def.com -> www.def.com */ function pickuphost($email) { $loc=strpos($email,'@'); if ($loc== FALSE){ return -2; } $len=strlen($email); $sublen=$len-$loc-1; $thestr=substr($email,$email+$loc+1,$sublen); /* echo "! $thestr !
"; */ return $thestr; } /* chech hostname is valid for e-mail address */ /* www.hart.co.jp, hart.co.jp= 0, error: not zero */ function isvalidmailhost($host){ $host=$host."."; $addr=gethostbyname($host); if ($addr==$host){ if ( checkdnsrr( $host ) == FALSE ){ if ( getmxrr( $host, $mxhosts ) == FALSE ){ return -1; } else { return 0; /* hart.co.jp format */ } } } return 0; /* www.hart.co.jp format */ } /* check the previous post, if submitted within 60sec, refuse against cracking */ function write_time() { $timefile='/home/yoshioka/www/data/lasttime.txt'; $fd=fopen($timefile,"w"); if ($fd==NULL){ echo "

write_time: file write error

"; return 0; /* safety */ } $thetime=time(); fputs($fd, $thetime . "\n" ); fclose($fd); } function read_time() { $timefile='/home/yoshioka/www/data/lasttime.txt'; $fd=fopen($timefile,"r"); if ($fd==NULL){ return 0; /* safety */ } fscanf($fd,"%u",$thetime); //echo "

" . $thetime . "

"; fclose($fd); return $thetime; } /*-------------------------------------------------*/ ?> Mail
>

Mail to Hideaki Yoshioka

お名前 Your Name
メールアドレス email
メッセージ Message