2 /*-----------------------------------------------------
\r
4 Copyright (c) 2001 - 2005, Ketut Aryadana
\r
7 Script name : ArdGuest
\r
9 Website : http://www.promosi-web.com/script/guestbook/
\r
10 Email : ketutaryadana@yahoo.co.id
\r
12 By using this program you agree to indemnify the author (Ketut Aryadana) from any liability
\r
13 caused by mis-use, unauthorised access, loss of data, or financial losses that occur
\r
14 as a result of installing or using this product.
\r
15 ------------------------------------------------------*/
\r
17 //--Change the following variables
\r
19 //Title of your guestbook
\r
20 $title = "Memorial for Carlos Gomes De Faria";
\r
21 //Change "admin" with your own password. It's required when you delete an entry
\r
22 $admin_password = "teafor6265";
\r
23 //Enter your email here
\r
24 $admin_email = "Andrew@DeFaria.com";
\r
26 $home = "http://defaria.com";
\r
27 //Send you an email when someone add your guestbook, YES or NO
\r
29 //Your Operating System
\r
30 //For Windows/NT user : WIN
\r
31 //For Linux/Unix user : UNIX
\r
33 //Maximum entry per page when you view your guestbook
\r
34 $max_entry_per_page = "10";
\r
35 //Name of file used to store your entry, change it if necessary
\r
36 $data_file = "dad.dat";
\r
37 //Maximum entry stored in data file
\r
38 $max_record_in_data_file = "300";
\r
39 //Maximum entries allowed per session, to prevent multiple entries made by one visitor
\r
40 $max_entry_per_session = 2;
\r
41 //Color & font setting
\r
42 $background = "#555555";
\r
43 $table_top = "#D3B68E";
\r
44 $table_content_1a = "#EDEEE8";
\r
45 $table_content_1b = "#E4E4E4";
\r
46 $table_content_2a = "#FFF8F0";
\r
47 $table_content_2b = "#FFEFDF";
\r
48 $table_bottom = "#D3B68E";
\r
49 $table_border = "#000000";
\r
50 $title_color = "yellow";
\r
52 $visited_link = "white";
\r
53 $active_link = "red";
\r
54 $font_face = "verdana";
\r
55 $message_font_face = "arial";
\r
56 $message_font_size = "2";
\r
58 //-- Don't change bellow this line unless you know what you're doing
\r
60 $do = isset($_REQUEST['do']) ? trim($_REQUEST['do']) : "";
\r
61 $id = isset($_GET['id']) ? trim($_GET['id']) : "";
\r
62 $page = isset($_GET['page']) ? $_GET['page'] : 1;
\r
63 $self = $_SERVER['PHP_SELF'];
\r
65 if (!file_exists($data_file)) {
\r
66 echo "<b>Error !!</b> Can't find data file : $data_file.<br>";
\r
69 if ($max_record_in_data_file != "0") {
\r
70 $f = file($data_file);
\r
73 if ($j > $max_record_in_data_file) {
\r
74 $rf = fopen($data_file,"w");
\r
75 if (strtoupper($os)=="UNIX") {
\r
76 if (flock($rf,LOCK_EX)) {
\r
77 for ($i=0; $i<$max_record_in_data_file; $i++) {
\r
78 fwrite($rf,$f[$i]);
\r
83 for ($i=0; $i<$max_record_in_data_file; $i++) {
\r
84 fwrite($rf,$f[$i]);
\r
92 $newline = (strtoupper($os) == "WIN") ? "\r\n" : "\n";
\r
95 $record = file($data_file);
\r
97 $jmlrec = count($record);
\r
100 <head><title><?=$title?></title></head>
\r
101 <body bgcolor="<?=$background?>" link="<?=$link?>" vlink="<?=$visited_link?>" alink="<?=$active_link?>" topmargin="0" marginheight="0" style="font-family:<?=$font_face?>">
\r
103 <font size="6" color="<?=$title_color?>"><b><?=$title?></b></font><br>
\r
104 <font size="2" color="<?=$title_color?>"><b><a href="indexp.php"><font color="<?=$title_color?>">Portuguese</font></a></b></font><br><br></center>
\r
106 <table border=0 cellspacing=0 cellpadding=3 align=right>
\r
110 <a href="/gallery/main.php?g2_view=core.ShowItem&g2_itemId=3424"><img align="right" src="/Images/Dad.jpg" border=0 width=200 height=240></a>
\r
114 <font size="2" color=white><a href="/gallery/main.php?g2_view=core.ShowItem&g2_itemId=3424">More photos added 4/25/2006<br>Click here</font></a>
\r
120 <font size="2" color=white><p><a href="/gallery/main.php?g2_view=core.ShowItem&g2_itemId=3424"><b>Charles Gomes De Faria</b></a> age 81,
\r
121 passed away on March 19, 2006 in Santos Brazil. Originally from Newark
\r
122 N.J.he served in the Army in WWII under General Patton's command. He
\r
123 recieved an honorable discharge. He later married and moved to Linden
\r
124 N.J.had 5 children.. He moved to Santos, Brazil in 1970 and has
\r
125 lived there the remainder of his life</p>
\r
127 <p>He leaves behind his companion Hilda and his 5 children from his
\r
128 former marriage. Roxanne Johansen from Oldsmar Fl, Raymond De Faria
\r
129 from Clearwater Fl, Christina De Faria from Lawrenceville Ga , Andrew
\r
130 De Faria from San Jose Ca.and Cindy Anderson from.Oviedo Fl. He also
\r
131 leaves 5 grandchildren his only sister Mrs. Mary Arminio from W. Palm
\r
132 Beach Fl and a niece Diane Perry from Port St. Lucie and 3 Great
\r
135 <p>He will be missed very much by the entire family. A Memorial Mass
\r
136 will be held for him at St. Lukes Catholic Church in Palm Springs,
\r
137 Florida on April 23, 2006.</p>
\r
139 <p>If you would want you can leave any comment you would like below.</p>
\r
141 <table width="600" cellpadding="0" cellspacing="1" border="0" align=center>
\r
142 <tr bgcolor="<?=$table_border?>">
\r
144 <table width="100%" cellpadding="4" cellspacing="1" border="0">
\r
146 <td bgcolor="<?=$table_top?>" colspan="3" width="100%">
\r
147 <font size="2" color="#ffffff"><b>Click <a href="<?="$self?do=add_form&page=$page"?>">here</a> to sign the memorial</font></b>
\r
151 $jml_page = intval($jmlrec/$max_entry_per_page);
\r
152 $sisa = $jmlrec%$max_entry_per_page;
\r
153 if ($sisa > 0) $jml_page++;
\r
154 $no = $page*$max_entry_per_page-$max_entry_per_page;
\r
155 if ($jmlrec == 0) echo "<tr><td colspan=\"3\" bgcolor=\"#FFE1E1\" align=\"center\"><font size=\"3\">There are no entries yet.</font></td></tr>";
\r
158 for ($i=0; $i<$max_entry_per_page; $i++) {
\r
161 if (isset($record[$recno])) {
\r
162 $row = explode("|~|",$record[$recno]);
\r
164 $warna = $table_content_1a;
\r
165 $warna2 = $table_content_1b;
\r
168 $warna = $table_content_2a;
\r
169 $warna2 = $table_content_2b;
\r
173 <td bgcolor=\"$warna2\" align=\"center\" valign=\"top\" width=\"15\">
\r
174 <font size=\"2\">$no</font>
\r
176 <td bgcolor=\"$warna\" width=\"570\">
\r
177 <table border=\"0\" width=\"100%\">
\r
180 <font size=\"1\">$row[2]</font><br>
\r
181 <font size=\"2\"><b>$row[3]</b></font>
\r
184 echo "<td align=\"right\" valign=\"top\">";
\r
185 if (trim($row[4]) != "") {
\r
186 echo "<a href=\"mailto:$row[4]\"><img src=\"imgs/email.gif\" border=\"0\" alt=\"$row[4]\"></a>";
\r
188 if (trim($row[6]) != "" && trim($row[6]) != "http://") {
\r
189 if (ereg("^http://", trim($row[6]))) echo " <a href=\"$row[6]\" target=\"_blank\"><img src=\"imgs/homepage.gif\" border=\"0\" alt=\"$row[6]\"></a>";
\r
190 else echo " <a href=\"http://$row[6]\" target=\"_blank\"><img src=\"imgs/homepage.gif\" border=\"0\" alt=\"$row[6]\"></a>";
\r
192 echo "</td></tr></table>";
\r
193 echo "<br><table border=\"0\" width=\"100%\">
\r
194 <tr><td width=\"5\"> </td><td>
\r
195 <font size=\"2\" face=\"$message_font_face\" size=\"$message_font_size\">".stripslashes($row[5])."</font>
\r
200 echo "<td valign=\"top\" bgcolor=\"$warna2\" align=\"center\" width=\"15\">
\r
201 <a href=\"$self?do=del&id=$row[1]&page=$page\">
\r
202 <img src=\"imgs/del.gif\" alt=\"Delete entry # $no\" border=0 align=\"center\"></a>
\r
207 echo "<tr><td colspan=\"3\" bgcolor=\"$table_bottom\" align=\"center\" width=\"600\"><font size=\"2\">";
\r
208 if ($jml_page > 1) {
\r
209 if ($page != 1) echo "[<a href=\"$self?page=1\">Top</a>] "; else echo "[Top] ";
\r
211 if ($jml_page > 10) {
\r
215 } elseif ($jml_page - $page < 5) {
\r
216 $start = $jml_page - 9;
\r
222 if ($start != 1) echo "... ";
\r
223 for ($p=$start; $p<=$stop; $p++) {
\r
224 if ($p == $page) echo "<font color=\"$active_link\"><b>$p</b></font> ";
\r
225 else echo "<a href=\"$self?page=$p\">$p</a> ";
\r
227 if ($stop != $jml_page) echo "... ";
\r
228 echo "of $jml_page ";
\r
230 for ($p=1; $p<=$jml_page; $p++) {
\r
231 if ($p == $page) echo "<font color=\"$active_link\"><b>$p</b></font> ";
\r
232 else echo "<a href=\"$self?page=$p\">$p</a> ";
\r
235 if ($page != $jml_page) echo "[<a href=\"$self?page=$jml_page\">Bottom</a>]";
\r
236 else echo "[bottom]";
\r
237 } else echo "Page #1 of 1";
\r
238 echo "</font></td></tr>";
\r
252 $_SESSION['secc'] = strtoupper(substr(md5(time()),0,4));
\r
253 if (!isset($_SESSION['add'])) $_SESSION['add'] = 0;
\r
255 if (!isset($_SESSION['name'])) $_SESSION['name'] = "";
\r
256 if (!isset($_SESSION['email'])) $_SESSION['email'] = "";
\r
257 if (!isset($_SESSION['url'])) $_SESSION['url'] = "http://";
\r
258 if (!isset($_SESSION['comment'])) $_SESSION['comment'] = "";
\r
262 <title><?=$title?></title>
\r
263 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
\r
266 <body bgcolor="<?=$background?>" style="font-family:<?=$font_face?>">
\r
267 <div align="center">
\r
268 <font size="5" color="<?=$title_color?>"><b><?=$title?></b></font><br>
\r
269 <font size="1"><b><a href="<?=$home?>"><font color="<?=$title_color?>">Home</font></a> :: <a href="<?=$self?>"><font color="<?=$title_color?>">View entry</font></a></b></font>
\r
270 <form method="post" action="<?=$self?>">
\r
271 <input type="hidden" name="do" value="add">
\r
272 <table width="500" border="0" cellspacing="0" cellpadding="0" bgcolor="<?=$table_border?>">
\r
275 <div align="center">
\r
276 <table width="100%" border="0" cellspacing="1" cellpadding="5">
\r
277 <tr bgcolor="<?=$table_content_1a?>">
\r
279 <div align="right"><font size="2">*Name : </font></div>
\r
282 <input type="text" name="vname" size="30" maxlength="70" value="<?=$_SESSION['name']?>">
\r
285 <tr bgcolor="<?=$table_content_1a?>">
\r
287 <div align="right"><font size="2">Email : </font></div>
\r
290 <input type="text" name="vemail" size="30" maxlength="100" value="<?=$_SESSION['email']?>">
\r
293 <tr bgcolor="<?=$table_content_1a?>">
\r
295 <div align="right"><font size="2">Website : </font></div>
\r
298 <input type="text" name="vurl" size="30" maxlength="150" value="<?=$_SESSION['url']?>">
\r
301 <tr bgcolor="<?=$table_content_1a?>">
\r
302 <td valign="top" width="28%">
\r
303 <div align="right"><font size="2">*Comment : </font></div>
\r
306 <textarea name="vcomment" cols="40" rows="7" wrap="virtual"><?=$_SESSION['comment']?></textarea>
\r
307 <br><font size="1">* Required field</font>
\r
310 <tr bgcolor="<?=$table_content_1a?>">
\r
312 <div align="right"><font size="2">Verification Code :</font></div>
\r
315 <font size="1">Please retype this code below :</font>
\r
316 <font size="2"><b><?=$_SESSION['secc']?></b></font><br>
\r
317 <input type="text" name="vsecc" size="4" maxlength="4">
\r
320 <tr bgcolor="<?=$table_content_1b?>">
\r
322 <div align="center">
\r
324 <input type="submit" value="Submit">
\r
325 <input type="reset" value="Reset">
\r
326 <input type="button" value="Back" onclick="window.location='<?="$self?page=$page"?>'">
\r
340 <!-- End of entry form -->
\r
344 $vname = isset($_POST['vname']) ? trim($_POST['vname']) : "";
\r
345 $vemail = isset($_POST['vemail']) ? trim($_POST['vemail']) : "";
\r
346 $vurl = isset($_POST['vurl']) ? trim($_POST['vurl']) : "";
\r
347 $vcomment = isset($_POST['vcomment']) ? trim($_POST['vcomment']) : "";
\r
348 $vsecc = isset($_POST['vsecc']) ? strtoupper($_POST['vsecc']) : "";
\r
350 if (strlen($vname) > 70) $vname = substr($vname,0,70);
\r
351 if (strlen($vemail) > 100) $vemail = substr($vemail,0,100);
\r
352 if (strlen($vurl) > 150) $vurl = substr($vurl,0,150);
\r
354 $_SESSION['name'] = $vname;
\r
355 $_SESSION['email'] = $vemail;
\r
356 $_SESSION['url'] = $vurl;
\r
357 $_SESSION['comment'] = stripslashes($vcomment);
\r
359 if ($vname == "" || $vcomment == "") {
\r
360 input_err("You may left some fields.");
\r
363 if ($vemail != "" && !preg_match("/([\w\.\-]+)(\@[\w\.\-]+)(\.[a-z]{2,4})+/i", $vemail)) {
\r
364 input_err("Invalid email address.");
\r
367 if ($vurl != "" && strtolower($vurl) != "http://") {
\r
368 if (!preg_match ("#^http://[_a-z0-9-]+\\.[_a-z0-9-]+#i", $vurl)) {
\r
369 input_err("Invalid URL format.");
\r
373 $test_comment = preg_split("/[\s]+/",$vcomment);
\r
374 $jmltest = count($test_comment);
\r
375 for ($t=0; $t<$jmltest; $t++) {
\r
376 if (strlen(trim($test_comment[$t])) > 70) {
\r
377 input_err("Invalid word found on your entry : ".stripslashes($test_comment[$t]));
\r
381 if (isset($_SESSION['add']) && $_SESSION['add'] >= $max_entry_per_session) {
\r
382 input_err("Sorry, only $max_entry_per_session message(s) allowed per session.",false);
\r
383 } elseif (!isset($_SESSION['add'])) {
\r
387 if ($vsecc != $_SESSION['secc']) {
\r
388 input_err("Invalid verification code");
\r
390 //--only 2000 characters allowed for comment, change this value if necessary
\r
392 if (strlen($vcomment) > $maxchar) $vcomment = substr($vcomment,0,$maxchar)."...";
\r
394 $idx = date("YmdHis");
\r
395 $tgl = date("F d, Y - h:i A");
\r
397 $vname = str_replace("<","<",$vname);
\r
398 $vname = str_replace(">",">",$vname);
\r
399 $vname = str_replace("~","-",$vname);
\r
400 $vname = str_replace("\"",""",$vname);
\r
401 $vcomment = str_replace("<","<",$vcomment);
\r
402 $vcomment = str_replace(">",">",$vcomment);
\r
403 $vcomment = str_replace("|","",$vcomment);
\r
404 $vcomment = str_replace("\"",""",$vcomment);
\r
405 $vurl = str_replace("<","",$vurl);
\r
406 $vurl = str_replace(">","",$vurl);
\r
407 $vurl = str_replace("|","",$vurl);
\r
408 $vemail = str_replace("<","",$vemail);
\r
409 $vemail = str_replace(">","",$vemail);
\r
410 $vemail = str_replace("|","",$vemail);
\r
412 if (strtoupper($os) == "WIN") {
\r
413 $vcomment = str_replace($newline,"<br>",$vcomment);
\r
414 $vcomment = str_replace("\r","",$vcomment);
\r
415 $vcomment = str_replace("\n","",$vcomment);
\r
417 $vcomment = str_replace($newline,"<br>",$vcomment);
\r
418 $vcomment = str_replace("\r","",$vcomment);
\r
421 if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && eregi("^[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}$",$_SERVER['HTTP_X_FORWARDED_FOR'])) {
\r
422 $ipnum = $_SERVER['HTTP_X_FORWARDED_FOR'];
\r
424 $ipnum = getenv("REMOTE_ADDR");
\r
427 $newdata = "|~|$idx|~|$tgl|~|$vname|~|$vemail|~|$vcomment|~|$vurl|~|$ipnum|~|";
\r
428 $newdata = stripslashes($newdata);
\r
429 $newdata .= $newline;
\r
431 $tambah = fopen($data_file,"a");
\r
432 if (strtoupper($os)=="UNIX") {
\r
433 if (flock($tambah,LOCK_EX)) {
\r
434 fwrite($tambah,$newdata);
\r
435 flock($tambah,LOCK_UN);
\r
438 fwrite($tambah,$newdata);
\r
443 if (strtoupper($notify) == "YES") {
\r
444 $msgtitle = "Someone signed your guestbook";
\r
445 $vcomment = str_replace(""","\"",$vcomment);
\r
446 $vcomment = stripslashes($vcomment);
\r
447 $vcomment = str_replace("<br>","\n",$vcomment);
\r
448 $msgcontent = "Local time : $tgl\n\nThe addition from $vname :\n----------------------------\n\n$vcomment\n\n-----End Message-----";
\r
449 @mail($admin_email,$msgtitle,$msgcontent,"From: $vemail\n");
\r
452 $_SESSION['name'] = "";
\r
453 $_SESSION['email'] = "";
\r
454 $_SESSION['url'] = "http://";
\r
455 $_SESSION['comment'] = "";
\r
456 $_SESSION['add']++;
\r
457 $_SESSION['secc'] = "";
\r
458 redir($self,"Thank you, your entry has been added.");
\r
462 $record = file($data_file);
\r
463 $jmlrec = count($record);
\r
464 for ($i=0; $i<$jmlrec; $i++) {
\r
465 $row = explode("|~|",$record[$i]);
\r
466 if ($id == $row[1]) {
\r
469 <head><title>Delete record</title></head>
\r
470 <body bgcolor="<?=$background?>" style="font-family:<?=$font_face?>">
\r
472 <font size="4" color="<?=$title_color?>">Delete Confirmation</font>
\r
474 <table border="0" cellpadding="5" cellspacing="1" width="450">
\r
476 <td bgcolor="<?=$table_top?>">
\r
478 <font size="1"><b><?=$row[2]?></font><br><?=$row[3]?></b> - <a href="mailto:<?=$row[4]?>"><?=$row[4]?></a>
\r
479 <br><br><?=$row[5]?>
\r
480 <br><br><font size="1">IP : <?=$row[7]?></font>
\r
485 <form action="<?=$self?>" method="post">
\r
486 <input type="hidden" name="do" value="del2">
\r
487 <input type="hidden" name="id" value="<?=$id?>">
\r
488 <input type="hidden" name="page" value="<?=$page?>">
\r
489 <font color="<?=$title_color?>" size="2"><b>Admin password : </b></font> <input type="password" name="pwd">
\r
491 <font size="2" color="<?=$title_color?>"><b>»</b><input type="checkbox" name="byip" value="<?=$row[7]?>"> Delete all record that using this IP : <?=$row[7]?></font>
\r
493 <input type="submit" value="Delete"> <input type="button" value="Cancel" onclick="window.location='<?="$self?page=$page"?>'">
\r
504 $pwd = isset($_POST['pwd']) ? trim($_POST['pwd']) : "";
\r
505 $id = isset($_POST['id']) ? trim($_POST['id']) : "";
\r
506 $page = isset($_POST['page']) ? $_POST['page'] : 1;
\r
507 $byip = isset($_POST['byip']) ? $_POST['byip'] : "";
\r
509 if ($pwd != $admin_password) {
\r
510 redir("$self?page=$page","Invalid admin password !");
\r
513 $record = file($data_file);
\r
514 $jmlrec = count($record);
\r
515 for ($i=0; $i<$jmlrec; $i++) {
\r
516 $row = explode("|~|",$record[$i]);
\r
518 if ($row[1] == $id) {
\r
523 if ($row[7] == $byip) {
\r
529 $update_data = fopen($data_file,"w");
\r
530 if (strtoupper($os) == "UNIX") {
\r
531 if (flock($update_data,LOCK_EX)) {
\r
532 for ($j=0; $j<$jmlrec; $j++) {
\r
533 if ($record[$j] != "") {
\r
534 fputs($update_data,$record[$j]);
\r
537 flock($update_data,LOCK_UN);
\r
540 for ($j=0; $j<$jmlrec; $j++) {
\r
541 if ($record[$j] != "") {
\r
542 fputs($update_data,$record[$j]);
\r
546 fclose($update_data);
\r
547 redir("$self?page=$page","Record has been deleted !");
\r
552 function redir($target,$msg) {
\r
553 global $background,$font_face,$title_color;
\r
557 <meta http-equiv="refresh" content="1; url=<?=$target?>">
\r
559 <body bgcolor="<?=$background?>">
\r
560 <center><font color="<?=$title_color?>" face="<?=$font_face?>"><h3><?=$msg?></h3>Please wait...</font></center>
\r
567 function input_err($err_msg,$linkback=true) {
\r
568 global $background,$font_face;
\r
571 <head><title>Error !</title></head>
\r
572 <body bgcolor="<?=$background?>">
\r
575 <table border="1" bgcolor="#000000" cellspacing="0" cellpadding="6">
\r
577 <td bgcolor="#FFCC00" align="center">
\r
578 <font size="3" color="#000000" face="<?=$font_face?>"><b><?=$err_msg?></b><br>
\r
579 <?if ($linkback) {?>
\r
580 <font size="2">Click <a href="javascript:history.back()">here</a> and try again.</font>
\r