/*-----------------------------------------------------
COPYRIGHT NOTICE
Copyright (c) 2002 by Aryadana
All Rights Reserved
Script name : ArdGuest Standard
Version : 1.0
WebSite : http://www.promosi-web.com/script/guestbook
Email : aryasmail@yahoo.com.au
File name : ardguest.php
------------------------------------------------------*/
//--Change the following variables
//Title of your guestbook
$title = "nancyleegrahn.com";
//Change "admin" with your own password. It's required when you delete an entry
$admin_password = "admin";
//Enter your email here
$admin_email = "admin@nancyleegrahn.com";
//Your website URL
$home = "http://www.nancyleegrahn.com";
//Send you an email when someone add your guestbook, YES or NO
$notify = "NO";
//Your Operating System
//For Windows/NT user : WIN
//For Linux/Unix user : UNIX
$os = "UNIX";
//Maximum entry per page when you view your guest book
$max_entry_per_page = "10";
//Name of file used to store your entry, change it if necessary
$data_file = "gb.dat";
//Maximum entry stored in data file
$max_record_in_data_file = "500";
//Color setting
$background = "#FFFFFF";
$table_top = "#835B7B";
$table_content_1a = "#E1D3DE";
$table_content_1b = "#ffffff";
$table_content_2a = "#E1D3DE";
$table_content_2b = "#ffffff";
$table_bottom = "#835B7B";
$table_border = "#000000";
$title_color = "#000000";
$title_color = "#000000";
//-- Don't change bellow this line
if (!defined('PMA_GRAB_GLOBALS_INCLUDED')) {
define('PMA_GRAB_GLOBALS_INCLUDED', 1);
if (!empty($_GET)) extract($_GET);
else if (!empty($HTTP_GET_VARS)) extract($HTTP_GET_VARS);
if (!empty($_POST)) extract($_POST);
else if (!empty($HTTP_POST_VARS)) extract($HTTP_POST_VARS);
}
if (!isset($PHP_SELF)) $PHP_SELF = $_SERVER["PHP_SELF"];
if (!isset($do)) $do = "";
if (!isset($page)) $page=1;
if (!file_exists($data_file)) {
if ($f = fopen($data_file,"w")) fclose($f);
else { echo "Error !!Can't create 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");
if (strtoupper($os)=="UNIX") {
if (flock($rf,2)):
for ($i=0; $i<$max_record_in_data_file; $i++):
fwrite($rf,$f[$i]);
endfor;
flock($rf,3);
endif;
} else {
for ($i=0; $i<$max_record_in_data_file; $i++):
fwrite($rf,$f[$i]);
endfor;
}
fclose($rf);
endif;
endif;
}
switch ($do) {
case "":
$record = file($data_file);
rsort($record);
$jmlrec = count($record);
?>
nancy lee grahn [dot] com // guestbook |
n a n c y l e e g r a h n [dot] c o m g u e s t b o o k
© 2003, nancyleegrahn.com break; case "add": if (trim($vname)=="" or trim($vcomment=="") or trim($vemail)=="") { echo "Error !You may left some fields. Please click here and try again."; exit; } if(!ereg("([[:alnum:]\.\-]+)(\@[[:alnum:]\.\-]+\.+)", $vemail)) { echo "Error !Invalid email address. Please click here and try again."; exit; } $test_comment = explode(" ",$vcomment); $jmltest = count($test_comment); for ($t=0; $t<$jmltest; $t++) { if (strlen(trim($test_comment[$t])) > 40) { echo "Error!Please don't abuse my guestbook. Click here and try again."; exit; } } $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); $vemail = str_replace("<","",$vemail); $vemail = str_replace(">","",$vemail); $vemail = str_replace("~","",$vemail); $vemail = str_replace("\"","",$vemail); $vcomment = str_replace("<","<",$vcomment); $vcomment = str_replace(">",">",$vcomment); $vcomment = str_replace("~","-",$vcomment); $vcomment = str_replace("\"",""",$vcomment); $vcomment = str_replace("\r\n","",$vcomment); if (eregi("<|>|\"\~",$vcountry)) $vcountry = "Unknown"; $newdata = "$idx|~~|$tgl|~~|$vname|~~|$vemail|~~|$vcountry|~~|$vcomment|~~|$vurl\n"; $newdata = stripslashes($newdata); $bagus = true; $cekdata = file($data_file); $jmlcekdata = count($cekdata); if ($jmlcekdata > 0): rsort($cekdata); if ($jmlcekdata > 3): $newrow = explode("|~~|",$newdata); $jmlentry = 0; for ($c=0; $c<3; $c++): $cekrow = explode("|~~|",$cekdata[$c]); if ($cekrow[3] == $newrow[3] or ($cekrow[2] == $newrow[2] and $cekrow[4] == $newrow[4])) $jmlentry++; endfor; if ($jmlentry < 3) $bagus = true; else $bagus = false; endif; endif; if ($bagus): $tambah = fopen($data_file,"a"); if (strtoupper($os)=="UNIX") { if (flock($tambah,2)): fwrite($tambah,$newdata); flock($tambah,3); endif; } else fwrite($tambah,$newdata); fclose($tambah); //--SEND MAIL if (strtoupper($notify)=="YES") { $msgtitle = "Someone signed your guestbook"; $vcomment = str_replace(""","\"",$vcomment); $vcomment = stripslashes($vcomment); $msgcontent = "Local time : $tgl\n\nThe addition from $vname reads :\n---------------------\n\n$vcomment\n\n-----End Message-----"; mail($admin_email,$msgtitle,$msgcontent,"From: $vemail\n"); } //----------- endif; if (isset($SERVER_SOFTWARE) && ereg("IIS",$SERVER_SOFTWARE)) { header("Refresh: 0; URL=$PHP_SELF"); echo " Thank you, your entry has been added.Please wait...Thank you, your entry has been added.Please wait...Delete Confirmation
Invalid admin password !Please wait...Invalid admin password !Please wait...Record has been deleted !Please wait...Record has been deleted !Please wait... |
© 2003, nancyleegrahn.com