Error !! Can't find data file : $data_file.
"; exit; } else { if ($max_record_in_data_file <> 0) { $f = file($data_file); rsort($f); $j = count($f); if ($j > $max_record_in_data_file) { $rf = fopen($data_file,"w"); for ($i=0; $i<$max_record_in_data_file; $i++) { fwrite($rf,$f[$i]); } fclose($rf); } }} switch ($do) { case "": $record = file($data_file); rsort($record); $jmlrec = count($record); ?> <?echo "$title"?> " link="" vlink="" alink="" topmargin="0" marginheight="0">


">SIGN                           
0) $jml_page++; $no = $page*$max_entry_per_page-$max_entry_per_page; if ($jmlrec == 0) echo ""; $w = 0; //--Color for ($i=0; $i<$max_entry_per_page; $i++) { $no++; $recno = $no-1; if (isset($record[$recno])) { $row = explode("|",$record[$recno]); if ($w==0) { $warna = $table_content_1a; $w=1; } else { $warna = $table_content_2a; $w=0; } //---Displaying Records-- echo ""; echo ""; } echo ""; echo ""; } //--end if } //--end for //--- Page Count Start echo ""; //---Page Count End ?>
Name Comments  
There is no entry yet.
"; echo ""; // echo ""; echo ""; echo ""; echo "
$no  $row[3]  
"; if (trim($row[7])<>"" and trim($row[7])<>"http://") { if (ereg("^http://", trim($row[7]))) echo ""; else echo "";} echo "   $row[4]
Location : $row[5]
$row[2]"; if (trim($row[4])<>"") { echo "           Email $row[3]   > > 

$row[6]
Delete entry # $no
"; if ($jml_page > 1) { if ($page <> 1) echo "To First Entry      "; else echo " "; echo "Page > "; if ($jml_page > 10) { if ($page < 5) { $start = 1; $stop = 10; } elseif ($jml_page - $page < 5) { $start = $jml_page - 9; $stop = $jml_page; } else { $start = $page-4; $stop = $page+5; } if ($start <> 1) echo "... "; for ($p=$start; $p<=$stop; $p++) { if ($p == $page) echo "$p  "; else echo "$p  "; } if ($stop <> $jml_page) echo "... "; echo "of $jml_page "; } else { for ($p=1; $p<=$jml_page; $p++) { if ($p == $page) echo "$p  "; else echo "$p  "; }} if ($page <> $jml_page) echo "     To Last Entry"; else echo " "; } else echo "Page #1 of 1"; echo "

<? echo "$title"?> ">


"> "; ?> ">
"> ">"> ">">">
Sign the Guestbook:
 *Name
 Email
change if you wish
 Website
*Location 
 *Comment
Type in the number after the box "; } ?> (anti-spam)
> '">
70) $vname = substr($vname,0,70); } if (isset($_POST["vemail"])) { $vemail = $_POST["vemail"]; if (strlen($vemail) > 100) $vemail = substr($vemail,0,100); } if (isset($_POST["vurl"])) { $vurl = $_POST["vurl"]; if (strlen($vurl) > 150) $vurl = substr($vurl,0,150); } if (isset($_POST["vcountry"])) { $vcountry = $_POST["vcountry"]; if (strlen($vcountry) > 50) $vcountry = substr($vcountry,0,50); } if (isset($_POST["vcomment"])) $vcomment = $_POST["vcomment"]; } else if (!empty($HTTP_POST_VARS)) { if (isset($HTTP_POST_VARS["vname"])) { $vname = $HTTP_POST_VARS["vname"]; if (strlen($vname) > 70) $vname = substr($vname,0,70); } if (isset($HTTP_POST_VARS["vemail"])) { $vemail = $HTTP_POST_VARS["vemail"]; if (strlen($vemail) > 100) $vemail = substr($vemail,0,100); } if (isset($HTTP_POST_VARS["vurl"])) { $vurl = $HTTP_POST_VARS["vurl"]; if (strlen($vurl) > 150) $vurl = substr($vurl,0,150); } if (isset($HTTP_POST_VARS["vcountry"])) { $vcountry = $HTTP_POST_VARS["vcountry"]; if (strlen($vcountry) > 50) $vcountry = substr($vcountry,0,50); } if (isset($HTTP_POST_VARS["vcomment"])) $vcomment = $HTTP_POST_VARS["vcomment"]; } if (trim($vname)=="" or trim($vcountry)=="" or trim($vcomment)=="" or trim($vemail)=="") { echo "

Error !

Required field empty.

Go BACK and try again.
"; exit; } if (trim($vemail)!="" and !preg_match("/([\w\.\-]+)(\@[\w\.\-]+)(\.[a-z]{2,4})+/i", $vemail)) { echo "

Error !

Invalid email address.

Go BACK and try again.
"; exit; } if (trim($vurl) <> "") { if (strtolower(trim($vurl)) <> "http://") { if (!preg_match ("#^http://[_a-z0-9-]+\\.[_a-z0-9-]+#i", $vurl)) { echo "

Error !

Website Invalid URL format.

Go BACK and try again.
"; exit; } } } $bad_words = explode('|', 'fuck|shit|cunt|arse|nigger'); foreach ($bad_words as $naughty) { $vcomment = eregi_replace($naughty, "***", $vcomment); } $test_comment = explode(" ",$vcomment); $jmltest = count($test_comment); for ($t=0; $t<$jmltest; $t++) { if (strlen(trim($test_comment[$t])) > 25) { echo "

Error!

A germungulous big word appears - GAH !.
Beyond my little brain.

Go BACK and try again.
"; exit; } } //characters allowed for comment $maxchar = 1000; if (strlen($vcomment) > $maxchar) $vcomment = substr($vcomment,0,$maxchar)."..."; $idx = date("YmdHis"); $tgl = date("F d, Y - h:i A"); $vname = str_replace("<","",$vname); $vname = str_replace(">","",$vname); $vname = str_replace("~","-",$vname); $vname = str_replace("\"",""",$vname); $vcomment = str_replace("<","<",$vcomment); $vcomment = str_replace(">",">",$vcomment); $vcomment = str_replace("~","-",$vcomment); $vcomment = str_replace("\"",""",$vcomment); $vurl = str_replace("<","",$vurl); $vurl = str_replace(">","",$vurl); $vcomment = str_replace("\r\n","
",$vcomment); $vcomment = str_replace("\r","",$vcomment); $vcomment = str_replace("\n","",$vcomment); if (preg_match("#<|>|\"\~#",$vcountry)) exit; if (preg_match("/[^a-z ]/i",$vcountry)) $vcountry = "..."; #### anti-spam stuff if (empty($_POST['spam_entry'])) {echo "

Error!

you need to enter the anti-spam number.

Go BACK and try again.
"; exit();} if (!empty($_POST['spam_entry'])) { $spam_entry = $_POST['spam_entry']; $spam_code = $_POST['spam_code']; if ($spam_entry != $spam_code ) {echo "

Error!

the anti-spam number you entered
does not match the number displayed.

Go BACK and try again.
"; exit();} } $newdata = "|$idx|$tgl|$vname|$vemail|$vcountry|$vcomment|$vurl\n"; $newdata = stripslashes($newdata); $tambah = fopen($data_file,"a"); fwrite($tambah,$newdata); fclose($tambah); $newdata=""; echo "

Thank you, your entry has been added.

Please wait...
"; break; case "del": $record = file($data_file); $jmlrec = count($record); for ($i=0; $i<$jmlrec; $i++) { $row = explode("|",$record[$i]); if ($id == $row[1]) { echo " Delete record
Delete Confirmation

$row[2]
$row[3]
from $row[5]
$row[4]

$row[6]

"; break;}} echo "
Admin password :

"; break; case "del2": if (isset($_POST["pwd"])) $pwd = $_POST["pwd"]; else if (isset($HTTP_POST_VARS["pwd"])) $pwd = $HTTP_POST_VARS["pwd"]; if (isset($_POST["id"])) $id = $_POST["id"]; else if (isset($HTTP_POST_VARS["id"])) $id = $HTTP_POST_VARS["id"]; if (isset($_POST["page"])) $page = $_POST["page"]; else if (isset($HTTP_POST_VARS["page"])) $page = $HTTP_POST_VARS["page"]; if ($pwd <> $admin_password) { echo "

Invalid admin password !

Please wait...
"; exit; } $record = file($data_file); $jmlrec = count($record); for ($i=0; $i<$jmlrec; $i++) { $row = explode("|",$record[$i]); if ($id==$row[1]) { $record[$i] = ""; break; } } $update_data = fopen($data_file,"w"); for ($j=0; $j<$jmlrec; $j++) { if ($record[$j] <> "") fputs($update_data,$record[$j]); } fclose($update_data); echo "

Record has been deleted !

Please wait...
"; break; } //--end switch ?>