一个迷你php留言板, 代码如下:)
<?php /*此程序纯属娱乐!不得用于非法用途,滥用者后果自付!*/ ?>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=gb2312″ />
<title>Chating Room</title>
<style type=”text/css”>
html{background:#f7f7f7;}
pre{font-size:15pt;font-family:Times New Roman;line-height:120%;}
p{font-size:10pt;}
.tx{font-family:Lucida Handwriting,Times New Roman;}
</style>
</head>
<center>
<h3><b>Chating Room</b></h3>
<?php
date_default_timezone_set(“PRC”);
$act = $_POST[“act”];
if (!empty($act) && $act==”Submit”){$data = addslashes(trim($_POST[‘what’]));}
if (!empty($data))
{
//$data = str_replace(array(‘<‘,’>’,'”‘,’script’,’alert’,’eval’,'(‘,’)’,’.’,’@’),array(‘<’,’>’,'[我是引号]’,'[sXript]’,'[我想弹窗]’,'[邪恶的eval]’,’|’,’|’,'[dot]’,'[at]’),$data);
$data = str_replace(array(“<“,”>”),array(“<”,”>”),$data);
$ip = preg_replace(“/((?:\d+\.){3})\d+/”,”\\1*”,$_SERVER[“REMOTE_ADDR”]);
$time = date(“Y-m-d G:i:s A”);
$text = “<pre>”.$data.”<p>”.$ip.” >>> Submited at:”.$time.”</p></pre>\n”;
$file = fopen(__FILE__,’a’);
fwrite($file,$text);
fclose($file);
echo “<script>location.replace(location.href);</script>”;
}
?>
<hr>
<form method=”post” action=””>
<textarea rows=”5″ style=”font-family:Times New Roman;font-size:14pt;” cols=”80″ name=”what” onclick=”this.value=”;”>说点什么?</textarea>
<p class=”tx”>Powered By ??? ©2011</p>
<input name=”act” type=”submit” value=”Submit” title=”提交” style=”width:120px;height:64px;”>
</form>
</center>
alert(123);