<?php


##################################
#							色々な情報         #
##################################
$stamp = date("U");//タイムスタンプ
$ip = $_SERVER["REMOTE_ADDR"];//IPですね
$host = gethostbyaddr($ip);//ホストってやつです
$agent = $_SERVER['HTTP_USER_AGENT'];//UAですね
$sab = $_SERVER['HTTP_X_UP_SUBNO'];//携帯の個体識別番号ってやつです
$date = date("Y/m/d G:i");//時間表示ー



##################################
#					ポストゾーンなう       #
##################################
$title = $_POST['title'];
$name = $_POST['name'];
$mail = $_POST['mail'];
$com = $_POST['com'];


##################################
#					  	文字変換		       #
##################################
$title  = str_replace("<", "&lt;", $title);
$title  = str_replace(">", "&gt;", $title);
$title  = str_replace('"', "&quot;", $title);
$title  = str_replace('&', "&amp;", $title);

$name  = str_replace("<", "&lt;", $name);
$name  = str_replace(">", "&gt;", $name);
$name  = str_replace('"', "&quot;", $name);
$name  = str_replace('&', "&amp;", $name);

$mail  = str_replace("<", "&lt;", $mail);
$mail  = str_replace(">", "&gt;", $mail);
$mail  = str_replace('"', "&quot;", $mail);
$mail  = str_replace('&', "&amp;", $mail);

$com  = str_replace("<", "&lt;", $com);
$com  = str_replace(">", "&gt;", $com);
$com  = str_replace('"', "&quot;", $com);
$com  = str_replace('&', "&amp;", $com);
$com  = str_replace(array("\r\n","\r","\n"), " <br> ", $com );

$agent  = str_replace("<", "&lt;", $agent);
$agent  = str_replace(">", "&gt;", $agent);
$agent  = str_replace('"', "&quot;", $agent);
$agent  = str_replace('&', "&amp;", $agent);


##################################
#	 logファイルにφ(｀д´)ｶｷｶｷ   #
##################################
$fname_log = ("log.cgi");
$newdata = implode('<>',array($stamp,$title,"\r\n"));
$file = file("$fname_log");
array_unshift($file,$newdata);
$content=join('',$file);
$fp = fopen("$fname_log","r+");
fputs($fp,$content);
fclose($fp);



##################################
#					 HTMLどーん！！				 #
##################################
echo<<<suretai
<form action="form.php" method="post">
◆スレッドタイトル *<br>
<input type="text" name="title"><br>
suretai;
echo<<<surename
◆名前<br>
<input type="text" name="name" value=""><br>
surename;
echo<<<suremail
◆E-Mail<br>
<input type="text" name="mail" value=""><br>
suremail;
echo<<<surehonbun
◆本文 *<br>
<textarea name="com" cols="50" rows="13" wrap="soft"></textarea><br><br>
surehonbun;
echo<<<surebutton
<input type="hidden" name="mode" value="on">
<input type="submit" value="送信">
surebutton;

?>