<?
// Easy News Board 1.0
// by burin rujjanapan webmaster@thaiall.com
// ระบบกระดานข่าวอย่างง่าย ไว้ประกาศข่าวส่วนตัว
// chat1.php?act=post&passwd=lampang
//
// ตัวอย่างการเขียน iframe
// <iframe src=http://lampang.thcity.com/chat.php height="300"
// width="550" marginwidth="0" marginheight="0" vspace="0" hspace="0" frameborder="2">
// </iframe>
//
// Default value
$mainpasswd = "lampang";
$f="chat1.txt";
$p="chat1.php";
$maxline=10;
// end of default value
?>
<font color=black face="microsoft sans serif" size=0>
<?
if (isset($mg)) { $mgx = $mg; }
if (isset($_POST['mg'])) { $mgx = $_POST['mg']; }
if (isset($del)) { $delx = $del; }
if (isset($_POST['del'])) { $delx = $_POST['del']; }
if (isset($act)) { $actx = $act; }
if (isset($_GET['act'])) { $actx = $_GET['act']; }
if (isset($passwd)) { $passwdx = $passwd; }
if (isset($_GET['passwd'])) { $passwdx = $_GET['passwd']; }
if (isset($actx) && isset($passwdx)) {
if ($actx=="post" && $passwdx==$mainpasswd) {
echo "<form action=$p method=post>ข้อความ:<input name=mg size=80><br>";
echo "<input type=submit><input type=reset><hr color=red>";
echo "บรรทัดที่ต้องการลบ:<input name=del size=4>";
echo "<input type=submit><input type=reset><hr color=red>";
}
}
if (file_exists($f)) {
$ar=file($f);
if ((isset($mgx) && strlen($mgx) > 2) || (isset($delx) && $delx > 0)) {
$file=fopen($f,"w");
for ($i=0;$i<=count($ar)-1;$i++) {
if ($delx == (count($ar) - $i)) {
echo "<font color=red>$ar[$i]</font>";
} else {
fputs($file,"$ar[$i]");
}
}
if (strlen($mgx) > 2) { fputs($file,$mgx.chr(13).chr(10)); }
fclose($file);
echo "<br><a href=$p?act=post&passwd=$mainpasswd>BACK</a><ol>";
$ar=file($f);
for ($i=count($ar)-1;$i>=0;$i--) { echo "<li>$ar[$i]"; }
echo "</ol>";
} else {
$ar=file($f);
for ($i=count($ar)-1;$i>=0;$i--) { echo "$ar[$i]<br>"; }
echo "<a href=$p?act=post&passwd=lampang>.</a>";
}
} else {
$file=fopen($f,"w");
for ($i=$maxline;$i>=0;$i--) {
fputs($file,"test".$i.chr(13).chr(10));
}
fclose($file);
echo "<br>Please remember : <a href=$p?act=post&passwd=lampang>$p?act=post&passwd=lampang</a>";
}
?></form></body></html>
จำนวน : 67 บรรทัด