//Username,Password สำหรับลบ Guestbook****(ควรจะเปลี่ยน)
$username="admin";
$password="nadia";
$listpage=10;//จำนวนที่จะแสดงต่อ1หน้า
$question="ผลการเรียนที่ท่านคาดหวังในรายวิชานี้ อยู่ในระดับใด";
$Choice=array("ดีมาก","ดี","พอใช้","ต้องปรับปรุง");
//ตั้งค่าความต่างของเวลา Server กับ ประเทศไทย
$hour = 0; //ปรับให้ตรงตามต้องการ
$min = 0; //ปรับให้ตรงตามต้องการ
$Year = date("y")+43;
$thaimonth=array("ม.ค.","ก.พ.","มี.ค.","เม.ย.","พ.ค.","มิ.ย.","ก.ค.","ส.ค.","ก.ย.","ต.ค.", "พ.ย.","ธ.ค.");
//3 ต.ค.45
$mdate = date("j ").$thaimonth[date("m")-1]."".$Year.date(" - H:i ",mktime( date("H")+$hour, date("i")+$min ));
$power="
liengz@hotmail.com";
Function AdminLogin($no)
{
echo"กรุณาล็อกอินก่อน";
echo"";
}
Function Check($text)
{
$text = stripslashes(htmlspecialchars($text));
$text = eregi_replace ( "\n"," ",$text);
$text = eregi_replace ( "<","<",$text);
$text = eregi_replace ( ">",">",$text);
return ($text);
}
//ฟังก์ชั่นตัดคำหยาบซึ่งสามารถเพิ่มคำที่ต้องการตัดได้
function CheckRude($text){
$wordrude = array(
"ashole","a s h o l e","a.s.h.o.l.e","bitch","b i t c h","b.i.t.c.h","shit","s h i t","s.h.i.t","fuck",
"dick","f u c k","d i c k","f.u.c.k","d.i.c.k","มึง","มึ ง","กู","ควย","ค ว ย","ค.ว.ย",
"คอ วอ ยอ","คอ-วอ-ยอ","ปี้","เหี้ย","เฮี้ย","ชาติหมา","ชาดหมา","ช า ด ห ม า","ช.า.ด.ห.ม.า","ช า ติ ห ม า",
"ช.า.ติ.ห.ม.า","ไอ้","สัดหมา","สัด","เย็ด","หี","สันดาน","แม่ง","ระยำ","ส้นตีน","แตด") ;
$wordchange = ("+++") ;
for ( $i=0 ; $i";
echo"";
}
echo" ลงทะเบียนก่อนเข้าชั้นเรียนนะครับ
";
$totalfile=fopen("total.txt","r");
$total=fread($totalfile,filesize("total.txt"));
echo"มีผู้เข้าเรียนทั้งหมด $total คน ";
fclose($totalfile);
if(empty($action))
echo"$power";
if($action=="sign")
{
Formguest();
}
if($sign)
{
$total=$total+1;
$listfile="./list/user$total.txt";
if($homepage=="")
$homepage="nohomepage";
$openlistfile=fopen($listfile,"w");
$name=Check($name);
$email=Check($email);
$homepage=Check($homepage);
$comment=Check($comment);
$name=CheckRude($name);
$email=CheckRude($email);
$homepage=CheckRude($homepage);
$comment=CheckRude($comment);
if(fputs($openlistfile,"$name\n$email\n$homepage\n$list_choice\n$comment\n$mdate"))
echo" ****ได้รับข้อมูลแล้วครับ****";
else
echo" !!!!ไม่สามารถบันทึกข้อมูลได้!!!!";
fclose($openlistfile);
$totalfile=fopen("total.txt","w");
fputs($totalfile,$total);
fclose($totalfile);
}
if($action=="view")
{
$font="cc9933";
if(isset($nextpage))
$nextpage=$nextpage;
else
$nextpage=1;
for($i=$nextpage;$i<$nextpage+$listpage;$i++)
{
$listfile="./list/user$i.txt";
if(file_exists($listfile))
{
echo"";
$listarr=file($listfile);
echo "ลำดับที่ : $i | ";
echo "ชื่อ : $listarr[0] | ";
echo "อีเมล์ : $listarr[1] | ";
echo "โฮมเพจ : ";
$home=trim($listarr[2]);
if($home!="nohomepage")
echo"$home | ";
else
echo"";
echo" ";
echo "$question : $listarr[3] | ";
echo "ข้อเสนอแนะ | ";
echo"$listarr[4] | ";
echo "เซ็นต์วันที่ : $listarr[5] | ";
echo " | ";
echo" ";
echo" ";
}
else
echo" ";
if($i==$total)
break;
}
$over=$total%$listpage;
if($over!=0)
$totalpage=floor($total/$listpage)+1;
else
$totalpage=floor($total/$listpage);
if($total>$listpage)
{
echo"หน้าที่";
for($i=1;$i<=$totalpage;$i++)
{
$nextpage=($i-1)*$listpage;
$nextpage=$nextpage+1;
echo"$i ";
}
}
}
if($action=="delete")
{
if(!$loggin)
{
AdminLogin($no);
}
else
{
if(($uname==$username) and ($pword==$password))
{
if(!$confirm)
{
$font="cc9933";
$listfile="./list/user$no.txt";
$listarr=file($listfile);
echo" คุณต้องการลบไช่หรือไม่";
echo"";
echo" ";
}
else
{
$file="./list/user$no.txt";
if(unlink($file))
echo" ****ลบไฟล์สำเร็จ****";
else
echo" !!!!ลบไฟล์ไม่สำเร็จ!!!!!";
}
}
else
{
echo"Username หรือ Password ผิด";
AdminLogin($no);
}
}
}
?>
|
|