diff -ruN guestbook.new/addentry.php guestbook.new.2.4.1/addentry.php
--- guestbook.new/addentry.php	2005-07-19 11:31:48.000000000 -0500
+++ guestbook.new.2.4.1/addentry.php	2006-04-03 08:44:15.000000000 -0500
@@ -4,9 +4,9 @@
 include_once $include_path."/lib/$DB_CLASS";
 include_once $include_path."/lib/image.class.php";
 include_once $include_path."/lib/template.class.php";
-
 include_once $include_path."/lib/vars.class.php";
 include_once $include_path."/lib/add.class.php";
+include_once $include_path."/lib/phrase.class.php";
 
 $gb_post = new addentry($include_path);
 
@@ -16,13 +16,15 @@
     $gb_post->url = (isset($_POST["gb_url"])) ? $_POST["gb_url"] : '';
     $gb_post->comment = (isset($_POST["gb_comment"])) ? $_POST["gb_comment"] : '';
     $gb_post->location = (isset($_POST["gb_location"])) ? $_POST["gb_location"] : '';
-    $gb_post->icq = (isset($_POST["gb_icq"])) ? $_POST["gb_icq"] : '';
+    $gb_post->icq = (isset($_POST["gb_icq"])) ? $_POST["gb_icq"] : 0;
     $gb_post->aim = (isset($_POST["gb_aim"])) ? $_POST["gb_aim"] : '';
     $gb_post->gender = (isset($_POST["gb_gender"])) ? $_POST["gb_gender"] : '';
     $gb_post->userfile = (isset($_FILES["userfile"]["tmp_name"]) && $_FILES["userfile"]["tmp_name"] != "") ? $_FILES : '';
     $gb_post->user_img = (isset($_POST["gb_user_img"])) ? $_POST["gb_user_img"] : '';
     $gb_post->preview = (isset($_POST["gb_preview"])) ? 1 : 0;
     $gb_post->private = (isset($_POST["gb_private"])) ? 1 : 0;
+    $gb_post->token = (isset($_POST["gb_token"])) ? $_POST["gb_token"] : '';
+    $gb_post->gb_captcha = (isset($_POST["gb_captcha"])) ? $_POST["gb_captcha"] : '';
     echo $gb_post->process($_POST["gb_action"]);
 } else {
     echo $gb_post->process();
diff -ruN guestbook.new/admin/config.inc.php guestbook.new.2.4.1/admin/config.inc.php
--- guestbook.new/admin/config.inc.php	2005-08-09 12:29:08.000000000 -0500
+++ guestbook.new.2.4.1/admin/config.inc.php	2006-04-03 09:08:12.000000000 -0500
@@ -18,6 +18,7 @@
 $GB_TBL["priv"]  = "[% table_prefix %]_book_private";
 $GB_TBL["smile"] = "[% table_prefix %]_book_smilies";
 $GB_TBL["pics"]  = "[% table_prefix %]_book_pics";
+$GB_TBL["cap"]   = "[% table_prefix %]_book_captcha";
 
 /* guestbook pages */
 
@@ -25,7 +26,7 @@
 $GB_PG["admin"]    = "admin.php";
 $GB_PG["comment"]  = "comment.php";
 $GB_PG["addentry"] = "addentry.php";
-
+$GB_TPL["captcha"] = "captcha.php";
 
 /* guestbook templates */
 
@@ -54,6 +55,7 @@
 
 /* misc */
 
+define('USE_CAPTCHA', true);
 define('IS_MODULE', false);  /* running as POST-Nuke 0.x or PHP-Nuke 5.x addon? */ 
 
 $GB_PG["base_url"] = "[% url_to_install_without_trailing_slash %]";  /* e.g htpp://www.yourdomain.com/guestbook */
diff -ruN guestbook.new/admin/footer.inc.php guestbook.new.2.4.1/admin/footer.inc.php
--- guestbook.new/admin/footer.inc.php	2005-07-19 11:31:49.000000000 -0500
+++ guestbook.new.2.4.1/admin/footer.inc.php	2006-04-03 08:44:15.000000000 -0500
@@ -1,3 +1,3 @@
-<center><font face="Arial, Helvetica, sans-serif" color="#CCCCCC" size="1"><b>Advanced Guestbook 2.3.3<br><a href="http://www.proxy2.de" target="_blank"><font color="#CCCCCC">http://www.proxy2.de</font></a></b></font></center>
+<center><font face="Arial, Helvetica, sans-serif" color="#CCCCCC" size="1"><b>Advanced Guestbook 2.4.1<br><a href="http://www.proxy2.de" target="_blank"><font color="#CCCCCC">http://www.proxy2.de</font></a></b></font></center>
 </body>
 </html>
diff -ruN guestbook.new/admin/index.html guestbook.new.2.4.1/admin/index.html
--- guestbook.new/admin/index.html	1969-12-31 18:00:00.000000000 -0600
+++ guestbook.new.2.4.1/admin/index.html	2006-04-03 08:44:15.000000000 -0500
@@ -0,0 +1 @@
+ 
\ No newline at end of file
diff -ruN guestbook.new/admin/panel_edit.php guestbook.new.2.4.1/admin/panel_edit.php
--- guestbook.new/admin/panel_edit.php	2005-07-19 11:31:49.000000000 -0500
+++ guestbook.new.2.4.1/admin/panel_edit.php	2006-04-03 08:44:15.000000000 -0500
@@ -24,27 +24,27 @@
     </tr>
     <tr bgcolor="#EFEFEF">
       <td width="25%"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Name:</font></td>
-      <td><input type="text" name="name" size="44" maxlength="50" value="<?php echo $row['name']; ?>"></td>
+      <td><input type="text" name="name" size="55" maxlength="50" value="<?php echo $row['name']; ?>"></td>
     </tr>
     <tr bgcolor="#EFEFEF">
       <td width="25%"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">E-mail:</font></td>
-      <td><input type="text" name="email" size="44" maxlength="60" value="<?php echo $row['email']; ?>"></td>
+      <td><input type="text" name="email" size="55" maxlength="100" value="<?php echo $row['email']; ?>"></td>
     </tr>
     <tr bgcolor="#EFEFEF">
       <td width="25%"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Location:</font></td>
-      <td><input type="text" name="location" size="44" maxlength="60" value="<?php echo $row['location']; ?>"></td>
+      <td><input type="text" name="location" size="55" maxlength="100" value="<?php echo $row['location']; ?>"></td>
     </tr>
     <tr bgcolor="#EFEFEF">
       <td width="25%"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Homepage:</font></td>
-      <td><input type="text" name="url" size="44" maxlength="60" value="<?php echo $row['url']; ?>"></td>
+      <td><input type="text" name="url" size="55" maxlength="60" value="<?php echo $row['url']; ?>"></td>
     </tr>
     <tr bgcolor="#EFEFEF">
       <td width="25%"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">ICQ:</font></td>
-      <td><input type="text" name="icq" size="44" maxlength="60" value="<?php if ($row['icq']!=0) {echo $row['icq'];} ?>"></td>
+      <td><input type="text" name="icq" size="55" maxlength="20" value="<?php if ($row['icq']!=0) {echo $row['icq'];} ?>"></td>
     </tr>
     <tr bgcolor="#EFEFEF">
       <td width="25%"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Aim:</font></td>
-      <td><input type="text" name="aim" size="44" maxlength="60" value="<?php echo $row['aim']; ?>"></td>
+      <td><input type="text" name="aim" size="55" maxlength="60" value="<?php echo $row['aim']; ?>"></td>
     </tr>
     <tr bgcolor="#EFEFEF">
       <td width="25%"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Gender:</font></td>
@@ -53,16 +53,16 @@
     </tr>
     <tr bgcolor="#EFEFEF">
       <td width="25%"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Host:</font></td>
-      <td><input type="text" name="host" size="44" maxlength="60" value="<?php echo $row['host']; ?>"></td>
+      <td><input type="text" name="host" size="55" maxlength="255" value="<?php echo $row['host']; ?>"></td>
     </tr>
     <tr bgcolor="#EFEFEF">
       <td width="25%"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Browser:</font></td>
-      <td><input type="text" name="browser" size="44" maxlength="60" value="<?php echo $row['browser']; ?>"></td>
+      <td><input type="text" name="browser" size="55" value="<?php echo $row['browser']; ?>"></td>
     </tr>
     <tr bgcolor="#EFEFEF">
       <td width="25%" valign="top"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Your Message:</font></td>
       <td>
-        <textarea name="comment" cols="42" rows="10" wrap="VIRTUAL"><?PHP echo $row['comment']; ?></textarea>
+        <textarea name="comment" cols="41" rows="10" wrap="VIRTUAL"><?PHP echo $row['comment']; ?></textarea>
       </td>
     </tr>
     <tr bgcolor="#EFEFEF">
diff -ruN guestbook.new/admin/panel_info.php guestbook.new.2.4.1/admin/panel_info.php
--- guestbook.new/admin/panel_info.php	2005-07-19 11:31:49.000000000 -0500
+++ guestbook.new.2.4.1/admin/panel_info.php	2006-04-03 08:44:15.000000000 -0500
@@ -2,21 +2,21 @@
 <head>
 <title>Guestbook - PHP Info</title>
 </head>
-<body bgcolor="#006699" link="#FFFFFF" vlink="#FFFFFF"><br>
+<body bgcolor="#006699" link="#000000" vlink="#000000"><br>
 <center>
-<font size="2" face="Verdana, Arial" color="#FFFFFF"><b>G U E S T B O O K&nbsp;&nbsp;&nbsp;&nbsp;A D M I N</b></font><br><br>
+<font size="2" face="Verdana, Arial" color="#000000"><b>G U E S T B O O K&nbsp;&nbsp;&nbsp;&nbsp;A D M I N</b></font><br><br>
 </center>
-<font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b><a href="<?php echo $this->SELF; ?>?action=show&amp;tbl=priv&amp;session=<?php echo $this->session; ?>&amp;uid=<?php echo $this->uid; ?>"><font color="#FFFFFF">Private 
-Messages</font></a> | <a href="<?php echo $this->SELF; ?>?action=show&amp;tbl=gb&amp;session=<?php echo $this->session; ?>&amp;uid=<?php echo $this->uid; ?>"><font color="#FFFFFF">Easy 
-Admin</font></a> | <a href="<?php echo $this->SELF; ?>?action=settings&amp;panel=general&amp;session=<?php echo $this->session; ?>&amp;uid=<?php echo $this->uid; ?>"><font color="#FFFFFF">General 
-Settings</font></a> | <a href="<?php echo $this->SELF; ?>?action=settings&amp;panel=style&amp;session=<?php echo $this->session; ?>&amp;uid=<?php echo $this->uid; ?>"><font color="#FFFFFF">Style</font></a> 
-| <a href="<?php echo $this->SELF; ?>?action=template&amp;session=<?php echo $this->session; ?>&amp;uid=<?php echo $this->uid; ?>"><font color="#FFFFFF">Templates</font></a> 
-| <a href="<?php echo $this->SELF; ?>?action=smilies&amp;session=<?php echo $this->session; ?>&amp;uid=<?php echo $this->uid; ?>"><font color="#FFFFFF">Smilies</font></a> 
-| <a href="<?php echo $this->SELF; ?>?action=settings&amp;panel=pwd&amp;session=<?php echo $this->session; ?>&amp;uid=<?php echo $this->uid; ?>"><font color="#FFFFFF">Password</font></a> 
-| <a href="<?php echo $this->SELF; ?>?action=logout&amp;session=<?php echo $this->session; ?>&amp;uid=<?php echo $this->uid; ?>"><font color="#FFFFFF">Logout</font></a></b></font><br>
+<font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b><a href="<?php echo $this->SELF; ?>?action=show&amp;tbl=priv&amp;session=<?php echo $this->session; ?>&amp;uid=<?php echo $this->uid; ?>"><font color="#000000">Private 
+Messages</font></a> | <a href="<?php echo $this->SELF; ?>?action=show&amp;tbl=gb&amp;session=<?php echo $this->session; ?>&amp;uid=<?php echo $this->uid; ?>"><font color="#000000">Easy 
+Admin</font></a> | <a href="<?php echo $this->SELF; ?>?action=settings&amp;panel=general&amp;session=<?php echo $this->session; ?>&amp;uid=<?php echo $this->uid; ?>"><font color="#000000">General 
+Settings</font></a> | <a href="<?php echo $this->SELF; ?>?action=settings&amp;panel=style&amp;session=<?php echo $this->session; ?>&amp;uid=<?php echo $this->uid; ?>"><font color="#000000">Style</font></a> 
+| <a href="<?php echo $this->SELF; ?>?action=template&amp;session=<?php echo $this->session; ?>&amp;uid=<?php echo $this->uid; ?>"><font color="#000000">Templates</font></a> 
+| <a href="<?php echo $this->SELF; ?>?action=smilies&amp;session=<?php echo $this->session; ?>&amp;uid=<?php echo $this->uid; ?>"><font color="#000000">Smilies</font></a> 
+| <a href="<?php echo $this->SELF; ?>?action=settings&amp;panel=pwd&amp;session=<?php echo $this->session; ?>&amp;uid=<?php echo $this->uid; ?>"><font color="#000000">Password</font></a> 
+| <a href="<?php echo $this->SELF; ?>?action=logout&amp;session=<?php echo $this->session; ?>&amp;uid=<?php echo $this->uid; ?>"><font color="#000000">Logout</font></a></b></font><br>
 <hr>
-<b><font size="1" face="Verdana, Arial" color="#FFFFFF">To check your environmental variables, <a href="<?php echo $this->SELF; ?>?action=info&amp;session=<?php echo $this->session; ?>&amp;uid=<?php echo $this->uid; ?>">click here.</a></font></b>
-<br><br><br>
+<b><font size="1" face="Verdana, Arial" color="#000000">To check your environmental variables, <a href="<?php echo $this->SELF; ?>?action=info&amp;session=<?php echo $this->session; ?>&amp;uid=<?php echo $this->uid; ?>">click here.</a></font></b>
+<br><br></body></html>
 <?php
 phpinfo();
 ?>
\ No newline at end of file
diff -ruN guestbook.new/comment.php guestbook.new.2.4.1/comment.php
--- guestbook.new/comment.php	2005-07-19 11:31:49.000000000 -0500
+++ guestbook.new.2.4.1/comment.php	2006-04-03 08:44:15.000000000 -0500
@@ -4,7 +4,6 @@
 include_once $include_path."/lib/$DB_CLASS";
 include_once $include_path."/lib/image.class.php";
 include_once $include_path."/lib/template.class.php";
-
 include_once $include_path."/lib/vars.class.php";
 include_once $include_path."/lib/comment.class.php";
 
diff -ruN guestbook.new/image.php guestbook.new.2.4.1/image.php
--- guestbook.new/image.php	1969-12-31 18:00:00.000000000 -0600
+++ guestbook.new.2.4.1/image.php	2006-04-03 08:44:15.000000000 -0500
@@ -0,0 +1,44 @@
+<?php
+$include_path = dirname(__FILE__);
+include_once $include_path."/admin/config.inc.php";
+include_once $include_path."/lib/$DB_CLASS";
+include_once $include_path."/lib/captcha.class.php";
+
+if (USE_CAPTCHA) {
+	if (isset($_GET['id']) && !empty($_GET['id'])) {
+		$_GET['id'] = trim($_GET['id']);
+		$id = addslashes($_GET['id']);
+		$expired = time() - 2*3600;
+		$db = new gbook_sql();
+		$db->connect();
+		$db->query("DELETE FROM {$GB_TBL["cap"]} WHERE timestamp < $expired");
+		$res = $db->query("SELECT * FROM {$GB_TBL["cap"]} WHERE session_id='$id' LIMIT 1");
+		$result = $db->fetch_array($res);
+		if (isset($result['validate_key'])) {
+			$imageType = "";			
+			if (extension_loaded("gd") && function_exists("imagettftext")) {				
+				$img = new SimpleCaptcha();
+				$img->setFontSizeRange(14,18);
+				reset($img->supportedImagesTypes);
+				$imageType = key($img->supportedImagesTypes);				
+			} else {
+				include_once $include_path."/lib/bitmapimagetext.class.php";
+				$img = new BitmapImageText();
+			}
+						
+			$img->setText($result['validate_key']);
+			$img->setBackgroundColors(array("EEEEEE", "F2F3D3", "F5EAEA", "E4F3EE", "EEE4F3", "FFE6E6"));
+			$img->setTextColors(array("000000", "FD130A", "0A1BFD", "149703", "486C66", "870DC3", "D78406", "105243"));
+			if (!empty($imageType)) {
+				$img->getImage($imageType);
+			} else {
+				$img->getImage();
+			}
+			exit();
+		}
+	}
+}
+
+SimpleCaptcha::createPixel();
+
+?>
\ No newline at end of file
diff -ruN guestbook.new/index.php guestbook.new.2.4.1/index.php
--- guestbook.new/index.php	2005-07-19 11:31:49.000000000 -0500
+++ guestbook.new.2.4.1/index.php	2006-04-03 08:44:15.000000000 -0500
@@ -1,10 +1,4 @@
 <?php
-/**
- * ----------------------------------------------
- * Advanced Guestbook 2.3.3 (PHP/MySQL)
- * ----------------------------------------------
- */
-
 $include_path = dirname(__FILE__);
 include_once $include_path."/admin/config.inc.php";
 include_once $include_path."/lib/$DB_CLASS";
@@ -81,21 +75,24 @@
         case "addentry":
             include_once $include_path."/lib/vars.class.php";
             include_once $include_path."/lib/add.class.php";
+            include_once $include_path."/lib/phrase.class.php";
             $gb_post = new addentry($include_path);
             if (isset($_POST["gb_action"])) {
                 $gb_post->name = (isset($_POST["gb_name"])) ? $_POST["gb_name"] : '';
-                $gb_post->email = (isset($_POST["gb_email"])) ? $_POST["gb_email"] : '';
-                $gb_post->url = (isset($_POST["gb_url"])) ? $_POST["gb_url"] : '';
-                $gb_post->comment = (isset($_POST["gb_comment"])) ? $_POST["gb_comment"] : '';
-                $gb_post->location = (isset($_POST["gb_location"])) ? $_POST["gb_location"] : '';
-                $gb_post->icq = (isset($_POST["gb_icq"])) ? $_POST["gb_icq"] : '';
-                $gb_post->aim = (isset($_POST["gb_aim"])) ? $_POST["gb_aim"] : '';
-                $gb_post->gender = (isset($_POST["gb_gender"])) ? $_POST["gb_gender"] : '';
-                $gb_post->userfile = (isset($_FILES["userfile"]["tmp_name"]) && $_FILES["userfile"]["tmp_name"] != "") ? $_FILES : '';
-                $gb_post->user_img = (isset($_POST["gb_user_img"])) ? $_POST["gb_user_img"] : '';
-                $gb_post->preview = (isset($_POST["gb_preview"])) ? 1 : 0;
-                $gb_post->private = (isset($_POST["gb_private"])) ? 1 : 0;
-                echo $gb_post->process($_POST["gb_action"]);
+				$gb_post->email = (isset($_POST["gb_email"])) ? $_POST["gb_email"] : '';
+				$gb_post->url = (isset($_POST["gb_url"])) ? $_POST["gb_url"] : '';
+				$gb_post->comment = (isset($_POST["gb_comment"])) ? $_POST["gb_comment"] : '';
+				$gb_post->location = (isset($_POST["gb_location"])) ? $_POST["gb_location"] : '';
+				$gb_post->icq = (isset($_POST["gb_icq"])) ? $_POST["gb_icq"] : 0;
+				$gb_post->aim = (isset($_POST["gb_aim"])) ? $_POST["gb_aim"] : '';
+				$gb_post->gender = (isset($_POST["gb_gender"])) ? $_POST["gb_gender"] : '';
+				$gb_post->userfile = (isset($_FILES["userfile"]["tmp_name"]) && $_FILES["userfile"]["tmp_name"] != "") ? $_FILES : '';
+				$gb_post->user_img = (isset($_POST["gb_user_img"])) ? $_POST["gb_user_img"] : '';
+				$gb_post->preview = (isset($_POST["gb_preview"])) ? 1 : 0;
+				$gb_post->private = (isset($_POST["gb_private"])) ? 1 : 0;
+				$gb_post->token = (isset($_POST["gb_token"])) ? $_POST["gb_token"] : '';
+				$gb_post->gb_captcha = (isset($_POST["gb_captcha"])) ? $_POST["gb_captcha"] : '';
+				echo $gb_post->process($_POST["gb_action"]);
             } else {
                 echo $gb_post->process();
             }
@@ -124,5 +121,4 @@
     $entry = (isset($_POST["entry"])) ? $_POST["entry"] : $entry;
     echo $gb->show_entries(intval($entry));
 }
-
 ?>
\ No newline at end of file
diff -ruN guestbook.new/lib/add.class.php guestbook.new.2.4.1/lib/add.class.php
--- guestbook.new/lib/add.class.php	2005-07-19 11:31:49.000000000 -0500
+++ guestbook.new.2.4.1/lib/add.class.php	2006-04-03 08:44:15.000000000 -0500
@@ -1,471 +1,495 @@
-<?php
-/**
- * ----------------------------------------------
- * Advanced Guestbook 2.3.3 (PHP/MySQL)
- * Copyright (c) Chi Kien Uong
- * URL: http://www.proxy2.de
- * ----------------------------------------------
- */
-
-class addentry {
-
-    var $db;
-    var $ip;
-    var $include_path;
-    var $template;
-    var $name = '';
-    var $email = '';
-    var $url = '';
-    var $comment = '';
-    var $location = '';
-    var $icq = '';
-    var $aim = '';
-    var $gender = '';
-    var $userfile = '';
-    var $user_img = '';
-    var $preview = '';
-    var $private = '';
-    var $image_file = '';
-    var $image_tag = '';
-    var $GB_TPL = array();
-    var $table = array();
-
-    function addentry($path='') {
-        global $GB_TPL, $GB_TBL, $_SERVER;
-        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'])) {
-            $this->ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
-        } else {
-            $this->ip = $_SERVER["REMOTE_ADDR"];
-        }
-        $this->db = new guestbook_vars($path);
-        $this->db->getVars();
-        $this->template = &$this->db->template;
-        $this->include_path = $path;
-        $this->GB_TPL = &$GB_TPL;
-        $this->table = &$GB_TBL;
-    }
-
-    function undo_htmlspecialchars($string) {
-        $html = array (
-            "&amp;"  => "&",
-            "&quot;" => "\"",
-            "&lt;"   => "<",
-            "&gt;"   => ">"
-        );
-        for(reset($html); $key=key($html); next($html)) {
-            $string = str_replace("$key","$html[$key]",$string);
-        }
-        return ($string);
-    }
-
-    function clear_tmpfiles($cachetime=1800) {
-        global $GB_TMP;
-        $delfiles = 0;
-        $filelist = '';
-        if (is_dir("$this->include_path/$GB_TMP")) {
-            chdir("$this->include_path/$GB_TMP");
-            $hnd = opendir(".");
-            while ($file = readdir($hnd)) {
-                if(is_file($file)) {
-                    $filelist[] = $file;
-                }
-            }
-            closedir($hnd);
-        }
-        if (is_array($filelist)) {
-            while (list ($key, $file) = each ($filelist)) {
-                $tmpfile = explode(".",$file);
-                $tmpfile[0] = ereg_replace ("img-", "", $tmpfile[0]);
-                if ($tmpfile[0] < (time()-$cachetime)) {
-                    if (unlink($file)) {
-                        $delfiles ++;
-                    }
-                }
-            }
-        }
-        return $delfiles;
-    }
-
-    function is_uploaded_file_readable($uploaded_file_tmp_name) {
-        $check = @fopen($uploaded_file_tmp_name, "rb");
-        if ($check) {
-            fclose($check);
-            return 1;
-        } else {
-            $is_safe_mode = get_cfg_var("safe_mode");
-            if ($is_safe_mode) {
-                return -1;
-            } else {
-                return 2;
-            }
-        }
-    }
-
-	function getVerificationHash($timeout=5, $timestp=0) {
-		/* timeout = 5 minutes */
-		if ($timestp > 0) {
-			$timeStamp = $timestp;
-		} else {
-			$timeStamp = time();
-		}
-		$timeout = ($timeout>0) ? $timeout : 5;
-		$timeout = $timeout*60;
-		$timeStamp = $timeStamp/$timeout;
-		$timeStamp = (int) $timeStamp;
-		$identifier = $this->GB_TPL->db['pass'];
-		$hash = md5($identifier.$timeStamp);
-		return $hash;
-	}
-
-    function check_entry($type='') {
-        global $GB_UPLOAD, $GB_TMP, $GB_PG;
-        $this->db->VARS["max_img_size"] = $this->db->VARS["max_img_size"]*1024;
-        if ($this->db->VARS["banned_ip"]==1) {
-            if ($this->db->isBannedIp($this->ip)) {
-                 return $this->db->gb_error($this->db->LANG["ErrorPost9"]);
-            }
-        }
-        if ($this->db->VARS["flood_check"]==1) {
-            if ($this->db->FloodCheck($this->ip)) {
-                return $this->db->gb_error($this->db->LANG["ErrorPost8"]);
-            }
-        }
-        if (is_array($this->userfile) && $this->userfile["userfile"]["tmp_name"] != "none") {
-            $uploaded_img_file_stat = $this->is_uploaded_file_readable($this->userfile["userfile"]["tmp_name"]);
-        } else {
-            $uploaded_img_file_stat = -1;
-        }
-        if ($uploaded_img_file_stat > 0) {
-            $extension = array("1" => 'gif',"2" => 'jpg',"3" => 'png',"4" => 'swf');
-            $the_time = time();
-            if ($this->userfile["userfile"]["size"] > $this->db->VARS["max_img_size"]) {
-                return $this->db->gb_error($this->db->LANG["ErrorPost6"]);
-            } else {
-                if ($uploaded_img_file_stat == 1) {
-                    $size = GetImageSize($this->userfile["userfile"]["tmp_name"]);
-                    $open_basedir_res = false;
-                } else {
-                    $open_basedir_res = true;
-                    if (!eregi("WIN",PHP_OS)) {
-                        exec("cp ".$this->userfile["userfile"]["tmp_name"]." $this->include_path/$GB_TMP/img-$the_time.tmp");
-                    } else {
-                        $win_command = str_replace("/","\\",$this->userfile["userfile"]["tmp_name"]);
-                        $win_loc = str_replace("/","\\", "$this->include_path/$GB_TMP/img-$the_time.tmp");
-                        exec("copy $win_command $win_loc");
-                    }
-                    $size = GetImageSize("$this->include_path/$GB_TMP/img-$the_time.tmp");
-                }
-                if ($size[2]>0 && $size[2]<4) {
-                    $this->image_file = "img-$the_time.".$extension[$size[2]];
-                    $img = new gb_image();
-                    $img->set_destdir("$this->include_path/$GB_UPLOAD");
-                    $img->set_border_size($this->db->VARS["img_width"], $this->db->VARS["img_height"]);
-                    if ($type=="preview") {
-                        if (!$open_basedir_res) {
-                            copy($this->userfile["userfile"]["tmp_name"], "$this->include_path/$GB_TMP/$this->image_file");
-                        } else {
-                            rename("$this->include_path/$GB_TMP/img-$the_time.tmp", "$this->include_path/$GB_TMP/$this->image_file");
-                        }
-                        $new_img_size = $img->get_img_size_format($size[0], $size[1]);
-                        $GB_UPLOAD = $GB_TMP;
-                        $row['p_filename'] = $this->image_file;
-                        $row['width'] = $size[0];
-                        $row['height'] = $size[1];
-                        eval("\$this->tmp_image = \"".$this->template->get_template($this->GB_TPL['image'])."\";");
-                    } else {
-                        if (!$open_basedir_res) {
-                            copy($this->userfile["userfile"]["tmp_name"], "$this->include_path/$GB_UPLOAD/$this->image_file");
-                        } else {
-                            rename("$this->include_path/$GB_TMP/img-$the_time.tmp", "$this->include_path/$GB_UPLOAD/$this->image_file");
-                        }
-                        if ($this->db->VARS["thumbnail"]==1) {
-                            $min_size = 1024*$this->db->VARS["thumb_min_fsize"];
-                            $img->set_min_filesize($min_size);
-                            $img->set_prefix("t_");
-                            $img->create_thumbnail("$this->include_path/$GB_UPLOAD/$this->image_file","$this->image_file");
-                        }
-                    }
-                } else {
-                    return $this->db->gb_error($this->db->LANG["ErrorPost7"]);
-                }
-            }
-        }
-        if (!empty($this->user_img)) {
-            $this->image_file = trim($this->user_img);
-        }
-        $this->name = $this->db->FormatString($this->name);
-        $this->location = $this->db->FormatString($this->location);
-        $this->comment = $this->db->FormatString($this->comment);
-        $this->icq = intval($this->db->FormatString($this->icq));
-        $this->aim = htmlspecialchars($this->db->FormatString($this->aim));
-        if ($this->icq < 1000 || $this->icq >999999999) {
-            $this->icq='';
-        }
-        if ($this->name == "") {
-            return $this->db->gb_error($this->db->LANG["ErrorPost1"]);
-        } elseif (strlen($this->comment)<$this->db->VARS["min_text"] || strlen($this->comment)>$this->db->VARS["max_text"]) {
-            return $this->db->gb_error($this->db->LANG["ErrorPost3"]);
-        } else {
-            $this->url = trim($this->url);
-            $this->email = trim($this->email);
-            if (!eregi("^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@([0-9a-z][0-9a-z-]*[0-9a-z]\\.)+[a-z]{2,5}$", $this->email) ) {
-                $this->email = '';
-            }
-            if (!eregi("^http://[_a-z0-9-]+\\.[_a-z0-9-]+", $this->url)) {
-                $this->url = '';
-            }
-            if (htmlspecialchars($this->url) != "$this->url") {
-                $this->url = '';
-            }
-        }
-        if ($this->db->VARS["censor"]==1) {
-            $this->name = $this->db->CensorBadWords($this->name);
-            $this->location = $this->db->CensorBadWords($this->location);
-            $this->comment = $this->db->CensorBadWords($this->comment);
-        }
-        if (!$this->db->CheckWordLength($this->name) || !$this->db->CheckWordLength($this->location)) {
-            return $this->db->gb_error($this->db->LANG["ErrorPost4"]);
-        }
-        if (!$this->db->CheckWordLength($this->comment)) {
-            return $this->db->gb_error($this->db->LANG["ErrorPost10"]);
-        }
-        if (!isset($_POST['gb_hash'])) {
-        	return $this->db->gb_error($this->db->LANG["ErrorPost4"]);
-    	} else {
-    		$timestp = time()+5*60; 
-    		$gbHash1 = $this->getVerificationHash();   		
-    		$gbHash2 = $this->getVerificationHash(5,$timestp);
-    		if ($gbHash1 == $_POST['gb_hash'] || $gbHash2 == $_POST['gb_hash']) {
-    			return 1;
-    		} else {
-    			return $this->db->gb_error($this->db->LANG["ErrorPost4"]);
-    		}
-    	}
-    }
-
-    function add_guest() {
-        global $GB_TMP, $GB_UPLOAD, $GB_PG;
-        if ($this->preview==1 && $this->user_img) {
-            $img = new gb_image();
-            $img->set_destdir("$this->include_path/$GB_UPLOAD");
-            $img->set_border_size($this->db->VARS["img_width"], $this->db->VARS["img_height"]);
-            if ($this->db->VARS["thumbnail"]==1) {
-                $min_size = 1024*$this->db->VARS["thumb_min_fsize"];
-                $img->set_min_filesize($min_size);
-                $img->set_prefix("t_");
-                $img->create_thumbnail("$this->include_path/$GB_TMP/$this->user_img",$this->user_img);
-            }
-            copy("$this->include_path/$GB_TMP/$this->user_img", "$this->include_path/$GB_UPLOAD/$this->user_img");
-            unlink("$this->include_path/$GB_TMP/$this->user_img");
-            $this->image_file = $this->user_img;
-        }
-        $this->name = htmlspecialchars($this->name);
-        $this->location = htmlspecialchars($this->location);
-        if ($this->db->VARS["allow_html"] == 0) {
-            $this->comment = htmlspecialchars($this->comment);
-        }
-        if ($this->db->VARS["agcode"] == 1) {
-            $this->comment = $this->db->AGCode($this->comment);
-        }
-        if (!get_magic_quotes_gpc()) {
-            $this->name = addslashes($this->name);
-            $this->location = addslashes($this->location);
-            $this->aim = addslashes($this->aim);
-            $this->email = addslashes($this->email);
-            $this->url = addslashes($this->url);
-            $this->comment = addslashes($this->comment);
-            $this->gender = addslashes($this->gender);
-        }
-        $host = addslashes(@gethostbyaddr($this->ip));
-        $agent = addslashes(htmlspecialchars($_SERVER['HTTP_USER_AGENT']));
-        $the_time = time();
-        $sql_usertable = ($this->private==1) ? $this->table['priv'] : $this->table['data'];
-        $this->db->query("INSERT INTO $sql_usertable (name,gender,email,url,date,location,host,browser,comment,icq,aim) VALUES ('$this->name','$this->gender','$this->email','$this->url','$the_time','$this->location','$host','$agent','$this->comment','$this->icq','$this->aim')");
-        if (!empty($this->image_file) || !empty($this->user_img)) {
-            $size = GetImageSize("$this->include_path/$GB_UPLOAD/$this->image_file");
-            if (is_array($size) && $size[2]>0 && $size[2]<4) {
-                $book_id = ($this->private==1) ? 1 : 2;
-                $p_filesize = filesize("$this->include_path/$GB_UPLOAD/$this->image_file");
-                $this->db->fetch_array($this->db->query("SELECT MAX(id) AS msg_id FROM $sql_usertable"));
-                $this->db->query("INSERT INTO ".$this->table['pics']." (msg_id,book_id,p_filename,p_size,width,height) VALUES ('".$this->db->record['msg_id']."',$book_id,'$this->image_file','$p_filesize','$size[0]','$size[1]')");
-            }
-        }
-        $from_email = ($this->email == "") ? "nobody@$host" : $this->email;
-        if ($this->db->VARS["notify_private"]==1 && $this->private==1) {
-            @mail($this->db->VARS["admin_mail"],$this->db->LANG["EmailAdminSubject"],"$this->name\n$this->host\n\n$this->comment", "From: <".$this->name."> $from_email\nX-Mailer: Advanced Guestbook 2");
-        }
-        if ($this->db->VARS["notify_admin"]==1 && $this->private==0) {
-            @mail($this->db->VARS["admin_mail"],$this->db->LANG["EmailAdminSubject"],"$this->name\n$this->host\n\n$this->comment", "From: <".$this->name."> $from_email\nX-Mailer: Advanced Guestbook 2");
-        }
-        if ($this->db->VARS["notify_guest"]==1 && $this->email != '') {
-            @mail($this->email,$this->db->LANG["EmailGuestSubject"],$this->db->VARS["notify_mes"], "From: <".$this->db->VARS['admin_mail']."> ".$this->db->VARS['admin_mail']."\nX-Mailer: Advanced Guestbook 2");
-        }
-        if ($this->db->VARS["flood_check"]==1) {
-            $this->db->query("INSERT INTO ".$this->table['ip']." (guest_ip,timestamp) VALUES ('$this->ip','$the_time')");
-        }
-        $LANG = &$this->db->LANG;
-        $VARS = &$this->db->VARS;
-        $success_html = "";
-        eval("\$success_html = \"".$this->template->get_template($this->GB_TPL['success'])."\";");
-        eval("\$success_html .= \"".$this->template->get_template($this->GB_TPL['footer'])."\";");
-        return $success_html;
-    }
-
-    function form_addguest() {
-        global $GB_PG, $_COOKIE;
-        $HTML_CODE = ($this->db->VARS["allow_html"] == 1) ? $this->db->LANG["BookMess2"] : $this->db->LANG["BookMess1"];
-        $SMILE_CODE = ($this->db->VARS["smilies"] == 1) ? $this->db->LANG["FormMess2"] : $this->db->LANG["FormMess7"];
-        $AG_CODE = ($this->db->VARS["agcode"] == 1) ? $this->db->LANG["FormMess3"] : $this->db->LANG["FormMess6"];
-        $LANG = &$this->db->LANG;
-        $VARS = &$this->db->VARS;
-        $VARS['gbhash'] = $this->getVerificationHash();
-        $OPTIONS[] ='';
-        if ($this->db->VARS["allow_icq"]==1) {
-            eval("\$OPTIONS['icq'] = \"".$this->template->get_template($this->GB_TPL['frm_icq'])."\";");
-        }
-        if ($this->db->VARS["allow_aim"]==1) {
-            eval("\$OPTIONS['aim'] = \"".$this->template->get_template($this->GB_TPL['frm_aim'])."\";");
-        }
-        if ($this->db->VARS["allow_gender"]==1) {
-            eval("\$OPTIONS['gender'] = \"".$this->template->get_template($this->GB_TPL['frm_gender'])."\";");
-        }
-        if ($this->db->VARS["allow_img"]==1) {
-            eval("\$OPTIONS['img'] = \"".$this->template->get_template($this->GB_TPL['frm_image'])."\";");
-        }
-        $OPTIONAL = implode("\n",$OPTIONS);
-        if (isset($_COOKIE['lang']) && !empty($_COOKIE['lang']) && file_exists("$this->include_path/lang/codes-".$_COOKIE['lang'].".php")) {
-            $LANG_CODES = "$GB_PG[base_url]/lang/codes-".$_COOKIE['lang'].".php";
-        } elseif (file_exists("$this->include_path/lang/codes-".$VARS['lang'].".php")) {
-            $LANG_CODES = "$GB_PG[base_url]/lang/codes-".$VARS['lang'].".php";
-        } else {
-            $LANG_CODES = "$GB_PG[base_url]/lang/codes-english.php";
-        }
-        $addform_html = "";
-        eval("\$addform_html = \"".$this->template->get_template($this->GB_TPL['header'])."\";");
-        eval("\$addform_html .= \"".$this->template->get_template($this->GB_TPL['form'])."\";");
-        eval("\$addform_html .= \"".$this->template->get_template($this->GB_TPL['footer'])."\";");
-        return $addform_html;
-    }
-
-    function preview_entry() {
-        global $GB_PG;
-        if (get_magic_quotes_gpc()) {
-            $this->name = stripslashes($this->name);
-            $this->comment = stripslashes($this->comment);
-            $this->location = stripslashes($this->location);
-        }
-        $this->name = htmlspecialchars($this->name);
-        if ($this->db->VARS["allow_html"] == 0) {
-            $message = htmlspecialchars($this->comment);
-            $message = nl2br($message);
-        } else {
-            $message = nl2br($this->comment);
-        }
-        if ($this->db->VARS["smilies"] == 1) {
-            $message = $this->db->emotion($message);
-        }
-        if ($this->db->VARS["agcode"] == 1) {
-            $message = $this->db->AGCode($message);
-        }
-        $this->location = htmlspecialchars($this->location);
-        $this->comment = htmlspecialchars($this->comment);
-        $USER_PIC =(isset($this->tmp_image)) ? $this->tmp_image : '';
-        $DATE = $this->db->DateFormat(time());
-        $host = @gethostbyaddr($this->ip);
-        $AGENT = htmlspecialchars($_SERVER['HTTP_USER_AGENT']);
-        $LANG = &$this->db->LANG;
-        $VARS = &$this->db->VARS;
-        if ($this->url) {
-            $row['url'] = $this->url;
-            eval("\$URL = \"".$this->template->get_template($this->GB_TPL['url'])."\";");
-        } else {
-            $URL = '';
-        }
-        if ($this->icq && $this->db->VARS["allow_icq"]==1) {
-            $row['icq'] = $this->icq;
-            eval("\$ICQ = \"".$this->template->get_template($this->GB_TPL['icq'])."\";");
-        } else {
-            $ICQ = '';
-        }
-        if ($this->aim && $this->db->VARS["allow_aim"]==1) {
-            $row['aim'] = $this->aim;
-            eval("\$AIM = \"".$this->template->get_template($this->GB_TPL['aim'])."\";");
-        } else {
-            $AIM = '';
-        }
-        if ($this->email) {
-            $row['email'] = $this->email;
-            eval("\$EMAIL = \"".$this->template->get_template($this->GB_TPL['email'])."\";");
-        } else {
-            $EMAIL = '';
-        }
-        if ($this->db->VARS["allow_gender"]==1) {
-            $GENDER = ($this->gender=="f") ? "&nbsp;<img src=\"$GB_PG[base_url]/img/female.gif\" width=\"12\" height=\"12\">" : "&nbsp;<img src=\"$GB_PG[base_url]/img/male.gif\" width=\"12\" height=\"12\">";
-        } else {
-            $GENDER = '';
-        }
-        if ($this->db->VARS["show_ip"] == 1) {
-            $hostname = ( eregi("^[-a-z_]+", $host) ) ? "Host" : "IP";
-            $HOST = "$hostname: $host\n";
-        } else {
-            $HOST = '';
-        }
-        $HIDDEN = "<input type=\"hidden\" name=\"gb_preview\" value=\"1\">\n";
-        $HIDDEN .= "<input type=\"hidden\" name=\"gb_name\" value=\"".$this->name."\">\n";
-        $HIDDEN .= "<input type=\"hidden\" name=\"gb_email\" value=\"".$this->email."\">\n";
-        $HIDDEN .= "<input type=\"hidden\" name=\"gb_url\" value=\"".$this->url."\">\n";
-        $HIDDEN .= "<input type=\"hidden\" name=\"gb_comment\" value=\"".$this->comment."\">\n";
-        $HIDDEN .= "<input type=\"hidden\" name=\"gb_location\" value=\"".$this->location."\">\n";
-        if ($this->image_file) {
-            $HIDDEN .= "<input type=\"hidden\" name=\"gb_user_img\" value=\"".$this->image_file."\">\n";
-        }
-        if ($this->private==1) {
-            $HIDDEN .= "<input type=\"hidden\" name=\"gb_private\" value=\"".$this->private."\">\n";
-        }
-        if ($this->db->VARS["allow_gender"]==1) {
-            $HIDDEN .= "<input type=\"hidden\" name=\"gb_gender\" value=\"".$this->gender."\">\n";
-        }
-        if ($this->icq && $this->db->VARS["allow_icq"]==1) {
-            $HIDDEN .= "<input type=\"hidden\" name=\"gb_icq\" value=\"".$this->icq."\">\n";
-        }
-        if ($this->aim && $this->db->VARS["allow_aim"]==1) {
-            $HIDDEN .= "<input type=\"hidden\" name=\"gb_aim\" value=\"".$this->aim."\">\n";
-        }
-        $HIDDEN .= "<input type=\"hidden\" name=\"gb_hash\" value=\"".$this->getVerificationHash()."\">\n";
-        $row['name'] = $this->name;
-        $row['location'] = $this->location;
-        $row['email'] = $this->email;
-        $GB_PREVIEW = "";
-        $preview_html = "";
-        eval("\$GB_PREVIEW = \"".$this->template->get_template($this->GB_TPL['prev_entry'])."\";");
-        eval("\$preview_html = \"".$this->template->get_template($this->GB_TPL['header'])."\";");
-        eval("\$preview_html .= \"".$this->template->get_template($this->GB_TPL['preview'])."\";");
-        eval("\$preview_html .= \"".$this->template->get_template($this->GB_TPL['footer'])."\";");
-        return $preview_html;
-    }
-
-    function process($action='') {
-        switch ($action) {
-            case $this->db->LANG["FormSubmit"]:
-                if ($this->preview==1) {
-                    $this->comment = $this->undo_htmlspecialchars($this->comment);
-                    $this->name = $this->undo_htmlspecialchars($this->name);
-                }
-                $this->clear_tmpfiles();
-                $status = $this->check_entry();
-                return ($status == 1) ? $this->add_guest() : $status;
-                break;
-
-            case $this->db->LANG["FormPreview"]:
-                $status = $this->check_entry("preview");
-                return ($status == 1) ? $this->preview_entry() : $status;
-                break;
-
-            default:
-                return $this->form_addguest();
-        }
-    }
-
-}
-
+<?php
+/**
+ * ----------------------------------------------
+ * Advanced Guestbook 2.4.1 (PHP/MySQL)
+ * Copyright (c) Chi Kien Uong
+ * URL: http://www.proxy2.de
+ * ----------------------------------------------
+ */
+
+class addentry {
+
+    var $db;
+    var $ip;
+    var $include_path;
+    var $template;
+    var $name = '';
+    var $email = '';
+    var $url = '';
+    var $comment = '';
+    var $location = '';
+    var $icq = '';
+    var $aim = '';
+    var $gender = '';
+    var $userfile = '';
+    var $user_img = '';
+    var $preview = '';
+    var $private = '';
+    var $token = '';
+    var $gb_captcha = '';
+    var $image_file = '';
+    var $image_tag = '';
+    var $GB_TPL = array();
+    var $table = array();
+
+    function addentry($path='') {
+        global $GB_TPL, $GB_TBL, $_SERVER;
+        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'])) {
+            $this->ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
+        } else {
+            $this->ip = $_SERVER['REMOTE_ADDR'];
+        }
+        $this->db = new guestbook_vars($path);
+        $this->db->getVars();
+        $this->template = &$this->db->template;
+        $this->include_path = $path;
+        $this->GB_TPL = &$GB_TPL;
+        $this->table = &$GB_TBL;
+        $this->token = addslashes($this->token);
+        $this->canUseCaptcha = (USE_CAPTCHA) ? true : false;
+    }
+
+    function undo_htmlspecialchars($string) {
+        $html = array (
+            "&amp;"  => "&",
+            "&quot;" => "\"",
+            "&lt;"   => "<",
+            "&gt;"   => ">"
+        );
+        for(reset($html); $key=key($html); next($html)) {
+            $string = str_replace("$key","$html[$key]",$string);
+        }
+        return ($string);
+    }
+
+    function clear_tmpfiles($cachetime=1800) {
+        global $GB_TMP;
+        $delfiles = 0;
+        $filelist = '';
+        if (is_dir("$this->include_path/$GB_TMP")) {
+            chdir("$this->include_path/$GB_TMP");
+            $hnd = opendir(".");
+            while ($file = readdir($hnd)) {
+                if(is_file($file)) {
+                    $filelist[] = $file;
+                }
+            }
+            closedir($hnd);
+        }
+        if (is_array($filelist)) {
+            while (list ($key, $file) = each ($filelist)) {
+                $tmpfile = explode(".",$file);
+                $tmpfile[0] = ereg_replace ("img-", "", $tmpfile[0]);
+                if ($tmpfile[0] < (time()-$cachetime)) {
+                    if (unlink($file)) {
+                        $delfiles ++;
+                    }
+                }
+            }
+        }
+        return $delfiles;
+    }
+
+    function is_uploaded_file_readable($uploaded_file_tmp_name) {
+        $check = @fopen($uploaded_file_tmp_name, "rb");
+        if ($check) {
+            fclose($check);
+            return 1;
+        } else {
+            $is_safe_mode = get_cfg_var("safe_mode");
+            if ($is_safe_mode) {
+                return -1;
+            } else {
+                return 2;
+            }
+        }
+    }
+
+	function getToken() {
+		srand((double)microtime()*1000000);
+		$token = md5(uniqid(rand()));
+		$phraseObj = new Phrase();
+		$phraseObj->setStringLengthRange(4,6);
+		$validateKey = $phraseObj->getPhrase();
+		$timestamp = time();
+		$this->db->query("INSERT INTO {$this->table['cap']} SET session_id='$token', validate_key='$validateKey', timestamp='$timestamp'");
+		return $token;
+	}
+
+    function check_entry($type='') {
+        global $GB_UPLOAD, $GB_TMP, $GB_PG;
+        $this->db->VARS["max_img_size"] = $this->db->VARS["max_img_size"]*1024;
+        if ($this->db->VARS["banned_ip"]==1) {
+            if ($this->db->isBannedIp($this->ip)) {
+                 return $this->db->gb_error($this->db->LANG["ErrorPost9"]);
+            }
+        }
+        if ($this->db->VARS["flood_check"]==1) {
+            if ($this->db->FloodCheck($this->ip)) {
+                return $this->db->gb_error($this->db->LANG["ErrorPost8"]);
+            }
+        }
+        if (is_array($this->userfile) && $this->userfile["userfile"]["tmp_name"] != "none" && (filesize($this->userfile["userfile"]["tmp_name"])>0)) {
+            $uploaded_img_file_stat = $this->is_uploaded_file_readable($this->userfile["userfile"]["tmp_name"]);
+        } else {
+            $uploaded_img_file_stat = -1;
+        }
+        if ($uploaded_img_file_stat > 0) {
+            $extension = array("1" => 'gif',"2" => 'jpg',"3" => 'png',"4" => 'swf');
+            $the_time = time();
+            if ($this->userfile["userfile"]["size"] > $this->db->VARS["max_img_size"]) {
+                return $this->db->gb_error($this->db->LANG["ErrorPost6"]);
+            } else {
+                if ($uploaded_img_file_stat == 1) {
+                    $size = @GetImageSize($this->userfile["userfile"]["tmp_name"]);
+                    $open_basedir_res = false;
+                } else {
+                    $open_basedir_res = true;
+                    if (!eregi("WIN",PHP_OS)) {
+                        exec("cp ".$this->userfile["userfile"]["tmp_name"]." $this->include_path/$GB_TMP/img-$the_time.tmp");
+                    } else {
+                        $win_command = str_replace("/","\\",$this->userfile["userfile"]["tmp_name"]);
+                        $win_loc = str_replace("/","\\", "$this->include_path/$GB_TMP/img-$the_time.tmp");
+                        exec("copy $win_command $win_loc");
+                    }
+                    $size = @GetImageSize("$this->include_path/$GB_TMP/img-$the_time.tmp");
+                }
+                if (is_array($size) && $size[2]>0 && $size[2]<4) {
+                    $this->image_file = "img-$the_time.".$extension[$size[2]];
+                    $img = new gb_image();
+                    $img->set_destdir("$this->include_path/$GB_UPLOAD");
+                    $img->set_border_size($this->db->VARS["img_width"], $this->db->VARS["img_height"]);
+                    if ($type=="preview") {
+                        if (!$open_basedir_res) {
+                            copy($this->userfile["userfile"]["tmp_name"], "$this->include_path/$GB_TMP/$this->image_file");
+                        } else {
+                            rename("$this->include_path/$GB_TMP/img-$the_time.tmp", "$this->include_path/$GB_TMP/$this->image_file");
+                        }
+                        $new_img_size = $img->get_img_size_format($size[0], $size[1]);
+                        $GB_UPLOAD = $GB_TMP;
+                        $row['p_filename'] = $this->image_file;
+                        $row['width'] = $size[0];
+                        $row['height'] = $size[1];
+                        eval("\$this->tmp_image = \"".$this->template->get_template($this->GB_TPL['image'])."\";");
+                    } else {
+                        if (!$open_basedir_res) {
+                            copy($this->userfile["userfile"]["tmp_name"], "$this->include_path/$GB_UPLOAD/$this->image_file");
+                        } else {
+                            rename("$this->include_path/$GB_TMP/img-$the_time.tmp", "$this->include_path/$GB_UPLOAD/$this->image_file");
+                        }
+                        if ($this->db->VARS["thumbnail"]==1) {
+                            $min_size = 1024*$this->db->VARS["thumb_min_fsize"];
+                            $img->set_min_filesize($min_size);
+                            $img->set_prefix("t_");
+                            $img->create_thumbnail("$this->include_path/$GB_UPLOAD/$this->image_file","$this->image_file");
+                        }
+                    }
+                } else {
+                    return $this->db->gb_error($this->db->LANG["ErrorPost7"]);
+                }
+            }
+        }
+        if (!empty($this->user_img)) {
+            $this->image_file = trim($this->user_img);
+        }
+        $this->name = $this->db->FormatString($this->name);
+        $this->location = $this->db->FormatString($this->location);
+        $this->comment = $this->db->FormatString($this->comment);
+        $this->icq = intval($this->db->FormatString($this->icq));
+        $this->aim = htmlspecialchars($this->db->FormatString($this->aim));
+        if ($this->icq < 1000 || $this->icq >999999999) {
+            $this->icq = 0;
+        }
+        if ($this->name == "") {
+            return $this->db->gb_error($this->db->LANG["ErrorPost1"]);
+        } elseif (strlen($this->comment)<$this->db->VARS["min_text"] || strlen($this->comment)>$this->db->VARS["max_text"]) {
+            return $this->db->gb_error($this->db->LANG["ErrorPost3"]);
+        } else {
+            $this->url = trim($this->url);
+            $this->email = trim($this->email);
+            if (!eregi("^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@([0-9a-z][0-9a-z-]*[0-9a-z]\\.)+[a-z]{2,5}$", $this->email) ) {
+                $this->email = '';
+            }
+            if (!eregi("^http://[_a-z0-9-]+\\.[_a-z0-9-]+", $this->url)) {
+                $this->url = '';
+            }
+            if (htmlspecialchars($this->url) != "$this->url") {
+                $this->url = '';
+            }
+        }
+        if ($this->db->VARS["censor"]==1) {
+            $this->name = $this->db->CensorBadWords($this->name);
+            $this->location = $this->db->CensorBadWords($this->location);
+            $this->comment = $this->db->CensorBadWords($this->comment);
+        }
+        if (!$this->db->CheckWordLength($this->name) || !$this->db->CheckWordLength($this->location)) {
+            return $this->db->gb_error($this->db->LANG["ErrorPost4"]);
+        }
+        if (!$this->db->CheckWordLength($this->comment)) {
+            return $this->db->gb_error($this->db->LANG["ErrorPost10"]);
+        }
+        if ($this->canUseCaptcha) {
+        	if ($this->token == '' || $this->gb_captcha == '') {
+        		return $this->db->gb_error($this->db->LANG["ErrorPost4"]);
+        	}
+        	if (get_magic_quotes_gpc()) {
+        		$this->gb_captcha = stripslashes($this->gb_captcha);
+        	}
+        	$gb_captcha = strtoupper($this->gb_captcha);
+
+        	$res = $this->db->query("SELECT validate_key FROM {$this->table['cap']} WHERE session_id = '{$this->token}'");
+        	$result = $this->db->fetch_array($res);
+        	if ($result == false || $result['validate_key'] == "" || $gb_captcha == "") {
+        		return $this->db->gb_error($this->db->LANG["ErrorPost4"]);
+        	}
+
+        	$result['validate_key'] = strtoupper($result['validate_key']);
+        	if ($result['validate_key'] != $gb_captcha) {
+        		return $this->db->gb_error($this->db->LANG["ErrorPost4"]);
+        	}
+    	}
+    	return 1;
+    }
+
+    function add_guest() {
+        global $GB_TMP, $GB_UPLOAD, $GB_PG;
+        if ($this->preview==1 && $this->user_img) {
+            $img = new gb_image();
+            $img->set_destdir("$this->include_path/$GB_UPLOAD");
+            $img->set_border_size($this->db->VARS["img_width"], $this->db->VARS["img_height"]);
+            if ($this->db->VARS["thumbnail"]==1) {
+                $min_size = 1024*$this->db->VARS["thumb_min_fsize"];
+                $img->set_min_filesize($min_size);
+                $img->set_prefix("t_");
+                $img->create_thumbnail("$this->include_path/$GB_TMP/$this->user_img",$this->user_img);
+            }
+            copy("$this->include_path/$GB_TMP/$this->user_img", "$this->include_path/$GB_UPLOAD/$this->user_img");
+            unlink("$this->include_path/$GB_TMP/$this->user_img");
+            $this->image_file = $this->user_img;
+        }
+        $this->name = htmlspecialchars($this->name);
+        $this->location = htmlspecialchars($this->location);
+        if ($this->db->VARS["allow_html"] == 0) {
+            $this->comment = htmlspecialchars($this->comment);
+        }
+        if ($this->db->VARS["agcode"] == 1) {
+            $this->comment = $this->db->AGCode($this->comment);
+        }
+        if (!get_magic_quotes_gpc()) {
+            $this->name = addslashes($this->name);
+            $this->location = addslashes($this->location);
+            $this->aim = addslashes($this->aim);
+            $this->email = addslashes($this->email);
+            $this->url = addslashes($this->url);
+            $this->comment = addslashes($this->comment);
+            $this->gender = addslashes($this->gender);
+        }
+        $host = addslashes(@gethostbyaddr($this->ip));
+        $agent = addslashes(htmlspecialchars(strip_tags($_SERVER['HTTP_USER_AGENT'])));
+        $the_time = time();
+        $sql_usertable = ($this->private==1) ? $this->table['priv'] : $this->table['data'];
+        $this->db->query("INSERT INTO $sql_usertable (name,gender,email,url,date,location,host,browser,comment,icq,aim) VALUES ('$this->name','$this->gender','$this->email','$this->url','$the_time','$this->location','$host','$agent','$this->comment','$this->icq','$this->aim')");
+        if ($this->canUseCaptcha) {
+        	$this->db->query("DELETE FROM {$this->table['cap']} WHERE session_id = '{$this->token}'");
+    	}
+        if (!empty($this->image_file) || !empty($this->user_img)) {
+            $size = GetImageSize("$this->include_path/$GB_UPLOAD/$this->image_file");
+            if (is_array($size) && $size[2]>0 && $size[2]<4) {
+                $book_id = ($this->private==1) ? 1 : 2;
+                $p_filesize = filesize("$this->include_path/$GB_UPLOAD/$this->image_file");
+                $this->db->fetch_array($this->db->query("SELECT MAX(id) AS msg_id FROM $sql_usertable"));
+                $this->db->query("INSERT INTO ".$this->table['pics']." (msg_id,book_id,p_filename,p_size,width,height) VALUES ('".$this->db->record['msg_id']."',$book_id,'$this->image_file','$p_filesize','$size[0]','$size[1]')");
+            }
+        }
+        $from_email = ($this->email == "") ? $this->db->VARS['admin_mail'] : $this->email;
+        if ($this->db->VARS["notify_private"]==1 && $this->private==1) {
+            @mail($this->db->VARS["admin_mail"],$this->db->LANG["EmailAdminSubject"],"$this->name\n$this->host\n\n$this->comment", "From: $from_email\r\nX-Mailer: Advanced Guestbook 2");
+        }
+        if ($this->db->VARS["notify_admin"]==1 && $this->private==0) {
+            @mail($this->db->VARS["admin_mail"],$this->db->LANG["EmailAdminSubject"],"$this->name\n$this->host\n\n$this->comment", "From: $from_email\r\nX-Mailer: Advanced Guestbook 2");
+        }
+        if ($this->db->VARS["notify_guest"]==1 && $this->email != '') {
+            @mail($this->email,$this->db->LANG["EmailGuestSubject"],$this->db->VARS["notify_mes"], "From: ".$this->db->VARS['admin_mail']."\r\nX-Mailer: Advanced Guestbook 2");
+        }
+        if ($this->db->VARS["flood_check"]==1) {
+            $this->db->query("INSERT INTO ".$this->table['ip']." (guest_ip,timestamp) VALUES ('$this->ip','$the_time')");
+        }
+        $LANG = &$this->db->LANG;
+        $VARS = &$this->db->VARS;
+        $success_html = "";
+        eval("\$success_html = \"".$this->template->get_template($this->GB_TPL['success'])."\";");
+        eval("\$success_html .= \"".$this->template->get_template($this->GB_TPL['footer'])."\";");
+        return $success_html;
+    }
+
+    function form_addguest() {
+        global $GB_PG, $_COOKIE;
+        $HTML_CODE = ($this->db->VARS["allow_html"] == 1) ? $this->db->LANG["BookMess2"] : $this->db->LANG["BookMess1"];
+        $SMILE_CODE = ($this->db->VARS["smilies"] == 1) ? $this->db->LANG["FormMess2"] : $this->db->LANG["FormMess7"];
+        $AG_CODE = ($this->db->VARS["agcode"] == 1) ? $this->db->LANG["FormMess3"] : $this->db->LANG["FormMess6"];
+        $LANG = &$this->db->LANG;
+        $VARS = &$this->db->VARS;
+        if ($this->canUseCaptcha) {
+        	$VARS['gbtoken'] = $this->getToken();
+        	eval("\$CAPTCHA = \"".$this->template->get_template($this->GB_TPL['captcha'])."\";");
+        } else {
+        	$VARS['gbtoken'] = "";
+        	$CAPTCHA = "";
+        }
+        $OPTIONS[] ='';
+        if ($this->db->VARS["allow_icq"]==1) {
+            eval("\$OPTIONS['icq'] = \"".$this->template->get_template($this->GB_TPL['frm_icq'])."\";");
+        }
+        if ($this->db->VARS["allow_aim"]==1) {
+            eval("\$OPTIONS['aim'] = \"".$this->template->get_template($this->GB_TPL['frm_aim'])."\";");
+        }
+        if ($this->db->VARS["allow_gender"]==1) {
+            eval("\$OPTIONS['gender'] = \"".$this->template->get_template($this->GB_TPL['frm_gender'])."\";");
+        }
+        if ($this->db->VARS["allow_img"]==1) {
+            eval("\$OPTIONS['img'] = \"".$this->template->get_template($this->GB_TPL['frm_image'])."\";");
+        }
+        $OPTIONAL = implode("\n",$OPTIONS);
+        if (isset($_COOKIE['lang']) && !empty($_COOKIE['lang']) && file_exists("$this->include_path/lang/codes-".$_COOKIE['lang'].".php")) {
+            $LANG_CODES = "$GB_PG[base_url]/lang/codes-".$_COOKIE['lang'].".php";
+        } elseif (file_exists("$this->include_path/lang/codes-".$VARS['lang'].".php")) {
+            $LANG_CODES = "$GB_PG[base_url]/lang/codes-".$VARS['lang'].".php";
+        } else {
+            $LANG_CODES = "$GB_PG[base_url]/lang/codes-english.php";
+        }
+        $addform_html = "";
+        eval("\$addform_html = \"".$this->template->get_template($this->GB_TPL['header'])."\";");
+        eval("\$addform_html .= \"".$this->template->get_template($this->GB_TPL['form'])."\";");
+        eval("\$addform_html .= \"".$this->template->get_template($this->GB_TPL['footer'])."\";");
+        return $addform_html;
+    }
+
+    function preview_entry() {
+        global $GB_PG;
+        if (get_magic_quotes_gpc()) {
+            $this->name = stripslashes($this->name);
+            $this->comment = stripslashes($this->comment);
+            $this->location = stripslashes($this->location);
+        }
+        $this->name = htmlspecialchars($this->name);
+        if ($this->db->VARS["allow_html"] == 0) {
+            $message = htmlspecialchars($this->comment);
+            $message = nl2br($message);
+        } else {
+            $message = nl2br($this->comment);
+        }
+        if ($this->db->VARS["smilies"] == 1) {
+            $message = $this->db->emotion($message);
+        }
+        if ($this->db->VARS["agcode"] == 1) {
+            $message = $this->db->AGCode($message);
+        }
+        $this->location = htmlspecialchars($this->location);
+        $this->comment = htmlspecialchars($this->comment);
+        $USER_PIC =(isset($this->tmp_image)) ? $this->tmp_image : '';
+        $DATE = $this->db->DateFormat(time());
+        $host = @gethostbyaddr($this->ip);
+        $AGENT = htmlspecialchars($_SERVER['HTTP_USER_AGENT']);
+        $LANG = &$this->db->LANG;
+        $VARS = &$this->db->VARS;
+        if ($this->url) {
+            $row['url'] = $this->url;
+            eval("\$URL = \"".$this->template->get_template($this->GB_TPL['url'])."\";");
+        } else {
+            $URL = '';
+        }
+        if ($this->icq && $this->db->VARS["allow_icq"]==1) {
+            $row['icq'] = $this->icq;
+            eval("\$ICQ = \"".$this->template->get_template($this->GB_TPL['icq'])."\";");
+        } else {
+            $ICQ = '';
+        }
+        if ($this->aim && $this->db->VARS["allow_aim"]==1) {
+            $row['aim'] = $this->aim;
+            eval("\$AIM = \"".$this->template->get_template($this->GB_TPL['aim'])."\";");
+        } else {
+            $AIM = '';
+        }
+        if ($this->email) {
+            $row['email'] = $this->email;
+            eval("\$EMAIL = \"".$this->template->get_template($this->GB_TPL['email'])."\";");
+        } else {
+            $EMAIL = '';
+        }
+        if ($this->db->VARS["allow_gender"]==1) {
+            $GENDER = ($this->gender=="f") ? "&nbsp;<img src=\"$GB_PG[base_url]/img/female.gif\" width=\"12\" height=\"12\">" : "&nbsp;<img src=\"$GB_PG[base_url]/img/male.gif\" width=\"12\" height=\"12\">";
+        } else {
+            $GENDER = '';
+        }
+        if ($this->db->VARS["show_ip"] == 1) {
+            $hostname = ( eregi("^[-a-z_]+", $host) ) ? "Host" : "IP";
+            $HOST = "$hostname: $host\n";
+        } else {
+            $HOST = '';
+        }
+        $HIDDEN = "<input type=\"hidden\" name=\"gb_preview\" value=\"1\">\n";
+        $HIDDEN .= "<input type=\"hidden\" name=\"gb_name\" value=\"".$this->name."\">\n";
+        $HIDDEN .= "<input type=\"hidden\" name=\"gb_email\" value=\"".$this->email."\">\n";
+        $HIDDEN .= "<input type=\"hidden\" name=\"gb_url\" value=\"".$this->url."\">\n";
+        $HIDDEN .= "<input type=\"hidden\" name=\"gb_comment\" value=\"".$this->comment."\">\n";
+        $HIDDEN .= "<input type=\"hidden\" name=\"gb_location\" value=\"".$this->location."\">\n";
+        if ($this->image_file) {
+            $HIDDEN .= "<input type=\"hidden\" name=\"gb_user_img\" value=\"".$this->image_file."\">\n";
+        }
+        if ($this->private==1) {
+            $HIDDEN .= "<input type=\"hidden\" name=\"gb_private\" value=\"".$this->private."\">\n";
+        }
+        if ($this->db->VARS["allow_gender"]==1) {
+            $HIDDEN .= "<input type=\"hidden\" name=\"gb_gender\" value=\"".$this->gender."\">\n";
+        }
+        if ($this->icq && $this->db->VARS["allow_icq"]==1) {
+            $HIDDEN .= "<input type=\"hidden\" name=\"gb_icq\" value=\"".$this->icq."\">\n";
+        }
+        if ($this->aim && $this->db->VARS["allow_aim"]==1) {
+            $HIDDEN .= "<input type=\"hidden\" name=\"gb_aim\" value=\"".$this->aim."\">\n";
+        }
+        $HIDDEN .= "<input type=\"hidden\" name=\"gb_token\" value=\"".$this->token."\">\n";
+        $row['name'] = $this->name;
+        $row['location'] = $this->location;
+        $row['email'] = $this->email;
+        $GB_PREVIEW = "";
+        $preview_html = "";
+        if ($this->canUseCaptcha) {
+        	$VARS['gbtoken'] = $this->token;
+        	eval("\$CAPTCHA = \"".$this->template->get_template($this->GB_TPL['captcha'])."\";");
+        } else {
+        	$VARS['gbtoken'] = "";
+        	$CAPTCHA = "";
+        }
+        eval("\$GB_PREVIEW = \"".$this->template->get_template($this->GB_TPL['prev_entry'])."\";");
+        eval("\$preview_html = \"".$this->template->get_template($this->GB_TPL['header'])."\";");
+        eval("\$preview_html .= \"".$this->template->get_template($this->GB_TPL['preview'])."\";");
+        eval("\$preview_html .= \"".$this->template->get_template($this->GB_TPL['footer'])."\";");
+        return $preview_html;
+    }
+
+    function process($action='') {
+        switch ($action) {
+            case $this->db->LANG["FormSubmit"]:
+                if ($this->preview==1) {
+                    $this->comment = $this->undo_htmlspecialchars($this->comment);
+                    $this->name = $this->undo_htmlspecialchars($this->name);
+                }
+                $this->clear_tmpfiles();
+                $status = $this->check_entry();
+                return ($status == 1) ? $this->add_guest() : $status;
+                break;
+
+            case $this->db->LANG["FormPreview"]:
+                $status = $this->check_entry("preview");
+                return ($status == 1) ? $this->preview_entry() : $status;
+                break;
+
+            default:
+                return $this->form_addguest();
+        }
+    }
+
+}
+
 ?>
\ No newline at end of file
diff -ruN guestbook.new/lib/admin.class.php guestbook.new.2.4.1/lib/admin.class.php
--- guestbook.new/lib/admin.class.php	2005-07-19 11:31:49.000000000 -0500
+++ guestbook.new.2.4.1/lib/admin.class.php	2006-04-03 08:44:15.000000000 -0500
@@ -1,239 +1,244 @@
-<?php
-/**
- * ----------------------------------------------
- * Advanced Guestbook 2.3.3 (PHP/MySQL)
- * Copyright (c) Chi Kien Uong
- * URL: http://www.proxy2.de
- * ----------------------------------------------
- */
-
-class gb_admin {
-
-    var $db;
-    var $session;
-    var $SELF;
-    var $uid;
-    var $VARS;
-    var $table;
-
-    function gb_admin($session,$uid) {
-        global $_SERVER;
-        $this->session = $session;
-        $this->uid = $uid;
-        $this->SELF = basename($_SERVER["PHP_SELF"]);
-    }
-
-    function get_updated_vars() {
-        $this->db->query("SELECT * FROM ".$this->table['cfg']);
-        $this->VARS = $this->db->fetch_array($this->db->result);
-        $this->db->free_result($this->db->result);
-    }
-
-    function NoCacheHeader() {
-        header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
-        header("Last-Modified: " . gmdate("D, d M Y H:i:s") . "GMT");
-        header("Cache-Control: no-cache, must-revalidate");
-        header("Pragma: no-cache");
-    }
-
-    function show_panel($panel) {
-        global $smilie_list, $smilie_data;
-        $this->NoCacheHeader();
-        include_once "./admin/panel_$panel.php";
-        include_once "./admin/footer.inc.php";
-    }
-
-    function scan_smilie_dir() {
-        $smilies = '';
-        chdir("./img/smilies");
-        $hnd = opendir(".");
-        while ($file = readdir($hnd)) {
-            if(is_file($file)) {
-                if ($file != "." && $file != "..") {
-                    if (ereg(".gif|.jpg|.png|.jpeg",$file)) {
-                        $smilie_list[] = $file;
-                    }
-                }
-            }
-        }
-        closedir($hnd);
-        if (isset($smilie_list)) {
-            asort($smilie_list);
-            for ($i=0;$i<sizeof($smilie_list);$i++) {
-                $size = GetImageSize($smilie_list[$i]);
-                if (is_array($size)) {
-                    $smilies[$smilie_list[$i]] = "<img src=\"img/smilies/$smilie_list[$i]\" $size[3]>";
-                }
-            }
-        }
-        chdir("../../");
-        return $smilies;
-    }
-
-    function show_entry($tbl="gb") {
-        global $entry, $record, $GB_UPLOAD;
-        $entry = intval($entry);
-        $record = intval($record);
-        if ($tbl=="priv") {
-            $gb_tbl = $this->table['priv'];
-            $book_id = 1;
-        } else {
-            $gb_tbl = $this->table['data'];
-            $tbl="gb";
-            $book_id = 2;
-        }
-        $entries_per_page = intval($this->VARS["entries_per_page"]);
-        if(!isset($entry)) {
-            $entry = 0;
-        }
-        if(!isset($record)) {
-            $record = 0;
-        }
-        $next_page = $entry+$entries_per_page;
-        $prev_page = $entry-$entries_per_page;
-        $this->db->query("select count(*) total from $gb_tbl");
-        $this->db->fetch_array($this->db->result);
-        $total = $this->db->record['total'];
-        if ($record > 0 && $record <= $total) {
-            $entry = $total-$record;
-            $next_page = $entry+$entries_per_page;
-            $prev_page = $entry-$entries_per_page;
-        }
-        $result = $this->db->query("select x.*, y.p_filename, y.width, y.height from $gb_tbl x left join ".$this->db->table['pics']." y on (x.id=y.msg_id and y.book_id=$book_id) order by id desc limit $entry, $entries_per_page");
-        $img = new gb_image();
-        $img->set_border_size($this->VARS["img_width"], $this->VARS["img_height"]);
-        $this->NoCacheHeader();
-        include_once "./admin/panel_easy.php";
-        include_once "./admin/footer.inc.php";
-    }
-
-    function del_entry($entry_id,$tbl="gb") {
-        global $GB_UPLOAD;
-        $entry_id = intval($entry_id);
-        switch ($tbl) {
-            case "gb" :
-                $this->db->query("select p_filename from ".$this->table['pics']." WHERE (msg_id = '$entry_id' and book_id=2)");
-                $result = $this->db->fetch_array($this->db->result);
-                if ($result["p_filename"]) {
-                    if (file_exists("./$GB_UPLOAD/$result[p_filename]")) {
-                        unlink ("./$GB_UPLOAD/$result[p_filename]");
-                    }
-                    if (file_exists("./$GB_UPLOAD/t_$result[p_filename]")) {
-                        unlink ("./$GB_UPLOAD/t_$result[p_filename]");
-                    }
-                }
-                $this->db->query("DELETE FROM ".$this->table['data']." WHERE (id = '$entry_id')");
-                $this->db->query("DELETE FROM ".$this->table['com']." WHERE (id = '$entry_id')");
-                $this->db->query("DELETE FROM ".$this->table['pics']." WHERE (msg_id = '$entry_id' and book_id=2)");
-                break;
-
-            case "priv" :
-                $this->db->query("select p_filename from ".$this->table['pics']." WHERE (msg_id = '$entry_id' and book_id=1)");
-                $result = $this->db->fetch_array($this->db->result);
-                if ($result["p_filename"]) {
-                    if (file_exists("./$GB_UPLOAD/$result[p_filename]")) {
-                        unlink ("./$GB_UPLOAD/$result[p_filename]");
-                    }
-                    if (file_exists("./$GB_UPLOAD/t_$result[p_filename]")) {
-                        unlink ("./$GB_UPLOAD/t_$result[p_filename]");
-                    }
-                }
-                $this->db->query("DELETE FROM ".$this->table['priv']." WHERE (id = '$entry_id')");
-                $this->db->query("DELETE FROM ".$this->table['pics']." WHERE (msg_id = '$entry_id' and book_id=1)");
-                break;
-
-            case "com" :
-                $this->db->query("DELETE FROM ".$this->table['com']." WHERE (com_id = '$entry_id')");
-                break;
-        }
-    }
-
-    function update_record($entry_id,$tbl="gb") {
-        global $_POST;
-        $gb_tbl = ($tbl=="priv") ? $this->table['priv'] : $this->table['data'];
-        reset($_POST);
-        if (!get_magic_quotes_gpc() ) {
-            while (list($var, $value)=each($_POST)) {
-                $_POST[$var] = addslashes($value);
-            }
-        }
-        reset($_POST);
-        while (list($var, $value)=each($_POST)) {
-            $_POST[$var]=trim($value);
-        }
-        if (!eregi(".+@[-a-z0-9_]+", $_POST['email'])) {
-            $_POST['email'] = '';
-        }
-        if (!eregi("^http://[-a-z0-9_]+", $_POST['url'])) {
-            $_POST['url'] = '';
-        }
-        $sqlquery= "UPDATE $gb_tbl set name='$_POST[name]', email='$_POST[email]', gender='$_POST[gender]', url='$_POST[url]', location='$_POST[location]', ";
-        $sqlquery.="host='$_POST[host]', browser='$_POST[browser]', comment='$_POST[comment]', icq='$_POST[icq]', aim='$_POST[aim]' WHERE (id = '$entry_id')";
-        $this->db->query($sqlquery);
-    }
-
-    function show_form($entry_id,$tbl="gb") {
-        global $record;
-        $record = intval($record);
-        $gb_tbl = ($tbl=="priv") ? $this->table['priv'] : $this->table['data'];
-        $this->db->query("select * from $gb_tbl where (id = '$entry_id')");
-        $row = $this->db->fetch_array($this->db->result);
-        for(reset($row); $key=key($row); next($row)) {
-            $row[$key] = htmlspecialchars($row[$key]);
-        }
-        $this->NoCacheHeader();
-        include_once "./admin/panel_edit.php";
-        include_once "./admin/footer.inc.php";
-    }
-
-    function edit_template($tpl_name,$tpl_save) {
-        global $_POST, $GB_TPL;
-        $this->NoCacheHeader();
-        $filename = "./templates/$tpl_name";
-        if (file_exists("$filename") && $tpl_name != '') {
-            if ($tpl_save == "update") {
-                if (get_magic_quotes_gpc()) {
-                   $_POST['gb_template'] = stripslashes($_POST['gb_template']);
-                }
-                $fd = fopen ($filename, "w");
-                fwrite($fd,$_POST['gb_template']);
-                $gb_template = $_POST['gb_template'];
-            } else {
-                $fd = fopen ($filename, "r");
-                $gb_template = fread ($fd, filesize ($filename));
-            }
-            fclose ($fd);
-        } else {
-            $gb_template ='';
-        }
-        include_once "./admin/panel_template.php";
-        include_once "./admin/footer.inc.php";
-    }
-
-    function show_settings($cat) {
-        $this->db->query("select * from ".$this->table['words']);
-        while ($this->db->fetch_array($this->db->result)) {
-            $badwords[] = $this->db->record["word"];
-        }
-        $this->db->free_result($this->db->result);
-        $this->db->query("select * from ".$this->table['ban']);
-        while ($this->db->fetch_array($this->db->result)) {
-            $banned_ips[] = $this->db->record["ban_ip"];
-        }
-        $this->db->free_result($this->db->result);
-        $this->db->query("select * from ".$this->table['auth']." where ID=$this->uid");
-        $row = $this->db->fetch_array($this->db->result);
-        $this->NoCacheHeader();
-        if ($cat == "general") {
-            include_once "./admin/panel_main.php";
-        } elseif ($cat == "style") {
-            include_once "./admin/panel_style.php";
-        } elseif ($cat == "pwd") {
-            include_once "./admin/panel_pwd.php";
-        }
-        include_once "./admin/footer.inc.php";
-    }
-
-}
-
+<?php
+/**
+ * ----------------------------------------------
+ * Advanced Guestbook 2.4.1 (PHP/MySQL)
+ * Copyright (c) Chi Kien Uong
+ * URL: http://www.proxy2.de
+ * ----------------------------------------------
+ */
+
+class gb_admin {
+
+    var $db;
+    var $session;
+    var $SELF;
+    var $uid;
+    var $VARS;
+    var $table;
+
+    function gb_admin($session,$uid) {
+        global $_SERVER;
+        $this->session = $session;
+        $this->uid = $uid;
+        $this->SELF = basename($_SERVER["PHP_SELF"]);
+    }
+
+    function get_updated_vars() {
+        $this->db->query("SELECT * FROM ".$this->table['cfg']);
+        $this->VARS = $this->db->fetch_array($this->db->result);
+        $this->db->free_result($this->db->result);
+    }
+
+    function NoCacheHeader() {
+        header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
+        header("Last-Modified: " . gmdate("D, d M Y H:i:s") . "GMT");
+        header("Cache-Control: no-cache, must-revalidate");
+        header("Pragma: no-cache");
+    }
+
+    function show_panel($panel) {
+        global $smilie_list, $smilie_data;
+        $this->NoCacheHeader();
+        include_once "./admin/panel_$panel.php";
+        include_once "./admin/footer.inc.php";
+    }
+
+    function scan_smilie_dir() {
+        $smilies = '';
+        chdir("./img/smilies");
+        $hnd = opendir(".");
+        while ($file = readdir($hnd)) {
+            if(is_file($file)) {
+                if ($file != "." && $file != "..") {
+                    if (ereg(".gif|.jpg|.png|.jpeg",$file)) {
+                        $smilie_list[] = $file;
+                    }
+                }
+            }
+        }
+        closedir($hnd);
+        if (isset($smilie_list)) {
+            asort($smilie_list);
+            for ($i=0;$i<sizeof($smilie_list);$i++) {
+                $size = GetImageSize($smilie_list[$i]);
+                if (is_array($size)) {
+                    $smilies[$smilie_list[$i]] = "<img src=\"img/smilies/$smilie_list[$i]\" $size[3]>";
+                }
+            }
+        }
+        chdir("../../");
+        return $smilies;
+    }
+
+    function show_entry($tbl="gb") {
+        global $entry, $record, $GB_UPLOAD;
+        $entry = intval($entry);
+        $record = intval($record);
+        if ($tbl=="priv") {
+            $gb_tbl = $this->table['priv'];
+            $book_id = 1;
+        } else {
+            $gb_tbl = $this->table['data'];
+            $tbl="gb";
+            $book_id = 2;
+        }
+        $entries_per_page = intval($this->VARS["entries_per_page"]);
+        if(!isset($entry)) {
+            $entry = 0;
+        }
+        if(!isset($record)) {
+            $record = 0;
+        }
+        $next_page = $entry+$entries_per_page;
+        $prev_page = $entry-$entries_per_page;
+        $this->db->query("select count(*) total from $gb_tbl");
+        $this->db->fetch_array($this->db->result);
+        $total = $this->db->record['total'];
+        if ($record > 0 && $record <= $total) {
+            $entry = $total-$record;
+            $next_page = $entry+$entries_per_page;
+            $prev_page = $entry-$entries_per_page;
+        }
+        $result = $this->db->query(
+        	"select x.*, y.p_filename, y.width, y.height from $gb_tbl x left join 
+        	".$this->db->table['pics']." y on (x.id=y.msg_id and y.book_id=$book_id) 
+        	order by id desc limit $entry, $entries_per_page"
+        );
+        $img = new gb_image();
+        $img->set_border_size($this->VARS["img_width"], $this->VARS["img_height"]);
+        $this->NoCacheHeader();
+        include_once "./admin/panel_easy.php";
+        include_once "./admin/footer.inc.php";
+    }
+
+    function del_entry($entry_id,$tbl="gb") {
+        global $GB_UPLOAD;
+        $entry_id = intval($entry_id);
+        switch ($tbl) {
+            case "gb" :
+                $this->db->query("select p_filename from ".$this->table['pics']." WHERE (msg_id = '$entry_id' and book_id=2)");
+                $result = $this->db->fetch_array($this->db->result);
+                if ($result["p_filename"]) {
+                    if (file_exists("./$GB_UPLOAD/$result[p_filename]")) {
+                        unlink ("./$GB_UPLOAD/$result[p_filename]");
+                    }
+                    if (file_exists("./$GB_UPLOAD/t_$result[p_filename]")) {
+                        unlink ("./$GB_UPLOAD/t_$result[p_filename]");
+                    }
+                }
+                $this->db->query("DELETE FROM ".$this->table['data']." WHERE (id = '$entry_id')");
+                $this->db->query("DELETE FROM ".$this->table['com']." WHERE (id = '$entry_id')");
+                $this->db->query("DELETE FROM ".$this->table['pics']." WHERE (msg_id = '$entry_id' and book_id=2)");
+                break;
+
+            case "priv" :
+                $this->db->query("select p_filename from ".$this->table['pics']." WHERE (msg_id = '$entry_id' and book_id=1)");
+                $result = $this->db->fetch_array($this->db->result);
+                if ($result["p_filename"]) {
+                    if (file_exists("./$GB_UPLOAD/$result[p_filename]")) {
+                        unlink ("./$GB_UPLOAD/$result[p_filename]");
+                    }
+                    if (file_exists("./$GB_UPLOAD/t_$result[p_filename]")) {
+                        unlink ("./$GB_UPLOAD/t_$result[p_filename]");
+                    }
+                }
+                $this->db->query("DELETE FROM ".$this->table['priv']." WHERE (id = '$entry_id')");
+                $this->db->query("DELETE FROM ".$this->table['pics']." WHERE (msg_id = '$entry_id' and book_id=1)");
+                break;
+
+            case "com" :
+                $this->db->query("DELETE FROM ".$this->table['com']." WHERE (com_id = '$entry_id')");
+                break;
+        }
+    }
+
+    function update_record($entry_id,$tbl="gb") {
+        global $_POST;
+        $gb_tbl = ($tbl=="priv") ? $this->table['priv'] : $this->table['data'];
+        reset($_POST);
+        if (!get_magic_quotes_gpc() ) {
+            while (list($var, $value)=each($_POST)) {
+                $_POST[$var] = addslashes($value);
+            }
+        }
+        reset($_POST);
+        while (list($var, $value)=each($_POST)) {
+            $_POST[$var]=trim($value);
+        }
+        if (!eregi(".+@[-a-z0-9_]+", $_POST['email'])) {
+            $_POST['email'] = '';
+        }
+        if (!eregi("^http://[-a-z0-9_]+", $_POST['url'])) {
+            $_POST['url'] = '';
+        }
+        $_POST['icq'] = intval($_POST['icq']);
+        $sqlquery= "UPDATE $gb_tbl set name='$_POST[name]', email='$_POST[email]', gender='$_POST[gender]', url='$_POST[url]', location='$_POST[location]', ";
+        $sqlquery.="host='$_POST[host]', browser='$_POST[browser]', comment='$_POST[comment]', icq='$_POST[icq]', aim='$_POST[aim]' WHERE (id = '$entry_id')";
+        $this->db->query($sqlquery);
+    }
+
+    function show_form($entry_id,$tbl="gb") {
+        global $record;
+        $record = intval($record);
+        $gb_tbl = ($tbl=="priv") ? $this->table['priv'] : $this->table['data'];
+        $this->db->query("select * from $gb_tbl where (id = '$entry_id')");
+        $row = $this->db->fetch_array($this->db->result);
+        for(reset($row); $key=key($row); next($row)) {
+            $row[$key] = htmlspecialchars($row[$key]);
+        }
+        $this->NoCacheHeader();
+        include_once "./admin/panel_edit.php";
+        include_once "./admin/footer.inc.php";
+    }
+
+    function edit_template($tpl_name,$tpl_save) {
+        global $_POST, $GB_TPL;
+        $this->NoCacheHeader();
+        $filename = "./templates/$tpl_name";
+        if (file_exists("$filename") && $tpl_name != '') {
+            if ($tpl_save == "update") {
+                if (get_magic_quotes_gpc()) {
+                   $_POST['gb_template'] = stripslashes($_POST['gb_template']);
+                }
+                $fd = fopen ($filename, "w");
+                fwrite($fd,$_POST['gb_template']);
+                $gb_template = $_POST['gb_template'];
+            } else {
+                $fd = fopen ($filename, "r");
+                $gb_template = fread ($fd, filesize ($filename));
+            }
+            fclose ($fd);
+        } else {
+            $gb_template ='';
+        }
+        include_once "./admin/panel_template.php";
+        include_once "./admin/footer.inc.php";
+    }
+
+    function show_settings($cat) {
+        $this->db->query("select * from ".$this->table['words']);
+        while ($this->db->fetch_array($this->db->result)) {
+            $badwords[] = $this->db->record["word"];
+        }
+        $this->db->free_result($this->db->result);
+        $this->db->query("select * from ".$this->table['ban']);
+        while ($this->db->fetch_array($this->db->result)) {
+            $banned_ips[] = $this->db->record["ban_ip"];
+        }
+        $this->db->free_result($this->db->result);
+        $this->db->query("select * from ".$this->table['auth']." where ID=$this->uid");
+        $row = $this->db->fetch_array($this->db->result);
+        $this->NoCacheHeader();
+        if ($cat == "general") {
+            include_once "./admin/panel_main.php";
+        } elseif ($cat == "style") {
+            include_once "./admin/panel_style.php";
+        } elseif ($cat == "pwd") {
+            include_once "./admin/panel_pwd.php";
+        }
+        include_once "./admin/footer.inc.php";
+    }
+
+}
+
 ?>
\ No newline at end of file
diff -ruN guestbook.new/lib/bitmapimagetext.class.php guestbook.new.2.4.1/lib/bitmapimagetext.class.php
--- guestbook.new/lib/bitmapimagetext.class.php	1969-12-31 18:00:00.000000000 -0600
+++ guestbook.new.2.4.1/lib/bitmapimagetext.class.php	2006-04-03 08:44:15.000000000 -0500
@@ -0,0 +1,1038 @@
+<?php
+/**
+ * ----------------------------------------------
+ * Advanced Guestbook 2.4.1 (PHP/MySQL)
+ * Copyright (c) Chi Kien Uong
+ * URL: http://www.proxy2.de
+ * ----------------------------------------------
+ */
+/**
+ * Usage
+ * <pre>
+ *   $img = new BitmapImageText();
+ *   $img->setText("TEXT");
+ *   $img->setBackgroundColors(array("EEEEEE", "F2F3D3", "F5EAEA", "E4F3EE", "EEE4F3"));
+ *   $img->setTextColors(array("000000", "FD130A", "0A1BFD", "149703", "486C66", "870DC3", "D78406", "105243"));
+ *   $img->getImage();
+ * </pre>
+ */
+
+class BitmapImageText {
+
+	var $width;
+	var $text;
+	var $textColors;
+	var $backgroundColors;
+	var $contentLength;
+	var $bitmapFileHeader;
+	var $bitmapFilesize;
+	var $bitmapDataSize;
+	var $bitmapHeaderSize;
+	var $bitmapData;
+	var $charArr;
+
+	function BitmapImageText() {
+
+		$this->width = 0;
+		$this->text = NULL;
+		$this->bitmapFilesize = 0;
+		$this->bitmapDataSize = 0;
+		$this->bitmapHeaderSize = 54;
+		$this->textColors = array(array(0,0,0));
+		$this->backgroundColors = array(array(255,255,255));
+		$this->charArr = array();
+		$this->bitmapData = "";
+		$this->contentLength = 0;
+		$this->bitmapFileHeader = array(
+			0x42,0x4D,
+			&$this->bitmapFilesize,
+			0,0,0,0,
+			0x36,0,0,0,
+			0x28,0,0,0,
+			&$this->width,
+			0x10,0,0,0,
+			1,0,
+			0x18,0,
+			0,0,0,0,
+			&$this->bitmapDataSize,
+			0xC4,0xE,0,0,
+			0xC4,0xE,0,0,
+			0,0,0,0,
+			0,0,0,0
+		);
+		$hcount = count($this->bitmapFileHeader);
+		for ($i=0; $i<$hcount; $i++) {
+			$this->bitmapFileHeader[$i] = pack("C", $this->bitmapFileHeader[$i]);
+		}
+		$this->chars['0'] = array(
+
+			0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+			0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+			0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,
+			0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,
+			0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,
+			0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,
+			0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,
+			0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,
+			0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,
+			0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,
+			0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,
+			0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,
+			0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+			0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+			0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+			0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+
+		);
+		$this->chars['1'] = array(
+
+			0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+			0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+			0,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,
+			0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,
+			0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,
+			0,0,0,0,0,0,0,0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,0,0,1,0,0,0,0,0,
+			0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,
+			0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,
+			0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,
+			0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+			0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+			0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+			0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+
+		);
+
+	}
+
+	function setText($text) {
+		$text = trim($text);
+		if (!empty($text)) {
+			$this->text = $text;
+			$this->charArr = array();
+			$this->bitmapData = "";
+			$this->bitmapDataSize = 0;
+			$this->width = 0;
+			$this->bitmapFilesize = 0;
+			$this->contentLength = 0;
+			return true;
+		}
+		return false;
+	}
+
+	function setBackgroundColor($htmlColorCode) {
+		$rgbArr = $this->getRGBCode($htmlColorCode);
+		if (count($rgbArr)>0) {
+			unset($this->backgroundColors);
+			$this->backgroundColors[] = $rgbArr;
+			return true;
+		}
+		return false;
+	}
+
+	function setBackgroundColors($htmlColorCodeArr) {
+		$retval = false;
+		foreach ($htmlColorCodeArr as $key => $value) {
+			$rgbArr = $this->getRGBCode($value);
+			if (count($rgbArr)>0) {
+				if ($retval == false) {
+					unset($this->backgroundColors);
+					$retval = true;
+				}
+				$this->backgroundColors[] = $rgbArr;
+			}
+		}
+		return $retval;
+	}
+
+	function setTextColor($htmlColorCode) {
+		$rgbArr = $this->getRGBCode($htmlColorCode);
+		if (count($rgbArr)>0) {
+			unset($this->textColors);
+			$this->textColors[] = $rgbArr;
+			return true;
+		}
+		return false;
+	}
+
+	function setTextColors($htmlColorCodeArr) {
+		$retval = false;
+		foreach ($htmlColorCodeArr as $key => $value) {
+			$rgbArr = $this->getRGBCode($value);
+			if (count($rgbArr)>0) {
+				if ($retval == false) {
+					unset($this->textColors);
+					$retval = true;
+				}
+				$this->textColors[] = $rgbArr;
+			}
+		}
+		return $retval;
+	}
+
+	function getImageWidth($width) {
+		if ($this->text != "") {
+			return strlen($this->text)*16;
+		}
+	}
+
+	function getImageFile($filename) {
+		$this->createImage();
+		if (!empty($this->bitmapData)) {
+			$filename = trim($filename);
+			$saveDir = dirname($filename);
+			if (!is_writable($saveDir)) {
+				return NULL;
+			}
+			if (file_exists($filename) && !is_writable($filename)) {
+				return NULL;
+			}
+			$retVal = NULL;
+			$handle = fopen($filename, "wb");
+			if ($handle) {
+				fwrite($handle, implode("", $this->bitmapFileHeader));
+				fwrite($handle, $this->bitmapData);
+				fclose($handle);
+				$retVal = $filename;
+			}
+			return $retVal;
+		}
+		return NULL;
+	}
+
+	function getImage() {
+		$this->createImage();
+		if (!empty($this->bitmapData)) {
+			header("Content-Type: image/bmp");
+			header("Content-Length: ".$this->contentLength);
+			echo implode("", $this->bitmapFileHeader);
+			echo $this->bitmapData;
+		} else {
+			$this->createPixel();
+		}
+	}
+
+	function createPixel() {
+		$date = date("D, d M Y H:i:s");
+		header("Cache-Control: no-cache");
+		header("Pragma: no-cache");
+		header("Content-Type: image/bmp");
+		header("Expires: Sat, 1 Jan 2000 00:00:00 GMT");
+		header("Last-Modified: $date GMT");
+		echo base64_decode("Qk06AAAAAAAAADYAAAAoAAAAAQAAAAEAAAABABgAAAAAAAQAAADEDgAAxA4AAAAAAAAAAAAA////AA==");
+	}
+
+	/**
+	 * private methods
+	 */
+
+	function getRGBCode($htmlColorCode) {
+		$rgbArr = array();
+		if (strlen($htmlColorCode) == 6) {
+			$htmlCodeArr = array();
+			eregi("([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})", $htmlColorCode, $htmlCodeArr);
+			if (count($htmlCodeArr) == 4) {
+				for ($i=1; $i<=3; $i++) {
+					$k = $i-1;
+					$rgbArr[$k] = hexdec($htmlCodeArr[$i]);
+				}
+				return $rgbArr;
+			}
+		}
+		return $rgbArr;
+	}
+
+	function getBGRHex($colorArr) {
+		$codeHex = pack("C", $colorArr[2]).pack("C", $colorArr[1]).pack("C", $colorArr[0]);
+		return $codeHex;
+	}
+
+	function getHexStr($strArr) {
+		$hexStr = "";
+		$arrSize = count($strArr);
+		for ($i=0; $i<$arrSize; $i++) {
+			$hexStr .= pack("C", $strArr[$i]);
+		}
+		return $hexStr;
+	}
+
+	function getPreparedText() {
+		$this->charArr = array();
+		if ($this->text != "") {
+			$charArr = preg_split('//', $this->text, -1, PREG_SPLIT_NO_EMPTY);
+			srand((double)microtime()*1000000);
+			$textColorIndex = count($this->textColors) - 1;
+			for ($i=0; $i<count($charArr); $i++) {
+				$randColorIndex = rand(0,$textColorIndex);
+				if (isset($this->chars[$charArr[$i]])) {
+					$char = $charArr[$i];
+				} else {
+					$char = 'undefined';
+				}
+				$this->charArr[] = array("color" => $this->textColors[$randColorIndex], "char" => $char);
+			}
+		}
+		return $this->charArr;
+	}
+
+	function getTextLength() {
+		if ($this->text != NULL) {
+			return strlen($this->text);
+		}
+		return 0;
+	}
+
+	function createImage() {
+		if ($this->bitmapData != "" || $this->text == "") {
+			return;
+		}
+		if (count($this->charArr) == 0) {
+			$this->getPreparedText();
+		}
+		$chars = count($this->charArr);
+		srand((double)microtime()*1000000);
+		$backgroundColorIndex = count($this->backgroundColors) - 1;
+		$randBgIndex = rand(0,$backgroundColorIndex);
+		$randBgColor = $this->getBGRHex($this->backgroundColors[$randBgIndex]);
+		$this->bitmapData = "";
+		if ($chars == 1) {
+			$randTextColor = $this->getBGRHex($this->charArr[0]['color']);
+			for ($k=0; $k<256; $k++) {
+				if ($this->chars[$this->charArr[0]['char']][$k] == 0) {
+					$this->bitmapData .= $randBgColor;
+				} else {
+					$this->bitmapData .= $randTextColor;
+				}
+			}
+		} else {
+			for ($k=0; $k<$chars; $k++) {
+				$alpha = $this->charArr[$k]['char'];
+				$randTextColors[$alpha] = $this->getBGRHex($this->charArr[$k]['color']);
+			}
+			$inner = 0;
+			for ($p=0; $p<16; $p++) {
+				for ($k=0; $k<$chars; $k++) {
+					$index = $this->charArr[$k]['char'];
+					for ($i=0; $i<16; $i++) {
+						$pos = $inner + $i;
+						if ($this->chars[$index][$pos] == 0) {
+							$this->bitmapData .= $randBgColor;
+						} else {
+							$this->bitmapData .= $randTextColors[$index];
+						}
+					}
+				}
+				$inner += 16;
+			}
+		}
+		$this->width = pack("V", $chars*16);
+		$this->bitmapDataSize = pack("V", $chars*768);
+		$this->bitmapFilesize = pack("V", $this->bitmapHeaderSize + $chars*768);
+		$this->contentLength = $this->bitmapHeaderSize + $chars*768;
+	}
+
+}
+
+?>
\ No newline at end of file
diff -ruN guestbook.new/lib/captcha.class.php guestbook.new.2.4.1/lib/captcha.class.php
--- guestbook.new/lib/captcha.class.php	1969-12-31 18:00:00.000000000 -0600
+++ guestbook.new.2.4.1/lib/captcha.class.php	2006-04-03 08:44:15.000000000 -0500
@@ -0,0 +1,434 @@
+<?php
+/**
+ * ----------------------------------------------
+ * Advanced Guestbook 2.4.1 (PHP/MySQL)
+ * Copyright (c) Chi Kien Uong
+ * URL: http://www.proxy2.de
+ * ----------------------------------------------
+ */
+/**
+ * Usage
+ * <pre>
+ *   $img = new SimpleCaptcha();
+ *   $img->setText("AFhQW4");
+ *   $img->setBackgroundColors(array("EEEEEE", "F2F3D3", "F5EAEA", "E4F3EE", "EEE4F3"));
+ *   $img->setTextColors(array("000000", "FD130A", "0A1BFD", "149703", "486C66", "870DC3", "D78406", "105243"));
+ *   $img->setFontSizeRange(12,18);
+ *   $img->getImage();
+ * </pre>
+ */
+
+class SimpleCaptcha {
+
+	var $width;
+	var $height;
+	var $text;
+	var $imgRes;
+	var $textColors;
+	var $backgroundColors;
+	var $fontFiles;
+	var $fontSizeRange;
+	var $angleRange;
+	var $randYOrdinate;
+	var $length;
+	var $letterSpacingX;
+	var $paddingLeft;
+	var $useGrid;
+	var $gridColor;
+	var $gridSize;
+	var $fontDir;
+	var $hasGDSupport;
+	var $supportedImagesTypes;
+
+	function SimpleCaptcha() {
+		$this->width = 80;
+		$this->height = 35;
+		$this->text = NULL;
+		$this->textColors = array(array(0,0,0));
+		$this->backgroundColors = array(array(255,255,255));
+		$this->imgRes = NULL;
+		$this->fontDir = dirname(__FILE__)."/fonts";
+		$this->fontSizeRange = array(14,16);
+		$this->angleRange = array(-25,25);
+		$this->randYOrdinate = array(0,8);
+		$this->length = array();
+		$this->letterSpacingX = 1.3;
+		$this->letterSpacingY = 1.7;
+		$this->paddingLeft = 10;
+		$this->useGrid = true;
+		$this->gridColor = array(182,197,221);
+		$this->gridSize = 10;
+		$this->hasGDSupport = (extension_loaded("gd") && function_exists("imagettftext")) ? true : false;
+		if ($this->hasGDSupport == true) {
+			$this->getSupportedImagesTypes();
+			chdir($this->fontDir);
+			$handle = opendir('.');
+			while ($file = readdir($handle)) {
+				if (preg_match("/\.ttf/i", $file)) {
+					$this->addFontFile($this->fontDir."/$file");
+				}
+			}
+			closedir($handle);
+		}
+	}
+
+	function setText($text) {
+		$text = trim($text);
+		if (!empty($text)) {
+			$this->text = $text;
+			$this->textArr = array();
+			if (is_resource($this->imgRes)) {
+				imagedestroy($this->imgRes);
+			}
+			return true;
+		}
+		return false;
+	}
+
+	function setBackgroundColor($htmlColorCode) {
+		$rgbArr = $this->getRGBCode($htmlColorCode);
+		if (count($rgbArr)>0) {
+			unset($this->backgroundColors);
+			$this->backgroundColors[] = $rgbArr;
+			return true;
+		}
+		return false;
+	}
+
+	function setBackgroundColors($htmlColorCodeArr) {
+		$retval = false;
+		foreach ($htmlColorCodeArr as $key => $value) {
+			$rgbArr = $this->getRGBCode($value);
+			if (count($rgbArr)>0) {
+				if ($retval == false) {
+					unset($this->backgroundColors);
+					$retval = true;
+				}
+				$this->backgroundColors[] = $rgbArr;
+			}
+		}
+		return $retval;
+	}
+
+	function setTextColor($htmlColorCode) {
+		$rgbArr = $this->getRGBCode($htmlColorCode);
+		if (count($rgbArr)>0) {
+			unset($this->textColors);
+			$this->textColors[] = $rgbArr;
+			return true;
+		}
+		return false;
+	}
+
+	function setTextColors($htmlColorCodeArr) {
+		$retval = false;
+		foreach ($htmlColorCodeArr as $key => $value) {
+			$rgbArr = $this->getRGBCode($value);
+			if (count($rgbArr)>0) {
+				if ($retval == false) {
+					unset($this->textColors);
+					$retval = true;
+				}
+				$this->textColors[] = $rgbArr;
+			}
+		}
+		return $retval;
+	}
+
+	function setFontSize($fontSize) {
+		$fontSize = intval($fontSize);
+		if ($fontSize >= 8) {
+			$this->setFontSizeRange($fontSize, $fontSize);
+			return true;
+		}
+		return false;
+	}
+
+	function setFontSizeRange($minFontSize, $maxFontSize) {
+		if ($maxFontSize >= $minFontSize) {
+			if ($minFontSize >= 6 && $maxFontSize >= 6) {
+				$this->fontSizeRange[0] = $minFontSize;
+				$this->fontSizeRange[1] = $maxFontSize;
+				return true;
+			}
+		}
+		return false;
+	}
+
+	function setFontFile($fontFile) {
+		if (is_readable($fontFile)) {
+			$this->fontFiles = array($fontFile);
+			return true;
+		}
+		return false;
+	}
+
+	function addFontFile($fontFile) {
+		if (is_readable($fontFile)) {
+			$this->fontFiles[] = $fontFile;
+			return true;
+		}
+		return false;
+	}
+
+	function addFontFiles($fontFileArr) {
+		foreach ($fontFileArr as $key => $value) {
+			$this->addFontFile($value);
+		}
+	}
+
+	function setImageWidth($width) {
+		$width = intval($width);
+		if ($width > 0) {
+			$this->width = $width;
+			return true;
+		}
+		return false;
+	}
+
+	function setImageHeight($height) {
+		$height = intval($height);
+		if ($height > 0) {
+			$this->height = $height;
+			return true;
+		}
+		return false;
+	}
+
+	function getImageFile($filename, $type="png") {
+		if ($this->hasGDSupport == false) {
+			return NULL;
+		}
+		$filename = trim($filename);
+		$saveDir = dirname($filename);
+		if (!is_writable($saveDir)) {
+			return NULL;
+		}
+		if (file_exists($filename) && !is_writable($filename)) {
+			return NULL;
+		}
+		$retVal = NULL;
+		$this->createImage();
+		$type = strtolower($type);
+		switch ($type) {
+			case "jpeg":
+			case "jpg":
+				if ($this->supportedImagesTypes['jpg'] == true) {
+					imagejpeg($this->imgRes, $filename);
+					$retVal = $filename;
+				}
+				break;
+
+			case "png":
+				if ($this->supportedImagesTypes['png'] == true) {
+					imagepng($this->imgRes, $filename);
+					$retVal = $filename;
+				}
+				break;
+
+			case "gif":
+				if ($this->supportedImagesTypes['gif'] == true) {
+					imagegif($this->imgRes, $filename);
+					$retVal = $filename;
+				}
+				break;
+
+			default:
+				if ($this->supportedImagesTypes['png'] == true) {
+					imagepng($this->imgRes, $filename);
+					$retVal = $filename;
+				}
+		}
+		imagedestroy($this->imgRes);
+		return $retVal;
+	}
+
+	function getImage($type="png") {
+		if ($this->hasGDSupport == false) {
+			$this->createPixel();
+		} else {
+			$this->createImage();
+			$type = strtolower($type);
+			switch ($type) {
+				case "jpeg":
+				case "jpg":
+					if ($this->supportedImagesTypes['jpg'] == true) {
+						header("Content-Type: image/jpeg");
+						imagejpeg($this->imgRes);
+					}
+					break;
+
+				case "png":
+					if ($this->supportedImagesTypes['png'] == true) {
+						header("Content-Type: image/png");
+						imagepng($this->imgRes);
+					}
+					break;
+
+				case "gif":
+					if ($this->supportedImagesTypes['gif'] == true) {
+						header("Content-Type: image/gif");
+						imagegif($this->imgRes);
+					}
+					break;
+
+				default:
+					if ($this->supportedImagesTypes['png'] == true) {
+						header("Content-Type: image/png");
+						imagepng($this->imgRes);
+					}
+			}
+			imagedestroy($this->imgRes);
+		}
+	}
+
+	function createPixel() {
+		$date = date("D, d M Y H:i:s");
+		header("Cache-Control: no-cache");
+		header("Pragma: no-cache");
+		header("Content-Type: image/png");
+		header("Expires: Sat, 1 Jan 2000 00:00:00 GMT");
+		header("Last-Modified: $date GMT");
+		echo base64_decode("iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAABlBMVEX///8AAABVwtN+AAAAB3RJTUUH1gMKDhsHHWK8FQAAAApJREFUeJxjYAAAAAIAAUivpHEAAAAASUVORK5CYII=");
+	}
+
+	/**
+	 * private methods
+	 */
+
+	function getSupportedImagesTypes() {
+		if (count($this->supportedImagesTypes)>0) {
+			return $this->supportedImagesTypes;
+		}
+		$this->supportedImagesTypes['png'] = (imagetypes() & IMG_PNG) ? true : false;
+		$this->supportedImagesTypes['gif'] = (imagetypes() & IMG_GIF) ? true : false;
+		$this->supportedImagesTypes['jpg'] = (imagetypes() & IMG_JPG) ? true : false;
+		return $this->supportedImagesTypes;
+	}
+
+	function getRGBCode($htmlColorCode) {
+		$rgbArr = array();
+		if (strlen($htmlColorCode) == 6) {
+			$htmlCodeArr = array();
+			eregi("([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})", $htmlColorCode, $htmlCodeArr);
+			if (count($htmlCodeArr) == 4) {
+				for ($i=1; $i<=3; $i++) {
+					$k = $i-1;
+					$rgbArr[$k] = hexdec($htmlCodeArr[$i]);
+				}
+				return $rgbArr;
+			}
+		}
+		return $rgbArr;
+	}
+
+	function getPreparedText() {
+		$this->textArr = array();
+		if ($this->text != "") {
+			$this->charArr = array();
+			$charArr = preg_split('//', $this->text, -1, PREG_SPLIT_NO_EMPTY);
+			srand((double)microtime()*1000000);
+			$fontFileMaxIndex = count($this->fontFiles) - 1;
+			for ($i=0; $i<count($charArr); $i++) {
+				$randFontSize = rand($this->fontSizeRange[0], $this->fontSizeRange[1]);
+				$randAngle = rand($this->angleRange[0], $this->angleRange[1]);
+				$randFontFileIndex = rand(0,$fontFileMaxIndex);
+				$randFontFile = $this->fontFiles[$randFontFileIndex];
+				$this->textArr[] = imagettfbbox($randFontSize, $randAngle, $randFontFile, $charArr[$i]);
+				$this->charArr[] = array("fontsize" => $randFontSize, "angle" => $randAngle, "fontfile" => $randFontFile, "char" => $charArr[$i]);
+			}
+		}
+		return $this->textArr;
+	}
+
+	function getTextLength() {
+		$this->length = array();
+		$len = 0;
+		$this->length[] = $len;
+		for ($i=0; $i<count($this->textArr); $i++) {
+			$charX1 = abs($this->textArr[$i][4] - $this->textArr[$i][0]);
+			$charX2 = abs($this->textArr[$i][2] - $this->textArr[$i][6]);
+			$charWidth = ($charX2 > $charX1) ? $charX2 : $charX1;
+			$charWidth = (int) ($this->letterSpacingX * $charWidth);
+			$len += $charWidth;
+			$this->length[] = $len;
+		}
+		return $len;
+	}
+
+	function getTextHeight() {
+		$charHeight = 0;
+		for ($i=0; $i<count($this->textArr); $i++) {
+			$charY1 = abs($this->textArr[$i][5] - $this->textArr[$i][1]);
+			$charY2 = abs($this->textArr[$i][7] - $this->textArr[$i][3]);
+			if ($charY1 > $charHeight) {
+				$charHeight = $charY1;
+			}
+			if ($charY2 > $charHeight) {
+				$charHeight = $charY2;
+			}
+		}
+		return $charHeight;
+	}
+
+	function createImage() {
+		if (count($this->textArr) == 0) {
+			$this->getPreparedText();
+		}
+		$minLength = $this->paddingLeft + $this->getTextLength();
+		if ($this->width < $minLength) {
+			$this->width = $minLength;
+		}
+		$minHeight = $this->getTextHeight();
+		if ($this->height < $this->letterSpacingY * $minHeight) {
+			$this->height = $this->letterSpacingY * $minHeight;
+		}
+		srand((double)microtime()*1000000);
+		$backgroundColorIndex = count($this->backgroundColors) - 1;
+		$textColorIndex = count($this->textColors) - 1;
+		$randBgIndex = rand(0,$backgroundColorIndex);
+
+		$this->imgRes = imagecreate($this->width, $this->height);
+		imagecolorallocate(
+			$this->imgRes,
+			$this->backgroundColors[$randBgIndex][0],
+			$this->backgroundColors[$randBgIndex][1],
+			$this->backgroundColors[$randBgIndex][2]
+		);
+		if ($this->useGrid == true) {
+			$gridColor = imagecolorallocate($this->imgRes,$this->gridColor[0],$this->gridColor[1],$this->gridColor[2]);
+			$i=0;
+			while ($i<$this->height) {
+				imageline($this->imgRes, 0, $i, $this->width, $i, $gridColor);
+				$i += $this->gridSize;
+			}
+			$i=0;
+			while ($i<$this->width) {
+				imageline($this->imgRes, $i, 0, $i, $this->height, $gridColor);
+				$i += $this->gridSize;
+			}
+		}
+		for ($i=0; $i<count($this->charArr); $i++) {
+			$xPos = $this->paddingLeft + $this->length[$i];
+			$randColorIndex = rand(0,$textColorIndex);
+			imagettftext(
+				$this->imgRes,
+				$this->charArr[$i]['fontsize'],
+				$this->charArr[$i]['angle'],
+				$xPos,
+				$minHeight+rand($this->randYOrdinate[0],$this->randYOrdinate[1]),
+				imagecolorallocate(
+					$this->imgRes,
+					$this->textColors[$randColorIndex][0],
+					$this->textColors[$randColorIndex][1],
+					$this->textColors[$randColorIndex][2]
+				),
+				$this->charArr[$i]['fontfile'],
+				$this->charArr[$i]['char']
+			);
+		}
+	}
+
+}
+
+?>
\ No newline at end of file
diff -ruN guestbook.new/lib/comment.class.php guestbook.new.2.4.1/lib/comment.class.php
--- guestbook.new/lib/comment.class.php	2005-07-19 11:31:49.000000000 -0500
+++ guestbook.new.2.4.1/lib/comment.class.php	2006-04-03 08:44:15.000000000 -0500
@@ -1,191 +1,191 @@
-<?php
-/**
- * ----------------------------------------------
- * Advanced Guestbook 2.3.3 (PHP/MySQL)
- * Copyright (c) Chi Kien Uong
- * URL: http://www.proxy2.de
- * ----------------------------------------------
- */
-
-class gb_comment {
-
-    var $comment;
-    var $ip;
-    var $id;
-    var $db;
-    var $user;
-    var $pass_comment;
-    var $template;
-    var $path;
-
-    function gb_comment($path='') {
-        global $_SERVER;
-        if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && !empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
-            $this->ip = addslashes($_SERVER['HTTP_X_FORWARDED_FOR']);
-        } else {
-            $this->ip = addslashes(getenv("REMOTE_ADDR"));
-        }
-        $this->db = new guestbook_vars($path);
-        $this->db->getVars();
-        $this->path = $path;
-        $this->template = &$this->db->template;
-    }
-
-    function is_valid_id() {
-        $this->db->query("select id from ".$this->db->table['data']." WHERE (id = '".intval($this->id)."')");
-        $this->db->fetch_array($this->db->result);
-        return ($this->db->record) ? true : false;
-    }
-
-    function comment_form() {
-        global $GB_UPLOAD, $GB_PG;
-        $this->db->query( "select x.*, y.p_filename, y.width, y.height from ".$this->db->table['data']." x left join ".$this->db->table['pics']." y on (x.id=y.msg_id and y.book_id=2) WHERE (id = '".intval($this->id)."')");
-        $row = $this->db->fetch_array($this->db->result);
-        $LANG = &$this->db->LANG;
-        $VARS = &$this->db->VARS;
-        $DATE = $this->db->DateFormat($row['date']);
-        $MESSAGE = nl2br($row['comment']);
-        $id = $this->id;
-        $bgcolor = $this->db->VARS['tb_color_1'];
-        $COMMENT ='';
-        if ($row['p_filename'] && ereg("^img-",$row['p_filename'])) {
-            $img = new gb_image();
-            $img->set_border_size($this->db->VARS["img_width"], $this->db->VARS["img_height"]);
-            $new_img_size = $img->get_img_size_format($row['width'], $row['height']);
-            if (file_exists("$this->path/$GB_UPLOAD/t_$row[p_filename]")) {
-                $row['p_filename'] = "t_$row[p_filename]";
-            }
-            eval("\$USER_PIC = \"".$this->template->get_template($this->db->GB_TPL['image'])."\";");
-        } else {
-            $USER_PIC = '';
-        }
-        if ($this->db->VARS["smilies"] == 1) {
-            $MESSAGE = $this->db->emotion($MESSAGE);
-        }
-        if (!$row['location']) {
-            $row['location'] = "-";
-        }
-        if ($row['url']) {
-            eval("\$URL = \"".$this->template->get_template($this->db->GB_TPL['url'])."\";");
-        } else {
-            $URL = '';
-        }
-        if ($row['icq'] && $this->db->VARS["allow_icq"]==1) {
-            eval("\$ICQ = \"".$this->template->get_template($this->db->GB_TPL['icq'])."\";");
-        } else {
-            $ICQ = '';
-        }
-        if ($row['aim'] && $this->db->VARS["allow_aim"]==1) {
-            eval("\$AIM = \"".$this->template->get_template($this->db->GB_TPL['aim'])."\";");
-        } else {
-            $AIM = '';
-        }
-        if ($row['email']) {
-            $row['email'] = "javascript:getEmail('".$this->db->encryptEmail("mailto:".$row['email'])."')";
-            eval("\$EMAIL = \"".$this->template->get_template($this->db->GB_TPL['email'])."\";");
-        } else {
-            $EMAIL = '';
-        }
-        if ($this->db->VARS["allow_gender"]==1) {
-            $GENDER = ($row['gender']=="f") ? "&nbsp;<img src=\"$GB_PG[base_url]/img/female.gif\" width=\"12\" height=\"12\">" : "&nbsp;<img src=\"$GB_PG[base_url]/img/male.gif\" width=\"12\" height=\"12\">";
-        } else {
-            $GENDER = '';
-        }
-        if ($this->db->VARS["show_ip"] == 1) {
-            $hostname = ( eregi("^[-a-z_]+", $row['host']) ) ? "Host" : "IP";
-            $HOST = "$hostname: $row[host]\n";
-        } else {
-            $HOST='';
-        }
-        if ($this->db->VARS["need_pass"]==1) {
-            eval("\$COMMENT_PASS = \"".$this->template->get_template($this->db->GB_TPL['com_pass'])."\";");
-        } else {
-            $COMMENT_PASS = '';
-        }
-        $GB_COMMENT = "#";
-        $GB_ENTRY = "";
-        $comment_html = "";
-        eval("\$GB_ENTRY = \"".$this->template->get_template($this->db->GB_TPL['entry'])."\";");
-        eval("\$comment_html = \"".$this->template->get_template($this->db->GB_TPL['header'])."\";");
-        eval("\$comment_html .= \"".$this->template->get_template($this->db->GB_TPL['com_form'])."\";");
-        eval("\$comment_html .= \"".$this->template->get_template($this->db->GB_TPL['footer'])."\";");
-        return $comment_html;
-    }
-
-    function check_comment() {
-        $this->comment = $this->db->FormatString($this->comment);
-        if (empty($this->comment)) {
-            return $this->db->gb_error($this->db->LANG["ErrorPost11"]);
-        }
-        $this->user = $this->db->FormatString($this->user);
-        if (empty($this->user)) {
-            return $this->db->gb_error($this->db->LANG["ErrorPost1"]);
-        }
-        if (!$this->db->CheckWordLength($this->user)) {
-            return $this->db->gb_error($this->db->LANG["ErrorPost4"]);
-        }
-        if (!$this->db->CheckWordLength($this->comment)) {
-            return $this->db->gb_error($this->db->LANG["ErrorPost10"]);
-        }
-        if ($this->db->VARS["allow_html"]==0) {
-            $this->comment = htmlspecialchars($this->comment);
-        }
-        if ($this->db->VARS["agcode"]==1) {
-            $this->comment = $this->db->AGCode($this->comment);
-        }
-        if (!get_magic_quotes_gpc()) {
-            $this->user = addslashes($this->user);
-            $this->comment = addslashes($this->comment);
-        }
-        $this->user = htmlspecialchars($this->user);
-        if ($this->db->VARS["need_pass"]==1) {
-            if (get_magic_quotes_gpc()) {
-                $this->pass_comment = stripslashes($this->pass_comment);
-            }
-            if ($this->db->VARS["comment_pass"] != "$this->pass_comment") {
-                return $this->db->gb_error($this->db->LANG["PassMess3"]);
-            }
-        }
-        if ($this->db->VARS["censor"]==1) {
-            $this->user = $this->db->CensorBadWords($this->user);
-            $this->comment = $this->db->CensorBadWords($this->comment);
-        }
-        if ($this->db->VARS["flood_check"]==1) {
-            if ($this->db->FloodCheck($this->ip)) {
-               return $this->db->gb_error($this->db->LANG["ErrorPost8"]);
-            }
-        }
-        if ($this->db->VARS["banned_ip"]==1) {
-            if ($this->db->isBannedIp($this->ip)) {
-                return $this->db->gb_error($this->db->LANG["ErrorPost9"]);
-            }
-        }
-        return 1;
-    }
-
-    function insert_comment() {
-        $the_time = time();
-        $host = @gethostbyaddr($this->ip);
-        $this->db->query("INSERT INTO ".$this->db->table['com']." (id,name,comments,host,timestamp) VALUES ('$this->id','$this->user','$this->comment','$host','$the_time')");
-    }
-
-    function comment_action($action='') {
-        global $GB_PG;
-        if ($this->id && $this->is_valid_id() && $action==1) {
-            $status = $this->check_comment();
-            if ($status == 1) {
-                $this->insert_comment();
-                header("Location: $GB_PG[index]");
-            } else {
-                echo $status;
-            }
-        } elseif ($this->id && $this->is_valid_id()) {
-            echo $this->comment_form();
-        } else {
-            header("Location: $GB_PG[index]");
-        }
-    }
-
-}
-
+<?php
+/**
+ * ----------------------------------------------
+ * Advanced Guestbook 2.4.1 (PHP/MySQL)
+ * Copyright (c) Chi Kien Uong
+ * URL: http://www.proxy2.de
+ * ----------------------------------------------
+ */
+
+class gb_comment {
+
+    var $comment;
+    var $ip;
+    var $id;
+    var $db;
+    var $user;
+    var $pass_comment;
+    var $template;
+    var $path;
+
+    function gb_comment($path='') {
+        global $_SERVER;
+        if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && !empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
+            $this->ip = addslashes($_SERVER['HTTP_X_FORWARDED_FOR']);
+        } else {
+            $this->ip = addslashes(getenv("REMOTE_ADDR"));
+        }
+        $this->db = new guestbook_vars($path);
+        $this->db->getVars();
+        $this->path = $path;
+        $this->template = &$this->db->template;
+    }
+
+    function is_valid_id() {
+        $this->db->query("select id from ".$this->db->table['data']." WHERE (id = '".intval($this->id)."')");
+        $this->db->fetch_array($this->db->result);
+        return ($this->db->record) ? true : false;
+    }
+
+    function comment_form() {
+        global $GB_UPLOAD, $GB_PG;
+        $this->db->query( "select x.*, y.p_filename, y.width, y.height from ".$this->db->table['data']." x left join ".$this->db->table['pics']." y on (x.id=y.msg_id and y.book_id=2) WHERE (id = '".intval($this->id)."')");
+        $row = $this->db->fetch_array($this->db->result);
+        $LANG = &$this->db->LANG;
+        $VARS = &$this->db->VARS;
+        $DATE = $this->db->DateFormat($row['date']);
+        $MESSAGE = nl2br($row['comment']);
+        $id = $this->id;
+        $bgcolor = $this->db->VARS['tb_color_1'];
+        $COMMENT ='';
+        if ($row['p_filename'] && ereg("^img-",$row['p_filename'])) {
+            $img = new gb_image();
+            $img->set_border_size($this->db->VARS["img_width"], $this->db->VARS["img_height"]);
+            $new_img_size = $img->get_img_size_format($row['width'], $row['height']);
+            if (file_exists("$this->path/$GB_UPLOAD/t_$row[p_filename]")) {
+                $row['p_filename'] = "t_$row[p_filename]";
+            }
+            eval("\$USER_PIC = \"".$this->template->get_template($this->db->GB_TPL['image'])."\";");
+        } else {
+            $USER_PIC = '';
+        }
+        if ($this->db->VARS["smilies"] == 1) {
+            $MESSAGE = $this->db->emotion($MESSAGE);
+        }
+        if (!$row['location']) {
+            $row['location'] = "-";
+        }
+        if ($row['url']) {
+            eval("\$URL = \"".$this->template->get_template($this->db->GB_TPL['url'])."\";");
+        } else {
+            $URL = '';
+        }
+        if ($row['icq'] && $this->db->VARS["allow_icq"]==1) {
+            eval("\$ICQ = \"".$this->template->get_template($this->db->GB_TPL['icq'])."\";");
+        } else {
+            $ICQ = '';
+        }
+        if ($row['aim'] && $this->db->VARS["allow_aim"]==1) {
+            eval("\$AIM = \"".$this->template->get_template($this->db->GB_TPL['aim'])."\";");
+        } else {
+            $AIM = '';
+        }
+        if ($row['email']) {
+            $row['email'] = "javascript:getEmail('".$this->db->encryptEmail("mailto:".$row['email'])."')";
+            eval("\$EMAIL = \"".$this->template->get_template($this->db->GB_TPL['email'])."\";");
+        } else {
+            $EMAIL = '';
+        }
+        if ($this->db->VARS["allow_gender"]==1) {
+            $GENDER = ($row['gender']=="f") ? "&nbsp;<img src=\"$GB_PG[base_url]/img/female.gif\" width=\"12\" height=\"12\">" : "&nbsp;<img src=\"$GB_PG[base_url]/img/male.gif\" width=\"12\" height=\"12\">";
+        } else {
+            $GENDER = '';
+        }
+        if ($this->db->VARS["show_ip"] == 1) {
+            $hostname = ( eregi("^[-a-z_]+", $row['host']) ) ? "Host" : "IP";
+            $HOST = "$hostname: $row[host]\n";
+        } else {
+            $HOST='';
+        }
+        if ($this->db->VARS["need_pass"]==1) {
+            eval("\$COMMENT_PASS = \"".$this->template->get_template($this->db->GB_TPL['com_pass'])."\";");
+        } else {
+            $COMMENT_PASS = '';
+        }
+        $GB_COMMENT = "#";
+        $GB_ENTRY = "";
+        $comment_html = "";
+        eval("\$GB_ENTRY = \"".$this->template->get_template($this->db->GB_TPL['entry'])."\";");
+        eval("\$comment_html = \"".$this->template->get_template($this->db->GB_TPL['header'])."\";");
+        eval("\$comment_html .= \"".$this->template->get_template($this->db->GB_TPL['com_form'])."\";");
+        eval("\$comment_html .= \"".$this->template->get_template($this->db->GB_TPL['footer'])."\";");
+        return $comment_html;
+    }
+
+    function check_comment() {
+        $this->comment = $this->db->FormatString($this->comment);
+        if (empty($this->comment)) {
+            return $this->db->gb_error($this->db->LANG["ErrorPost11"]);
+        }
+        $this->user = $this->db->FormatString($this->user);
+        if (empty($this->user)) {
+            return $this->db->gb_error($this->db->LANG["ErrorPost1"]);
+        }
+        if (!$this->db->CheckWordLength($this->user)) {
+            return $this->db->gb_error($this->db->LANG["ErrorPost4"]);
+        }
+        if (!$this->db->CheckWordLength($this->comment)) {
+            return $this->db->gb_error($this->db->LANG["ErrorPost10"]);
+        }
+        if ($this->db->VARS["allow_html"]==0) {
+            $this->comment = htmlspecialchars($this->comment);
+        }
+        if ($this->db->VARS["agcode"]==1) {
+            $this->comment = $this->db->AGCode($this->comment);
+        }
+        if (!get_magic_quotes_gpc()) {
+            $this->user = addslashes($this->user);
+            $this->comment = addslashes($this->comment);
+        }
+        $this->user = htmlspecialchars($this->user);
+        if ($this->db->VARS["need_pass"]==1) {
+            if (get_magic_quotes_gpc()) {
+                $this->pass_comment = stripslashes($this->pass_comment);
+            }
+            if ($this->db->VARS["comment_pass"] != "$this->pass_comment") {
+                return $this->db->gb_error($this->db->LANG["PassMess3"]);
+            }
+        }
+        if ($this->db->VARS["censor"]==1) {
+            $this->user = $this->db->CensorBadWords($this->user);
+            $this->comment = $this->db->CensorBadWords($this->comment);
+        }
+        if ($this->db->VARS["flood_check"]==1) {
+            if ($this->db->FloodCheck($this->ip)) {
+               return $this->db->gb_error($this->db->LANG["ErrorPost8"]);
+            }
+        }
+        if ($this->db->VARS["banned_ip"]==1) {
+            if ($this->db->isBannedIp($this->ip)) {
+                return $this->db->gb_error($this->db->LANG["ErrorPost9"]);
+            }
+        }
+        return 1;
+    }
+
+    function insert_comment() {
+        $the_time = time();
+        $host = @gethostbyaddr($this->ip);
+        $this->db->query("INSERT INTO ".$this->db->table['com']." (id,name,comments,host,timestamp) VALUES ('$this->id','$this->user','$this->comment','$host','$the_time')");
+    }
+
+    function comment_action($action='') {
+        global $GB_PG;
+        if ($this->id && $this->is_valid_id() && $action==1) {
+            $status = $this->check_comment();
+            if ($status == 1) {
+                $this->insert_comment();
+                header("Location: $GB_PG[index]");
+            } else {
+                echo $status;
+            }
+        } elseif ($this->id && $this->is_valid_id()) {
+            echo $this->comment_form();
+        } else {
+            header("Location: $GB_PG[index]");
+        }
+    }
+
+}
+
 ?>
\ No newline at end of file
Binary files guestbook.new/lib/fonts/GenR102.ttf and guestbook.new.2.4.1/lib/fonts/GenR102.ttf differ
diff -ruN guestbook.new/lib/fonts/.htaccess guestbook.new.2.4.1/lib/fonts/.htaccess
--- guestbook.new/lib/fonts/.htaccess	1969-12-31 18:00:00.000000000 -0600
+++ guestbook.new.2.4.1/lib/fonts/.htaccess	2006-04-03 08:44:15.000000000 -0500
@@ -0,0 +1 @@
+deny from all
\ No newline at end of file
Binary files guestbook.new/lib/fonts/JAi_____.TTF and guestbook.new.2.4.1/lib/fonts/JAi_____.TTF differ
diff -ruN guestbook.new/lib/fonts/OFL.txt guestbook.new.2.4.1/lib/fonts/OFL.txt
--- guestbook.new/lib/fonts/OFL.txt	1969-12-31 18:00:00.000000000 -0600
+++ guestbook.new.2.4.1/lib/fonts/OFL.txt	2006-04-03 08:44:15.000000000 -0500
@@ -0,0 +1,99 @@
+This Font Software is Copyright (c) 2003-2005, SIL International (http://scripts.sil.org/).
+All Rights Reserved.
+
+"Gentium" is a Reserved Font Name for this Font Software.
+"SIL" is a Reserved Font Name for this Font Software.
+
+This Font Software is licensed under the SIL Open Font License, Version 1.0.
+No modification of the license is permitted, only verbatim copy is allowed.
+This license is copied below, and is also available with a FAQ at:
+http://scripts.sil.org/OFL
+
+
+-----------------------------------------------------------
+SIL OPEN FONT LICENSE Version 1.0 - 22 November 2005
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of cooperative font projects, to support the font creation
+efforts of academic and linguistic communities, and to provide an open
+framework in which fonts may be shared and improved in partnership with
+others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded, 
+redistributed and sold with any software provided that the font
+names of derivative works are changed. The fonts and derivatives,
+however, cannot be released under any other type of license.
+
+DEFINITIONS
+"Font Software" refers to any and all of the following:
+	- font files
+	- data files
+	- source code
+	- build scripts
+	- documentation
+
+"Reserved Font Name" refers to the Font Software name as seen by
+users and any other names as specified after the copyright statement.
+
+"Standard Version" refers to the collection of Font Software
+components as distributed by the Copyright Holder.
+
+"Modified Version" refers to any derivative font software made by
+adding to, deleting, or substituting -- in part or in whole --
+any of the components of the Standard Version, by changing formats
+or by porting the Font Software to a new environment.
+
+"Author" refers to any designer, engineer, programmer, technical
+writer or other person who contributed to the Font Software.
+
+PERMISSION & CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Font Software, to use, study, copy, merge, embed, modify,
+redistribute, and sell modified and unmodified copies of the Font
+Software, subject to the following conditions:
+
+1) Neither the Font Software nor any of its individual components,
+in Standard or Modified Versions, may be sold by itself.
+
+2) Standard or Modified Versions of the Font Software may be bundled,
+redistributed and sold with any software, provided that each copy
+contains the above copyright notice and this license. These can be
+included either as stand-alone text files, human-readable headers or
+in the appropriate machine-readable metadata fields within text or
+binary files as long as those fields can be easily viewed by the user.
+
+3) No Modified Version of the Font Software may use the Reserved Font
+Name(s), in part or in whole, unless explicit written permission is
+granted by the Copyright Holder. This restriction applies to all 
+references stored in the Font Software, such as the font menu name and
+other font description fields, which are used to differentiate the
+font from others.
+
+4) The name(s) of the Copyright Holder or the Author(s) of the Font
+Software shall not be used to promote, endorse or advertise any
+Modified Version, except to acknowledge the contribution(s) of the
+Copyright Holder and the Author(s) or with their explicit written
+permission.
+
+5) The Font Software, modified or unmodified, in part or in whole,
+must be distributed using this license, and may not be distributed
+under any other license.
+
+TERMINATION
+This license becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
Binary files guestbook.new/lib/fonts/transportm.ttf and guestbook.new.2.4.1/lib/fonts/transportm.ttf differ
diff -ruN guestbook.new/lib/gb.class.php guestbook.new.2.4.1/lib/gb.class.php
--- guestbook.new/lib/gb.class.php	2005-07-19 11:31:49.000000000 -0500
+++ guestbook.new.2.4.1/lib/gb.class.php	2006-04-03 08:44:15.000000000 -0500
@@ -1,173 +1,175 @@
-<?php
-/**
- * ----------------------------------------------
- * Advanced Guestbook 2.3.3 (PHP/MySQL)
- * Copyright (c) Chi Kien Uong
- * URL: http://www.proxy2.de
- * ----------------------------------------------
- */
-
-class guestbook {
-
-    var $total;
-    var $db;
-    var $template;
-    var $path;
-
-    function guestbook($path='') {
-        $this->db = new guestbook_vars($path);
-        $this->db->getVars();
-        $this->total = 0;
-        $this->path = $path;
-        $this->template = &$this->db->template;
-    }
-
-    function get_nav($entry=0) {
-        global $_SERVER, $GB_PG;
-        $entry = intval($entry);
-        $self = (IS_MODULE && eregi("\?",$GB_PG["index"])) ? "$GB_PG[index]&entry=" : basename($_SERVER['PHP_SELF'])."?entry=";
-        $next_page = $entry+$this->db->VARS['entries_per_page'];
-        $prev_page = $entry-$this->db->VARS['entries_per_page'];
-        $navigation = '';
-        if ($prev_page >= 0) {
-            $navigation = "   <img src=\"$GB_PG[base_url]/img/back.gif\" width=\"16\" height=\"14\"><a href=\"$self$prev_page\">".$this->db->LANG["NavPrev"]."</a>\n";
-        }
-        if ($next_page < $this->total) {
-            $navigation = $navigation."   &nbsp;&nbsp;<a href=\"$self$next_page\">".$this->db->LANG["NavNext"]."</a><img src=\"$GB_PG[base_url]/img/next.gif\" width=\"16\" height=\"14\">\n";
-        }
-        return $navigation;
-    }
-
-    function show_entries($entry=0) {
-        global $GB_PG;
-        $entry = intval($entry);
-        $LANG = &$this->db->LANG;
-        $VARS = &$this->db->VARS;
-        $this->db->fetch_array($this->db->query("select count(*) as total from ".$this->db->table['data']));
-        $this->total = $this->db->record["total"];
-        $TPL = $this->get_entries($entry,$this->db->VARS["entries_per_page"]);
-        $TPL['GB_TOTAL'] = $this->total;
-        $TPL['GB_JUMPMENU'] = implode("\n",$this->generate_JumpMenu());
-        $TPL['GB_TIME'] = $this->db->DateFormat(time());
-        $TPL['GB_NAVIGATION'] = $this->get_nav($entry);
-        $TPL['GB_HTML_CODE'] = ($this->db->VARS["allow_html"] == 1) ? $this->db->LANG["BookMess2"] : $this->db->LANG["BookMess1"];
-        $guestbook_html = "";
-        eval("\$guestbook_html = \"".$this->template->get_template($this->db->GB_TPL['header'])."\";");
-        eval("\$guestbook_html .= \"".$this->template->get_template($this->db->GB_TPL['body'])."\";");
-        eval("\$guestbook_html .= \"".$this->template->get_template($this->db->GB_TPL['footer'])."\";");
-        return $guestbook_html;
-    }
-
-    function generate_JumpMenu() {
-        $menu_array[] = "<select name=\"entry\" class=\"select\">";
-        $menu_array[] = "<option value=\"0\" selected>".$this->db->LANG["FormSelect"]."</option>";
-        if ($this->db->VARS["entries_per_page"] < $this->total) {
-            $remain = $this->total % $this->db->VARS["entries_per_page"];
-            $i = $this->total-$remain;
-            while ($i > 0) {
-                $num_max = $i;
-                $num_min = $num_max-$this->db->VARS["entries_per_page"];
-                $num_min++;
-                $menu_array[] = "<option value=\"$remain\">$num_min-$num_max</option>";
-                $i = $num_min-1;
-                $remain += $this->db->VARS["entries_per_page"];
-           }
-        }
-        $menu_array[] = "</select>";
-        $menu_array[] = "<input type=\"submit\" value=\"".$this->db->LANG["FormButton"]."\" class=\"input\">";
-        return $menu_array;
-    }
-
-    function get_entries($entry,$last_entry) {
-        global $GB_UPLOAD, $GB_PG;
-        $entry = intval($entry);
-        $last_entry = intval($last_entry);
-        $img = new gb_image();
-        $img->set_border_size($this->db->VARS["img_width"], $this->db->VARS["img_height"]);
-        $LANG = &$this->db->LANG;
-        $id = $this->total-$entry;
-        $HOST = '';
-        $COMMENT = '';
-        $GB_ENTRIES = '';
-        $i=0;
-        $template['entry'] = $this->template->get_template($this->db->GB_TPL['entry']);
-        $template['com'] = $this->template->get_template($this->db->GB_TPL['com']);
-        $template['url'] = $this->template->get_template($this->db->GB_TPL['url']);
-        $template['icq'] = $this->template->get_template($this->db->GB_TPL['icq']);
-        $template['aim'] = $this->template->get_template($this->db->GB_TPL['aim']);
-        $template['email'] = $this->template->get_template($this->db->GB_TPL['email']);
-        $template['image'] = $this->template->get_template($this->db->GB_TPL['image']);
-        $result = $this->db->query("select x.*, y.p_filename, y.width, y.height, z.comments from ".$this->db->table['data']." x left join ".$this->db->table['pics']." y on (x.id=y.msg_id and y.book_id=2) left join ".$this->db->table['com']." z on (x.id=z.id) group by x.id order by x.id desc limit $entry, $last_entry");
-        while ($row = $this->db->fetch_array($result)) {
-            $row['email2'] = "";
-            $DATE = $this->db->DateFormat($row['date']);
-            $MESSAGE = nl2br($row['comment']);
-            if ($row['p_filename'] && ereg("^img-",$row['p_filename'])) {
-                if (file_exists("$this->path/$GB_UPLOAD/t_$row[p_filename]")) {
-                    $row['p_filename'] = "t_$row[p_filename]";
-                }
-                $new_img_size = $img->get_img_size_format($row['width'], $row['height']);
-                eval("\$USER_PIC = \"".$template['image']."\";");
-            } else {
-                $USER_PIC = '';
-            }
-            if ($this->db->VARS["smilies"] == 1) {
-                $MESSAGE = $this->db->emotion($MESSAGE);
-            }
-            if (!$row['location']) {
-                $row['location'] = "-";
-            }
-            $bgcolor = ($i % 2) ? $this->db->VARS["tb_color_2"] : $this->db->VARS["tb_color_1"];
-            $i++;
-            if ($row['url']) {
-                eval("\$URL = \"".$template['url']."\";");
-            } else {
-                $URL = '';
-            }
-            if ($row['icq'] && $this->db->VARS["allow_icq"]==1) {
-                eval("\$ICQ = \"".$template['icq']."\";");
-            } else {
-                $ICQ = '';
-            }
-            if ($row['aim'] && $this->db->VARS["allow_aim"]==1) {
-                eval("\$AIM = \"".$template['aim']."\";");
-            } else {
-                $AIM = '';
-            }
-            if ($row['email']) {
-            	/* E-mail Hack */
-                $row['email2'] = str_replace("@", "(at)", $row['email']);
-                $row['email2'] = str_replace(".", "(dot)", $row['email2']); 
-                $row['email'] = "javascript:getEmail('".$this->db->encryptEmail("mailto:".$row['email'])."')";              
-                eval("\$EMAIL = \"".$template['email']."\";");
-            } else {
-                $EMAIL = '';
-            }
-            if ($this->db->VARS["allow_gender"]==1) {
-                $GENDER = ($row['gender']=="f") ? "&nbsp;<img src=\"$GB_PG[base_url]/img/female.gif\" width=\"12\" height=\"12\">" : "&nbsp;<img src=\"$GB_PG[base_url]/img/male.gif\" width=\"12\" height=\"12\">";
-            } else {
-                $GENDER = '';
-            }
-            if ($this->db->VARS["show_ip"] == 1) {
-                $hostname = ( eregi("^[-a-z_]+", $row['host']) ) ? "Host" : "IP";
-                $HOST = "$hostname: $row[host]\n";
-            }
-            if ($row['comments']) {
-                $this->db->query("select * from ".$this->db->table['com']." where id='$row[id]' order by com_id asc");
-                while ($com = $this->db->fetch_array($this->db->result)) {
-                    $com['comments'] = nl2br($com['comments']);
-                    eval("\$COMMENT .= \"".$template['com']."\";");
-                }
-            }
-            $GB_COMMENT = (IS_MODULE && eregi("\?",$GB_PG["comment"])) ? "$GB_PG[comment]&gb_id=$row[id]" : "$GB_PG[comment]?gb_id=$row[id]"; 
-            eval("\$GB_ENTRIES .= \"".$template['entry']."\";");
-            $COMMENT = "";
-            $id--;
-        }
-        $TPL['GB_ENTRIES'] = $GB_ENTRIES;
-        return $TPL;
-    }
-
-}
-
+<?php
+/**
+ * ----------------------------------------------
+ * Advanced Guestbook 2.4.1 (PHP/MySQL)
+ * Copyright (c) Chi Kien Uong
+ * URL: http://www.proxy2.de
+ * ----------------------------------------------
+ */
+
+class guestbook {
+
+    var $total;
+    var $db;
+    var $template;
+    var $path;
+
+    function guestbook($path='') {
+        $this->db = new guestbook_vars($path);
+        $this->db->getVars();
+        $this->total = 0;
+        $this->path = $path;
+        $this->template = &$this->db->template;
+    }
+
+    function get_nav($entry=0) {
+        global $_SERVER, $GB_PG;
+        $entry = intval($entry);
+        $self = (IS_MODULE && eregi("\?",$GB_PG["index"])) ? "$GB_PG[index]&entry=" : basename($_SERVER['PHP_SELF'])."?entry=";
+        $next_page = $entry+$this->db->VARS['entries_per_page'];
+        $prev_page = $entry-$this->db->VARS['entries_per_page'];
+        $navigation = '';
+        if ($prev_page >= 0) {
+            $navigation = "   <img src=\"$GB_PG[base_url]/img/back.gif\" width=\"16\" height=\"14\"><a href=\"$self$prev_page\">".$this->db->LANG["NavPrev"]."</a>\n";
+        }
+        if ($next_page < $this->total) {
+            $navigation = $navigation."   &nbsp;&nbsp;<a href=\"$self$next_page\">".$this->db->LANG["NavNext"]."</a><img src=\"$GB_PG[base_url]/img/next.gif\" width=\"16\" height=\"14\">\n";
+        }
+        return $navigation;
+    }
+
+    function show_entries($entry=0) {
+        global $GB_PG;
+        $entry = intval($entry);
+        $LANG = &$this->db->LANG;
+        $VARS = &$this->db->VARS;
+        $this->db->fetch_array($this->db->query("select count(*) as total from ".$this->db->table['data']));
+        $this->total = $this->db->record["total"];
+        $TPL = $this->get_entries($entry,$this->db->VARS["entries_per_page"]);
+        $TPL['GB_TOTAL'] = $this->total;
+        $TPL['GB_JUMPMENU'] = implode("\n",$this->generate_JumpMenu());
+        $TPL['GB_TIME'] = $this->db->DateFormat(time());
+        $TPL['GB_NAVIGATION'] = $this->get_nav($entry);
+        $TPL['GB_HTML_CODE'] = ($this->db->VARS["allow_html"] == 1) ? $this->db->LANG["BookMess2"] : $this->db->LANG["BookMess1"];
+        $guestbook_html = "";
+        eval("\$guestbook_html = \"".$this->template->get_template($this->db->GB_TPL['header'])."\";");
+        eval("\$guestbook_html .= \"".$this->template->get_template($this->db->GB_TPL['body'])."\";");
+        eval("\$guestbook_html .= \"".$this->template->get_template($this->db->GB_TPL['footer'])."\";");
+        return $guestbook_html;
+    }
+
+    function generate_JumpMenu() {
+        $menu_array[] = "<select name=\"entry\" class=\"select\">";
+        $menu_array[] = "<option value=\"0\" selected>".$this->db->LANG["FormSelect"]."</option>";
+        if ($this->db->VARS["entries_per_page"] < $this->total) {
+            $remain = $this->total % $this->db->VARS["entries_per_page"];
+            $i = $this->total-$remain;
+            while ($i > 0) {
+                $num_max = $i;
+                $num_min = $num_max-$this->db->VARS["entries_per_page"];
+                $num_min++;
+                $menu_array[] = "<option value=\"$remain\">$num_min-$num_max</option>";
+                $i = $num_min-1;
+                $remain += $this->db->VARS["entries_per_page"];
+           }
+        }
+        $menu_array[] = "</select>";
+        $menu_array[] = "<input type=\"submit\" value=\"".$this->db->LANG["FormButton"]."\" class=\"input\">";
+        return $menu_array;
+    }
+
+    function get_entries($entry,$last_entry) {
+        global $GB_UPLOAD, $GB_PG;
+        $entry = intval($entry);
+        $last_entry = intval($last_entry);
+        $img = new gb_image();
+        $img->set_border_size($this->db->VARS["img_width"], $this->db->VARS["img_height"]);
+        $LANG = &$this->db->LANG;
+        $id = $this->total-$entry;
+        $HOST = '';
+        $COMMENT = '';
+        $GB_ENTRIES = '';
+        $i=0;
+        $template['entry'] = $this->template->get_template($this->db->GB_TPL['entry']);
+        $template['com'] = $this->template->get_template($this->db->GB_TPL['com']);
+        $template['url'] = $this->template->get_template($this->db->GB_TPL['url']);
+        $template['icq'] = $this->template->get_template($this->db->GB_TPL['icq']);
+        $template['aim'] = $this->template->get_template($this->db->GB_TPL['aim']);
+        $template['email'] = $this->template->get_template($this->db->GB_TPL['email']);
+        $template['image'] = $this->template->get_template($this->db->GB_TPL['image']);     
+        $result = $this->db->query(
+        	"select x.*, y.p_filename, y.width, y.height from 
+        	".$this->db->table['data']." x left join ".$this->db->table['pics']." y on (x.id=y.msg_id and y.book_id=2)  
+        	order by x.id desc limit $entry, $last_entry"
+        );
+        while ($row = $this->db->fetch_array($result)) {
+            $row['email2'] = "";
+            $DATE = $this->db->DateFormat($row['date']);
+            $MESSAGE = nl2br($row['comment']);
+            if ($row['p_filename'] && ereg("^img-",$row['p_filename'])) {
+                if (file_exists("$this->path/$GB_UPLOAD/t_$row[p_filename]")) {
+                    $row['p_filename'] = "t_$row[p_filename]";
+                }
+                $new_img_size = $img->get_img_size_format($row['width'], $row['height']);
+                eval("\$USER_PIC = \"".$template['image']."\";");
+            } else {
+                $USER_PIC = '';
+            }
+            if ($this->db->VARS["smilies"] == 1) {
+                $MESSAGE = $this->db->emotion($MESSAGE);
+            }
+            if (!$row['location']) {
+                $row['location'] = "-";
+            }
+            $bgcolor = ($i % 2) ? $this->db->VARS["tb_color_2"] : $this->db->VARS["tb_color_1"];
+            $i++;
+            if ($row['url']) {
+                eval("\$URL = \"".$template['url']."\";");
+            } else {
+                $URL = '';
+            }
+            if ($row['icq'] && $this->db->VARS["allow_icq"]==1) {
+                eval("\$ICQ = \"".$template['icq']."\";");
+            } else {
+                $ICQ = '';
+            }
+            if ($row['aim'] && $this->db->VARS["allow_aim"]==1) {
+                eval("\$AIM = \"".$template['aim']."\";");
+            } else {
+                $AIM = '';
+            }
+            if ($row['email']) {
+            	/* E-mail Hack */
+                $row['email2'] = str_replace("@", "(at)", $row['email']);
+                $row['email2'] = str_replace(".", "(dot)", $row['email2']); 
+                $row['email'] = "javascript:getEmail('".$this->db->encryptEmail("mailto:".$row['email'])."')";              
+                eval("\$EMAIL = \"".$template['email']."\";");
+            } else {
+                $EMAIL = '';
+            }
+            if ($this->db->VARS["allow_gender"]==1) {
+                $GENDER = ($row['gender']=="f") ? "&nbsp;<img src=\"$GB_PG[base_url]/img/female.gif\" width=\"12\" height=\"12\">" : "&nbsp;<img src=\"$GB_PG[base_url]/img/male.gif\" width=\"12\" height=\"12\">";
+            } else {
+                $GENDER = '';
+            }
+            if ($this->db->VARS["show_ip"] == 1) {
+                $hostname = ( eregi("^[-a-z_]+", $row['host']) ) ? "Host" : "IP";
+                $HOST = "$hostname: $row[host]\n";
+            }
+            $this->db->query("select * from ".$this->db->table['com']." where id='$row[id]' order by com_id asc");
+			while ($com = $this->db->fetch_array($this->db->result)) {
+				$com['comments'] = nl2br($com['comments']);
+				eval("\$COMMENT .= \"".$template['com']."\";");
+            }          
+            $GB_COMMENT = (IS_MODULE && eregi("\?",$GB_PG["comment"])) ? "$GB_PG[comment]&gb_id=$row[id]" : "$GB_PG[comment]?gb_id=$row[id]"; 
+            eval("\$GB_ENTRIES .= \"".$template['entry']."\";");
+            $COMMENT = "";
+            $id--;
+        }
+        $TPL['GB_ENTRIES'] = $GB_ENTRIES;
+        return $TPL;
+    }
+
+}
+
 ?>
\ No newline at end of file
diff -ruN guestbook.new/lib/image.class.php guestbook.new.2.4.1/lib/image.class.php
--- guestbook.new/lib/image.class.php	2005-07-19 11:31:49.000000000 -0500
+++ guestbook.new.2.4.1/lib/image.class.php	2006-04-03 08:44:15.000000000 -0500
@@ -1,183 +1,198 @@
-<?php
-/**
- * ----------------------------------------------
- * Advanced Guestbook 2.3.3 (PHP/MySQL)
- * Copyright (c) Chi Kien Uong
- * URL: http://www.proxy2.de
- * ----------------------------------------------
- */
-
-class gb_image {
-
-    var $imagick = '';  /*
-                         * Windows: c:/imagemagick/convert.exe
-                         */
-    var $max_width;
-    var $max_height;
-    var $min_filesize = 10240;
-    var $destdir = '.';
-    var $prefix = '';
-    var $supported_types = '';
-
-    function gb_image() {
-        $this->max_width = 300;
-        $this->max_height = 85;
-        $this->get_supported_types();
-    }
-
-    function set_border_size($max_width,$max_height) {
-        if ($max_width>0 && $max_height>0) {
-            $this->max_width = $max_width;
-            $this->max_height = $max_height;
-            return true;
-        } else {
-            return false;
-        }
-    }
-
-    function set_prefix($strg) {
-        $bad_chars = array("\\","/","*","?","\"","<",">","|");
-        for ($i=0; $i<sizeof($bad_chars); $i++) {
-            if (strstr($strg, $bad_chars[$i])) {
-                return false;
-            }
-        }
-        $this->prefix = $strg;
-        return true;
-    }
-
-    function set_destdir($img_dir) {
-        if (!is_dir("$img_dir")) {
-            return false;
-        }
-        $this->destdir = $img_dir;
-        return true;
-    }
-
-    function get_supported_types() {
-        if (extension_loaded("gd")) {
-            if (function_exists("imagegif")) {
-                $this->supported_types['1'] = "GIF";
-            }
-            if (function_exists("imagejpeg")) {
-                $this->supported_types['2'] = "JPEG";
-            }
-            if (function_exists("imagepng")) {
-                $this->supported_types['3'] = "PNG";
-            }
-            return (is_array($this->supported_types) && count($this->supported_types)>0) ? $this->supported_types : false;
-        } else {
-            return false;
-        }
-    }
-
-    function is_imagick() {
-        $is_safe_mode = get_cfg_var("safe_mode");
-        if ($is_safe_mode) {
-            return false;
-        }
-        if (eregi("convert",$this->imagick)) {
-            return true;
-        } elseif ($this->imagick != "none") {
-            if (!eregi("WIN",PHP_OS)) {
-                $retval = exec("whereis convert");
-                if (!empty($retval)) {
-                    $this->imagick = "convert";
-                    return true;
-                }
-            }
-            $this->imagick = "none";
-            return false;
-        } else {
-            return false;
-        }
-    }
-
-    function create_thumbnail($source,$destination='') {
-        $img_filesize = (file_exists("$source")) ? filesize("$source") : false;
-        $destination = trim($destination);
-        if (strstr($destination, "/") || strstr($destination, "\\")) {
-            $new_file = $destination;
-        } elseif ($destination=='') {
-            $new_file = $this->destdir."/".$this->prefix.basename($source);
-        } else {
-            $new_file = $this->destdir."/".$this->prefix.$destination;
-        }
-        if (!$img_filesize || $img_filesize <= $this->min_filesize) {
-            return false;
-        }
-        $size = GetImageSize("$source");
-        $new_size = $this->get_img_size_format($size[0],$size[1]);
-        if ($this->is_imagick()) {
-            if (is_array($size) && count($size)>0) {
-                exec($this->imagick." -quality 90 -antialias -scale $new_size[0]x$new_size[1] $source $new_file");
-            }
-        } else {
-            $type = "$size[2]";
-            if (isset($this->supported_types["$type"])) {
-                switch ($type) {
-                    case "1" :
-                        $im = ImageCreateFromGIF("$source");
-                        $new_im = ImageCreate($new_size[0],$new_size[1]);
-                        ImageCopyResized($new_im,$im,0,0,0,0,$new_size[0],$new_size[1],$size[0],$size[1]);
-                        ImageGIF($new_im,$new_file);
-                        break;
-                    case "2" :
-                        $im = ImageCreateFromJPEG("$source");
-                        $new_im = ImageCreate($new_size[0],$new_size[1]);
-                        ImageCopyResized($new_im,$im,0,0,0,0,$new_size[0],$new_size[1],$size[0],$size[1]);
-                        ImageJPEG($new_im,$new_file,90);
-                        break;
-                    case "3" :
-                        $im = ImageCreateFromPNG("$source");
-                        $new_im = ImageCreate($new_size[0],$new_size[1]);
-                        ImageCopyResized($new_im,$im,0,0,0,0,$new_size[0],$new_size[1],$size[0],$size[1]);
-                        ImagePNG($new_im,$new_file);
-                        break;
-                }
-            }
-        }
-        return (file_exists("$new_file")) ? true : false;
-    }
-
-    function set_min_filesize($file_size) {
-        if ($file_size>4096) {
-            $this->min_filesize = $file_size;
-            return true;
-        } else {
-            return false;
-        }
-    }
-
-    function get_img_size_format($img_width,$img_height) {
-        if ($img_width>$this->max_width) {
-            $tag_height = ($this->max_width/$img_width)*$img_height;
-            $tag_width = $this->max_width;
-            if ($tag_height>$this->max_height) {
-                $tag_width = ($this->max_height/$tag_height)*$tag_width;
-                $tag_height = $this->max_height;
-            }
-        } elseif ($img_height>$this->max_height) {
-            $tag_width = ($this->max_height/$img_height)*$img_width;
-            $tag_height = $this->max_height;
-            if ($tag_width>$this->max_width) {
-                $tag_height = ($this->max_width/$tag_width)*$tag_height;
-                $tag_width = $this->max_width;
-            }
-        } else {
-            $tag_width = $img_width;
-            $tag_height = $img_height;
-        }
-        $tag_width = round($tag_width);
-        $tag_height = round($tag_height);
-        return array(
-            "$tag_width",
-            "$tag_height",
-            "width=\"$tag_width\" height=\"$tag_height\""
-        );
-    }
-
-
-}
-
+<?php
+/**
+ * ----------------------------------------------
+ * Advanced Guestbook 2.4.1 (PHP/MySQL)
+ * Copyright (c) Chi Kien Uong
+ * URL: http://www.proxy2.de
+ * ----------------------------------------------
+ */
+
+class gb_image {
+
+    var $imagick = '';  /*
+                         * Windows: c:/imagemagick/convert.exe
+                         */
+    var $max_width;
+    var $max_height;
+    var $min_filesize = 10240;
+    var $destdir = '.';
+    var $prefix = '';
+    var $supported_types = '';
+
+    function gb_image() {
+        $this->max_width = 300;
+        $this->max_height = 85;
+        $this->get_supported_types();
+    }
+
+    function set_border_size($max_width,$max_height) {
+        if ($max_width>0 && $max_height>0) {
+            $this->max_width = $max_width;
+            $this->max_height = $max_height;
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    function set_prefix($strg) {
+        $bad_chars = array("\\","/","*","?","\"","<",">","|");
+        for ($i=0; $i<sizeof($bad_chars); $i++) {
+            if (strstr($strg, $bad_chars[$i])) {
+                return false;
+            }
+        }
+        $this->prefix = $strg;
+        return true;
+    }
+
+    function set_destdir($img_dir) {
+        if (!is_dir("$img_dir")) {
+            return false;
+        }
+        $this->destdir = $img_dir;
+        return true;
+    }
+
+    function get_supported_types() {
+        if (extension_loaded("gd")) {
+            if (function_exists("imagegif")) {
+                $this->supported_types['1'] = "GIF";
+            }
+            if (function_exists("imagejpeg")) {
+                $this->supported_types['2'] = "JPEG";
+            }
+            if (function_exists("imagepng")) {
+                $this->supported_types['3'] = "PNG";
+            }
+            return (is_array($this->supported_types) && count($this->supported_types)>0) ? $this->supported_types : false;
+        } else {
+            return false;
+        }
+    }
+
+    function is_imagick() {
+        $is_safe_mode = get_cfg_var("safe_mode");
+        if ($is_safe_mode) {
+            return false;
+        }
+        if (eregi("convert",$this->imagick)) {
+            return true;
+        } elseif ($this->imagick != "none") {
+            if (!eregi("WIN",PHP_OS)) {
+                $retval = exec("whereis convert");
+                if (!empty($retval)) {
+                    $this->imagick = "convert";
+                    return true;
+                }
+            }
+            $this->imagick = "none";
+            return false;
+        } else {
+            return false;
+        }
+    }
+
+    function create_thumbnail($source,$destination='') {
+        $img_filesize = (file_exists("$source")) ? filesize("$source") : false;
+        $destination = trim($destination);
+        if (strstr($destination, "/") || strstr($destination, "\\")) {
+            $new_file = $destination;
+        } elseif ($destination=='') {
+            $new_file = $this->destdir."/".$this->prefix.basename($source);
+        } else {
+            $new_file = $this->destdir."/".$this->prefix.$destination;
+        }
+        if (!$img_filesize || $img_filesize <= $this->min_filesize) {
+            return false;
+        }
+        $size = GetImageSize("$source");
+        $new_size = $this->get_img_size_format($size[0],$size[1]);
+        if ($this->is_imagick()) {
+            if (is_array($size) && count($size)>0) {
+                exec($this->imagick." -quality 90 -antialias -scale $new_size[0]x$new_size[1] $source $new_file");
+            }
+        } else {
+            $type = "$size[2]";
+            if (isset($this->supported_types["$type"])) {
+                switch ($type) {
+                    case "1" :
+                        $im = ImageCreateFromGIF("$source");
+                        if (function_exists("imagecreatetruecolor")) {
+                        	$new_im = imagecreatetruecolor($new_size[0],$new_size[1]);
+                        	imagecopyresampled($new_im,$im,0,0,0,0,$new_size[0],$new_size[1],$size[0],$size[1]);
+                        } else {
+                        	$new_im = ImageCreate($new_size[0],$new_size[1]);
+                        	ImageCopyResized($new_im,$im,0,0,0,0,$new_size[0],$new_size[1],$size[0],$size[1]);
+                    	}
+                        ImageGIF($new_im,$new_file);
+                        break;
+                    case "2" :
+                        $im = ImageCreateFromJPEG("$source");
+                        if (function_exists("imagecreatetruecolor")) {
+                        	$new_im = imagecreatetruecolor($new_size[0],$new_size[1]);
+                        	imagecopyresampled($new_im,$im,0,0,0,0,$new_size[0],$new_size[1],$size[0],$size[1]);
+                        } else {
+                        	$new_im = ImageCreate($new_size[0],$new_size[1]);
+                        	ImageCopyResized($new_im,$im,0,0,0,0,$new_size[0],$new_size[1],$size[0],$size[1]);
+                    	}
+                        ImageJPEG($new_im,$new_file,90);
+                        break;
+                    case "3" :
+                        $im = ImageCreateFromPNG("$source");
+                        if (function_exists("imagecreatetruecolor")) {
+                        	$new_im = imagecreatetruecolor($new_size[0],$new_size[1]);
+                        	imagecopyresampled($new_im,$im,0,0,0,0,$new_size[0],$new_size[1],$size[0],$size[1]);
+                        } else {
+                        	$new_im = ImageCreate($new_size[0],$new_size[1]);
+                        	ImageCopyResized($new_im,$im,0,0,0,0,$new_size[0],$new_size[1],$size[0],$size[1]);
+                    	}
+                        ImagePNG($new_im,$new_file);
+                        break;
+                }
+            }
+        }
+        return (file_exists("$new_file")) ? true : false;
+    }
+
+    function set_min_filesize($file_size) {
+        if ($file_size>4096) {
+            $this->min_filesize = $file_size;
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    function get_img_size_format($img_width,$img_height) {
+        if ($img_width>$this->max_width) {
+            $tag_height = ($this->max_width/$img_width)*$img_height;
+            $tag_width = $this->max_width;
+            if ($tag_height>$this->max_height) {
+                $tag_width = ($this->max_height/$tag_height)*$tag_width;
+                $tag_height = $this->max_height;
+            }
+        } elseif ($img_height>$this->max_height) {
+            $tag_width = ($this->max_height/$img_height)*$img_width;
+            $tag_height = $this->max_height;
+            if ($tag_width>$this->max_width) {
+                $tag_height = ($this->max_width/$tag_width)*$tag_height;
+                $tag_width = $this->max_width;
+            }
+        } else {
+            $tag_width = $img_width;
+            $tag_height = $img_height;
+        }
+        $tag_width = round($tag_width);
+        $tag_height = round($tag_height);
+        return array(
+            "$tag_width",
+            "$tag_height",
+            "width=\"$tag_width\" height=\"$tag_height\""
+        );
+    }
+
+
+}
+
 ?>
\ No newline at end of file
diff -ruN guestbook.new/lib/mysql.class.php guestbook.new.2.4.1/lib/mysql.class.php
--- guestbook.new/lib/mysql.class.php	2005-07-19 11:31:49.000000000 -0500
+++ guestbook.new.2.4.1/lib/mysql.class.php	2006-04-03 08:44:15.000000000 -0500
@@ -1,102 +1,102 @@
-<?php
-/**
- * ----------------------------------------------
- * Advanced Guestbook 2.3.3 (PHP/MySQL)
- * Copyright (c) Chi Kien Uong
- * URL: http://www.proxy2.de
- * ----------------------------------------------
- */
-
-class gbook_sql {
-
-    var $conn_id;
-    var $result;
-    var $record;
-    var $db = array();
-    var $port;
-
-    function gbook_sql() {
-        global $GB_DB;
-        $this->db = &$GB_DB;
-        if(ereg(":",$this->db['host'])) {
-            list($host,$port) = explode(":",$this->db['host']);
-            $this->port = $port;
-        } else {
-            $this->port = 3306;
-        }
-    }
-
-    function connect() {
-        $this->conn_id = mysql_connect($this->db['host'].":".$this->port,$this->db['user'],$this->db['pass']);
-        if ($this->conn_id == 0) {
-            $this->sql_error("Connection Error");
-        }
-        if (!mysql_select_db($this->db['dbName'], $this->conn_id)) {
-            $this->sql_error("Database Error");
-        }
-        return $this->conn_id;
-    }
-
-    function query($query_string) {
-        $this->result = mysql_query($query_string,$this->conn_id);
-        if (!$this->result) {
-            $this->sql_error("Query Error");
-        }
-        return $this->result;
-    }
-
-    function fetch_array($query_id) {
-        $this->record = mysql_fetch_array($query_id,MYSQL_ASSOC);
-        return $this->record;
-    }
-
-    function num_rows($query_id) {
-        return ($query_id) ? mysql_num_rows($query_id) : 0;
-    }
-
-    function num_fields($query_id) {
-        return ($query_id) ? mysql_num_fields($query_id) : 0;
-    }
-
-    function free_result($query_id) {
-        return mysql_free_result($query_id);
-    }
-
-    function affected_rows() {
-        return mysql_affected_rows($this->conn_id);
-    }
-
-    function close_db() {
-        if($this->conn_id) {
-            return mysql_close($this->conn_id);
-        } else {
-            return false;
-        }
-    }
-
-    function sql_error($message) {
-        global $TEC_MAIL;
-        $description = mysql_error();
-        $number = mysql_errno();
-        $error ="MySQL Error : $message\n";
-        $error.="Error Number: $number $description\n";
-        $error.="Date        : ".date("D, F j, Y H:i:s")."\n";
-        $error.="IP          : ".getenv("REMOTE_ADDR")."\n";
-        $error.="Browser     : ".getenv("HTTP_USER_AGENT")."\n";
-        $error.="Referer     : ".getenv("HTTP_REFERER")."\n";
-        $error.="PHP Version : ".PHP_VERSION."\n";
-        $error.="OS          : ".PHP_OS."\n";
-        $error.="Server      : ".getenv("SERVER_SOFTWARE")."\n";
-        $error.="Server Name : ".getenv("SERVER_NAME")."\n";
-        echo "<b><font size=4 face=Arial>$message</font></b><hr>";
-        echo "<pre>$error</pre>";
-        if (eregi("^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@([0-9a-z][0-9a-z-]*[0-9a-z]\\.)+[a-z]{2,5}$", $TEC_MAIL) ) {
-            $headers = "From: ".$this->db['user']."@".$this->db['host']."\nX-Mailer: Advanced Guestbook 2";
-            // @mail("$TEC_MAIL","Guestbook - Error","$error","$headers");
-        }
-        exit();
-    }
-
-}
-
+<?php
+/**
+ * ----------------------------------------------
+ * Advanced Guestbook 2.4.1 (PHP/MySQL)
+ * Copyright (c) Chi Kien Uong
+ * URL: http://www.proxy2.de
+ * ----------------------------------------------
+ */
+
+class gbook_sql {
+
+    var $conn_id;
+    var $result;
+    var $record;
+    var $db = array();
+    var $port;
+
+    function gbook_sql() {
+        global $GB_DB;
+        $this->db = &$GB_DB;
+        if(ereg(":",$this->db['host'])) {
+            list($host,$port) = explode(":",$this->db['host']);
+            $this->port = $port;
+        } else {
+            $this->port = 3306;
+        }
+    }
+
+    function connect() {
+        $this->conn_id = mysql_connect($this->db['host'].":".$this->port,$this->db['user'],$this->db['pass']);
+        if ($this->conn_id == 0) {
+            $this->sql_error("Connection Error");
+        }
+        if (!mysql_select_db($this->db['dbName'], $this->conn_id)) {
+            $this->sql_error("Database Error");
+        }
+        return $this->conn_id;
+    }
+
+    function query($query_string) {
+        $this->result = mysql_query($query_string,$this->conn_id);
+        if (!$this->result) {
+            $this->sql_error("Query Error");
+        }
+        return $this->result;
+    }
+
+    function fetch_array($query_id) {
+        $this->record = mysql_fetch_array($query_id,MYSQL_ASSOC);
+        return $this->record;
+    }
+
+    function num_rows($query_id) {
+        return ($query_id) ? mysql_num_rows($query_id) : 0;
+    }
+
+    function num_fields($query_id) {
+        return ($query_id) ? mysql_num_fields($query_id) : 0;
+    }
+
+    function free_result($query_id) {
+        return mysql_free_result($query_id);
+    }
+
+    function affected_rows() {
+        return mysql_affected_rows($this->conn_id);
+    }
+
+    function close_db() {
+        if($this->conn_id) {
+            return mysql_close($this->conn_id);
+        } else {
+            return false;
+        }
+    }
+
+    function sql_error($message) {
+        global $TEC_MAIL;
+        $description = mysql_error();
+        $number = mysql_errno();
+        $error ="MySQL Error : $message\n";
+        $error.="Error Number: $number $description\n";
+        $error.="Date        : ".date("D, F j, Y H:i:s")."\n";
+        $error.="IP          : ".getenv("REMOTE_ADDR")."\n";
+        $error.="Browser     : ".getenv("HTTP_USER_AGENT")."\n";
+        $error.="Referer     : ".getenv("HTTP_REFERER")."\n";
+        $error.="PHP Version : ".PHP_VERSION."\n";
+        $error.="OS          : ".PHP_OS."\n";
+        $error.="Server      : ".getenv("SERVER_SOFTWARE")."\n";
+        $error.="Server Name : ".getenv("SERVER_NAME")."\n";
+        echo "<b><font size=4 face=Arial>$message</font></b><hr>";
+        echo "<pre>$error</pre>";
+        if (eregi("^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@([0-9a-z][0-9a-z-]*[0-9a-z]\\.)+[a-z]{2,5}$", $TEC_MAIL) ) {
+            $headers = "From: $TEC_MAIL\r\nX-Mailer: Advanced Guestbook 2";
+            // @mail("$TEC_MAIL","Guestbook - Error","$error","$headers");
+        }
+        exit();
+    }
+
+}
+
 ?>
\ No newline at end of file
diff -ruN guestbook.new/lib/phrase.class.php guestbook.new.2.4.1/lib/phrase.class.php
--- guestbook.new/lib/phrase.class.php	1969-12-31 18:00:00.000000000 -0600
+++ guestbook.new.2.4.1/lib/phrase.class.php	2006-04-03 08:44:15.000000000 -0500
@@ -0,0 +1,82 @@
+<?php
+/**
+ * ----------------------------------------------
+ * Advanced Guestbook 2.4.1 (PHP/MySQL)
+ * Copyright (c) Chi Kien Uong
+ * URL: http://www.proxy2.de
+ * ----------------------------------------------
+ */
+ 
+class Phrase {
+
+	var $allowedChars;
+	var $minLength;
+	var $maxLength;
+
+	function Phrase() {
+		$this->allowedChars = array(
+			"A","B","C","D","E","F","G","H","I","J","K","L","M",
+			"N","O","P","Q","R","S","T","U","V","W","X","Y","Z"
+		);
+		$this->minLength = 5;
+		$this->maxLength = 5;
+	}
+
+	function setStringLengthRange($minLength, $maxLength) {
+		$minLength = (int) ($minLength);
+		$maxLength = (int) ($maxLength);
+		if ($maxLength >= $minLength) {
+			$this->setMinStringLength($minLength);
+			$this->setMaxStringLength($maxLength);
+			return true;
+		}
+		return false;
+	}
+
+	function setStringLength($len) {
+		$len = (int) ($len);
+		if ($len > 0) {
+			$this->setStringLengthRange($len, $len);
+			return true;
+		}
+		return false;
+	}
+
+	function setMinStringLength($len) {
+		$len = (int) ($len);
+		if ($len > 0) {
+			$this->minLength = $len;
+			return true;
+		}
+		return false;
+	}
+
+	function setMaxStringLength($len) {
+		$len = (int) ($len);
+		if ($len > 0) {
+			$this->maxLength = $len;
+			return true;
+		}
+		return false;
+	}
+
+	function getPhrase() {
+		$phrase = "";
+		$maxCharIndex = count($this->allowedChars) - 1;
+		srand((double)microtime()*1000000);
+		if ($this->maxLength < $this->minLength) {
+			$strLenght = $this->minLength;
+			$this->maxLength = $this->minLength;
+		} else {
+			$strLenght = rand($this->minLength, $this->maxLength);
+		}
+		for($i=0; $i<$strLenght; $i++) {
+			$randIndex = rand(0,$maxCharIndex);
+			$phrase .= strval($this->allowedChars[$randIndex]);
+		}
+		return $phrase;
+	}
+
+}
+
+?>
\ No newline at end of file
diff -ruN guestbook.new/lib/session.class.php guestbook.new.2.4.1/lib/session.class.php
--- guestbook.new/lib/session.class.php	2005-07-19 11:31:49.000000000 -0500
+++ guestbook.new.2.4.1/lib/session.class.php	2006-04-03 08:44:15.000000000 -0500
@@ -1,86 +1,86 @@
-<?php
-/**
- * ----------------------------------------------
- * Advanced Guestbook 2.3.3 (PHP/MySQL)
- * Copyright (c) Chi Kien Uong
- * URL: http://www.proxy2.de
- * ----------------------------------------------
- */
-
-class gb_session extends gbook_sql {
-
-    var $expire = 7200;
-    var $include_path;
-    var $table;
-
-    function gb_session($path='') {
-        global $GB_TBL;
-        $this->table = &$GB_TBL;
-        $this->gbook_sql();
-        $this->connect();
-        $this->include_path = $path;
-    }
-
-    function isValidSession($session,$user_id) {
-        $this->query("SELECT session, last_visit from ".$this->table['auth']." WHERE session='".addslashes($session)."' and ID='".intval($user_id)."'");
-        $row = $this->fetch_array($this->result);
-        if ($row) {            
-            return ($this->expire + $row['last_visit'] > time()) ? $row["session"] : false;
-        } else {
-            return false;
-        }
-    }
-
-    function isValidUser($user_id) {
-        $this->query("SELECT username FROM ".$this->table['auth']." WHERE ID='".intval($user_id)."'");
-        $this->fetch_array($this->result);
-        return ($this->record) ? true : false;
-    }
-
-    function changePass($user_id, $new_password) {
-        $this->query("UPDATE ".$this->table['auth']." SET password=PASSWORD('$new_password') WHERE ID='".intval($user_id)."'");
-        return ($this->record) ? true : false;
-    }
-
-    function generateNewSessionID($user_id) {
-        srand((double)microtime()*1000000);
-        $session = md5 (uniqid (rand()));
-        $timestamp = time();
-        $this->query("UPDATE ".$this->table['auth']." SET session='$session', last_visit='$timestamp' WHERE ID='".intval($user_id)."'");
-        return $session;
-    }
-
-    function checkPass($username,$password) {
-        $this->query("SELECT ID FROM ".$this->table['auth']." WHERE username='".addslashes($username)."' and password=PASSWORD('".addslashes($password)."')");
-        $this->fetch_array($this->result);
-        return ($this->record) ? $this->record["ID"] : false;
-    }
-
-    function checkSessionID() {
-        global $username, $password, $session, $uid;
-        if (isset($session) && isset($uid)) {
-        	if (get_magic_quotes_gpc()) {
-        		$session = stripslashes($session);
-        	}
-            return ($this->isValidSession($session,$uid)) ? array("session" => "$session", "uid" => "$uid") : false;
-        } elseif (isset($username) && isset($password)) {
-            if (get_magic_quotes_gpc()) {
-                $username = stripslashes($username);
-                $password = stripslashes($password);
-            }
-            $ID = $this->checkPass($username,$password);
-            if ($ID) {
-                $session = $this->generateNewSessionID($ID);
-                return array("session" => "$session", "uid" => "$ID");
-            } else {
-                return false;
-            }
-
-        } else {
-            return false;
-        }
-    }
-
-}
-
+<?php
+/**
+ * ----------------------------------------------
+ * Advanced Guestbook 2.4.1 (PHP/MySQL)
+ * Copyright (c) Chi Kien Uong
+ * URL: http://www.proxy2.de
+ * ----------------------------------------------
+ */
+
+class gb_session extends gbook_sql {
+
+    var $expire = 7200;
+    var $include_path;
+    var $table;
+
+    function gb_session($path='') {
+        global $GB_TBL;
+        $this->table = &$GB_TBL;
+        $this->gbook_sql();
+        $this->connect();
+        $this->include_path = $path;
+    }
+
+    function isValidSession($session,$user_id) {
+        $this->query("SELECT session, last_visit from ".$this->table['auth']." WHERE session='".addslashes($session)."' and ID='".intval($user_id)."'");
+        $row = $this->fetch_array($this->result);
+        if ($row) {            
+            return ($this->expire + $row['last_visit'] > time()) ? $row["session"] : false;
+        } else {
+            return false;
+        }
+    }
+
+    function isValidUser($user_id) {
+        $this->query("SELECT username FROM ".$this->table['auth']." WHERE ID='".intval($user_id)."'");
+        $this->fetch_array($this->result);
+        return ($this->record) ? true : false;
+    }
+
+    function changePass($user_id, $new_password) {
+        $this->query("UPDATE ".$this->table['auth']." SET password=PASSWORD('$new_password') WHERE ID='".intval($user_id)."'");
+        return ($this->record) ? true : false;
+    }
+
+    function generateNewSessionID($user_id) {
+        srand((double)microtime()*1000000);
+        $session = md5 (uniqid (rand()));
+        $timestamp = time();
+        $this->query("UPDATE ".$this->table['auth']." SET session='$session', last_visit='$timestamp' WHERE ID='".intval($user_id)."'");
+        return $session;
+    }
+
+    function checkPass($username,$password) {
+        $this->query("SELECT ID FROM ".$this->table['auth']." WHERE username='".addslashes($username)."' and password=PASSWORD('".addslashes($password)."')");
+        $this->fetch_array($this->result);
+        return ($this->record) ? $this->record["ID"] : false;
+    }
+
+    function checkSessionID() {
+        global $username, $password, $session, $uid;
+        if (isset($session) && isset($uid)) {
+        	if (get_magic_quotes_gpc()) {
+        		$session = stripslashes($session);
+        	}
+            return ($this->isValidSession($session,$uid)) ? array("session" => "$session", "uid" => "$uid") : false;
+        } elseif (isset($username) && isset($password)) {
+            if (get_magic_quotes_gpc()) {
+                $username = stripslashes($username);
+                $password = stripslashes($password);
+            }
+            $ID = $this->checkPass($username,$password);
+            if ($ID) {
+                $session = $this->generateNewSessionID($ID);
+                return array("session" => "$session", "uid" => "$ID");
+            } else {
+                return false;
+            }
+
+        } else {
+            return false;
+        }
+    }
+
+}
+
 ?>
\ No newline at end of file
diff -ruN guestbook.new/lib/template.class.php guestbook.new.2.4.1/lib/template.class.php
--- guestbook.new/lib/template.class.php	2005-07-19 11:31:49.000000000 -0500
+++ guestbook.new.2.4.1/lib/template.class.php	2006-04-03 08:44:15.000000000 -0500
@@ -1,63 +1,65 @@
-<?php
-/**
- * ----------------------------------------------
- * Advanced Guestbook 2.3.3 (PHP/MySQL)
- * Copyright (c) Chi Kien Uong
- * URL: http://www.proxy2.de
- * ----------------------------------------------
- */
-
-class gb_template {
-
-    var $template = array();
-    var $root_dir;
-    var $LANG;
-    var $plain_html = array();
-
-    function gb_template($path='') {
-        $this->root_dir = $path;
-    }
-
-    function set_rootdir($tpl_dir) {
-        if (!is_dir($tpl_dir)) {
-            return false;
-        }
-        $this->root_dir = $tpl_dir;
-        return true;
-    }
-
-    function set_lang($language='') {
-        if (!empty($language) && file_exists("$this->root_dir/lang/$language.php")) {
-            $this->language = $language;
-        } else {
-            $this->language = "english";
-        }
-        return $this->language;
-    }
-
-    function get_content() {
-        if (!isset($this->LANG)) {
-            include "$this->root_dir/lang/".$this->language.".php";
-            $this->LANG = &$LANG;
-            $this->WEEKDAY = &$weekday;
-            $this->MONTHS = &$months;
-        }
-        return $this->LANG;
-    }
-
-    function get_template($tpl) {
-        if (!isset($this->template[$tpl])) {
-            $filename = "$this->root_dir/templates/$tpl";
-            if (file_exists("$filename")) {
-                $fd = fopen ($filename, "r");
-                $this->template[$tpl] = fread ($fd, filesize ($filename));
-                fclose ($fd);
-                $this->template[$tpl] = ereg_replace("\"", "\\\"", $this->template[$tpl]);
-            }
-        }
-        return $this->template[$tpl];
-    }
-
-}
-
+<?php
+/**
+ * ----------------------------------------------
+ * Advanced Guestbook 2.4.1 (PHP/MySQL)
+ * Copyright (c) Chi Kien Uong
+ * URL: http://www.proxy2.de
+ * ----------------------------------------------
+ */
+
+class gb_template {
+
+    var $template = array();
+    var $root_dir;
+    var $LANG;
+    var $plain_html = array();
+
+    function gb_template($path='') {
+        $this->root_dir = $path;
+    }
+
+    function set_rootdir($tpl_dir) {
+        if (!is_dir($tpl_dir)) {
+            return false;
+        }
+        $this->root_dir = $tpl_dir;
+        return true;
+    }
+
+    function set_lang($language='') {
+        if (!empty($language) && file_exists("$this->root_dir/lang/$language.php")) {
+            $this->language = $language;
+        } else {
+            $this->language = "english";
+        }
+        return $this->language;
+    }
+
+    function get_content() {
+        if (!isset($this->LANG)) {
+            include "$this->root_dir/lang/".$this->language.".php";
+            $this->LANG = &$LANG;
+            $this->WEEKDAY = &$weekday;
+            $this->MONTHS = &$months;
+        }
+        return $this->LANG;
+    }
+
+    function get_template($tpl) {
+        if (!isset($this->template[$tpl])) {
+            $filename = "$this->root_dir/templates/$tpl";
+            if (file_exists("$filename") && filesize("$filename")>0) {
+                $fd = fopen ($filename, "r");
+                $this->template[$tpl] = fread ($fd, filesize ($filename));
+                fclose ($fd);
+                $this->template[$tpl] = ereg_replace("\"", "\\\"", $this->template[$tpl]);
+            } else {
+        		 $this->template[$tpl] = "";
+        	}
+        }
+        return $this->template[$tpl];
+    }
+
+}
+
 ?>
\ No newline at end of file
diff -ruN guestbook.new/lib/vars.class.php guestbook.new.2.4.1/lib/vars.class.php
--- guestbook.new/lib/vars.class.php	2005-07-19 11:31:49.000000000 -0500
+++ guestbook.new.2.4.1/lib/vars.class.php	2006-04-03 08:44:15.000000000 -0500
@@ -1,164 +1,165 @@
-<?php
-/**
- * ----------------------------------------------
- * Advanced Guestbook 2.3.3 (PHP/MySQL)
- * Copyright (c) Chi Kien Uong
- * URL: http://www.proxy2.de
- * ----------------------------------------------
- */
-
-class guestbook_vars extends gbook_sql {
-
-    var $VARS;
-    var $LANG;
-    var $table = array();
-    var $GB_TPL = array();
-    var $SMILIES;
-    var $template;
-
-    function guestbook_vars($path='') {
-        global $GB_TPL,$GB_TBL;
-        $this->table = &$GB_TBL;
-        $this->GB_TPL = &$GB_TPL;
-        $this->gbook_sql();
-        $this->connect();
-        $this->template = new gb_template($path);
-    }
-
-    function getVars() {
-        global $_COOKIE;
-        $this->VARS = $this->fetch_array($this->query("SELECT * FROM ".$this->table['cfg']));
-        $this->free_result($this->result);
-        if (isset($_COOKIE['lang']) && !empty($_COOKIE['lang'])) {
-            $this->template->set_lang($_COOKIE['lang']);
-        } else {
-            $this->template->set_lang($this->VARS["lang"]);
-        }
-        $this->LANG = &$this->template->get_content();
-        return $this->VARS;
-    }
-
-    function emotion($message) {
-        global $GB_PG;
-        if (!isset($this->SMILIES)) {
-            $this->query("SELECT * FROM ".$this->table['smile']);
-            while ($this->fetch_array($this->result)) {
-                $this->SMILIES[$this->record['s_code']] = "<img src=\"$GB_PG[base_url]/img/smilies/".$this->record['s_filename']."\" width=\"".$this->record['width']."\" height=\"".$this->record['height']."\">";
-            }
-        }
-        if (isset($this->SMILIES)) {
-            for(reset($this->SMILIES); $key=key($this->SMILIES); next($this->SMILIES)) {
-                $message = str_replace("$key",$this->SMILIES[$key],$message);
-            }
-        }
-        return $message;
-    }
-
-    function DateFormat($timestamp) {
-        $timestamp += $this->VARS["offset"]*3600;
-        list($wday,$mday,$month,$year,$hour,$minutes,$hour12,$ampm) = split("( )",date("w j n Y H i h A",$timestamp));
-        if ($this->VARS["tformat"] == "AMPM") {
-            $newtime = " $hour12:$minutes $ampm";
-        } else {
-            $newtime = " $hour:$minutes";
-        }
-        if ($this->VARS["dformat"] == "USx") {
-            $newdate = " $month-$mday-$year";
-        } elseif ($this->VARS["dformat"] == "US") {
-            $month -= 1;
-            $newdate = $this->template->WEEKDAY[$wday].", ".$this->template->MONTHS[$month]." $mday, $year";
-        } elseif ($this->VARS["dformat"] == "Euro") {
-            $month -= 1;
-            $newdate = $this->template->WEEKDAY[$wday].", $mday. ".$this->template->MONTHS[$month]." $year";
-        } else {
-            $newdate = "$mday.$month.$year";
-        }
-        return ($newdate=$newdate.$newtime);
-    }
-
-    function AGCode($string) {
-        $string=eregi_replace("\\[img\\](http://[^\\[]+)\\[/img\\]","<img src=\"\\1\" border=0>",$string);
-        $string=eregi_replace("\\[b\\]([^\\[]*)\\[/b\\]","<b>\\1</b>",$string);
-        $string=eregi_replace("\\[i\\]([^\\[]*)\\[/i\\]","<i>\\1</i>",$string);
-        $string=eregi_replace("\\[email\\]([^\\[]*)\\[/email\\]","<a href=\"mailto:\\1\">\\1</a>",$string);
-        $string=eregi_replace("\\[url\\]www.([^\\[]*)\\[/url\\]","<a href=\"http://www.\\1\" target=\"_blank\">\\1</a>",$string);
-        $string=eregi_replace("\\[url\\]([^\\[]*)\\[/url\\]","<a href=\"\\1\" target=\"_blank\">\\1</a>",$string);
-        $string=eregi_replace("\\[url=http://([^\\[]+)\\]([^\\[]*)\\[/url\\]","<a href=\"http://\\1\" target=\"_blank\">\\2</a>",$string);
-        return $string;
-    }
-
-    function FormatString($strg) {
-        $strg = trim($strg);
-        $strg = ereg_replace("[ ]+", " ", $strg);
-        return $strg;
-    }
-
-    function CheckWordLength($strg) {
-        $word_array = split ("[ |\n]",$strg);
-        for ($i=0;$i<sizeof($word_array);$i++) {
-            if (ereg("^\\[[a-z]{3,5}\\].+\\]",$word_array[$i])) {
-                if (strlen($word_array[$i]) > 200) {
-                    return false;
-                }
-            } elseif (strlen($word_array[$i]) > $this->VARS["max_word_len"]) {
-                return false;
-            }
-        }
-        return true;
-    }
-
-    function isBannedIp($ip) {
-        $this->query("SELECT * from ".$this->table['ban']);
-        if (!$this->result) {
-            return false;
-        }
-        while ($row = $this->fetch_array($this->result)) {
-            if (ereg("^$row[ban_ip]",$ip)) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    function FloodCheck($ip) {
-        $the_time = time()-$this->VARS["flood_timeout"];
-        $this->query("DELETE FROM ".$this->table['ip']." WHERE (timestamp < $the_time)");
-        $this->query("SELECT * FROM ".$this->table['ip']." WHERE (guest_ip = '$ip')");
-        $this->fetch_array($this->result);
-        return ($this->record) ? true : false;
-    }
-
-    function CensorBadWords($strg) {
-        $replace = "#@*%!";
-        $this->query("select * from ".$this->table['words']);
-        while ($row = $this->fetch_array($this->result)) {
-            $strg = eregi_replace($row["word"], $replace, $strg);
-        }
-        return $strg;
-    }
-
-    function gb_error($ERROR) {
-        global $GB_PG;
-        $LANG = &$this->LANG;
-        $VARS = &$this->VARS;
-        $error_html = "";
-        eval("\$error_html = \"".$this->template->get_template($this->GB_TPL['header'])."\";");
-        eval("\$error_html .= \"".$this->template->get_template($this->GB_TPL['error'])."\";");
-        eval("\$error_html .= \"".$this->template->get_template($this->GB_TPL['footer'])."\";");
-        return $error_html;
-    }
-
-	function encryptEmail($email) {
-		$email = trim($email);
-		$retVal = "";
-		if (!empty($email)) {
-			for($i=0; $i<strlen($email); $i++) {
-				$retVal .= dechex(ord($email[$i]));
-			}	
-		}
-		return $retVal;
-	}
-
-}
-
+<?php
+/**
+ * ----------------------------------------------
+ * Advanced Guestbook 2.4.1 (PHP/MySQL)
+ * Copyright (c) Chi Kien Uong
+ * URL: http://www.proxy2.de
+ * ----------------------------------------------
+ */
+
+class guestbook_vars extends gbook_sql {
+
+    var $VARS;
+    var $LANG;
+    var $table = array();
+    var $GB_TPL = array();
+    var $SMILIES;
+    var $template;
+
+    function guestbook_vars($path='') {
+        global $GB_TPL,$GB_TBL;
+        $this->table = &$GB_TBL;
+        $this->GB_TPL = &$GB_TPL;
+        $this->gbook_sql();
+        $this->connect();
+        $this->template = new gb_template($path);
+    }
+
+    function getVars() {
+        global $_COOKIE;
+        $this->VARS = $this->fetch_array($this->query("SELECT * FROM ".$this->table['cfg']));
+        $this->free_result($this->result);
+        if (isset($_COOKIE['lang']) && !empty($_COOKIE['lang'])) {
+            $this->template->set_lang($_COOKIE['lang']);
+        } else {
+            $this->template->set_lang($this->VARS["lang"]);
+        }
+        $this->LANG = &$this->template->get_content();
+        return $this->VARS;
+    }
+
+    function emotion($message) {
+        global $GB_PG;
+        if (!isset($this->SMILIES)) {
+            $this->query("SELECT * FROM ".$this->table['smile']);
+            while ($this->fetch_array($this->result)) {
+                $this->SMILIES[$this->record['s_code']] = "<img src=\"$GB_PG[base_url]/img/smilies/".$this->record['s_filename']."\" width=\"".$this->record['width']."\" height=\"".$this->record['height']."\">";
+            }
+        }
+        if (isset($this->SMILIES)) {
+            for(reset($this->SMILIES); $key=key($this->SMILIES); next($this->SMILIES)) {
+                $message = str_replace("$key",$this->SMILIES[$key],$message);
+            }
+        }
+        return $message;
+    }
+
+    function DateFormat($timestamp) {
+        $timestamp += $this->VARS["offset"]*3600;
+        list($wday,$mday,$month,$year,$hour,$minutes,$hour12,$ampm) = split("( )",date("w j n Y H i h A",$timestamp));
+        if ($this->VARS["tformat"] == "AMPM") {
+            $newtime = " $hour12:$minutes $ampm";
+        } else {
+            $newtime = " $hour:$minutes";
+        }
+        if ($this->VARS["dformat"] == "USx") {
+            $newdate = " $month-$mday-$year";
+        } elseif ($this->VARS["dformat"] == "US") {
+            $month -= 1;
+            $newdate = $this->template->WEEKDAY[$wday].", ".$this->template->MONTHS[$month]." $mday, $year";
+        } elseif ($this->VARS["dformat"] == "Euro") {
+            $month -= 1;
+            $newdate = $this->template->WEEKDAY[$wday].", $mday. ".$this->template->MONTHS[$month]." $year";
+        } else {
+            $newdate = "$mday.$month.$year";
+        }
+        return ($newdate=$newdate.$newtime);
+    }
+
+    function AGCode($string) {
+        $string=eregi_replace("\\[img\\](http://[^\\[]+)\\[/img\\]","<img src=\"\\1\" border=0>",$string);
+        $string=eregi_replace("\\[b\\]([^\\[]*)\\[/b\\]","<b>\\1</b>",$string);
+        $string=eregi_replace("\\[i\\]([^\\[]*)\\[/i\\]","<i>\\1</i>",$string);
+        $string=eregi_replace("\\[email\\]([^\\[]*)\\[/email\\]","<a href=\"mailto:\\1\">\\1</a>",$string);
+        $string=eregi_replace("\\[url\\]www.([^\\[]*)\\[/url\\]","<a href=\"http://www.\\1\" target=\"_blank\">\\1</a>",$string);
+        $string=eregi_replace("\\[url\\]([^\\[]*)\\[/url\\]","<a href=\"\\1\" target=\"_blank\">\\1</a>",$string);
+        $string=eregi_replace("\\[url=http://([^\\[]+)\\]([^\\[]*)\\[/url\\]","<a href=\"http://\\1\" target=\"_blank\">\\2</a>",$string);
+        return $string;
+    }
+
+    function FormatString($strg) {
+        $strg = trim($strg);
+        $strg = ereg_replace("[ ]+", " ", $strg);
+        return $strg;
+    }
+
+    function CheckWordLength($strg) {
+        $word_array = split ("[ |\n]",$strg);
+        for ($i=0;$i<sizeof($word_array);$i++) {
+            if (ereg("^\\[[a-z]{3,5}\\].+\\]",$word_array[$i])) {
+                if (strlen($word_array[$i]) > 200) {
+                    return false;
+                }
+            } elseif (strlen($word_array[$i]) > $this->VARS["max_word_len"]) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    function isBannedIp($ip) {
+        $this->query("SELECT * from ".$this->table['ban']);
+        if (!$this->result) {
+            return false;
+        }
+        while ($row = $this->fetch_array($this->result)) {
+            if (ereg("^$row[ban_ip]",$ip)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    function FloodCheck($ip) {
+        $the_time = time()-$this->VARS["flood_timeout"];
+        $this->query("DELETE FROM ".$this->table['ip']." WHERE (timestamp < $the_time)");
+        $this->query("SELECT * FROM ".$this->table['ip']." WHERE (guest_ip = '$ip')");
+        $this->fetch_array($this->result);
+        return ($this->record) ? true : false;
+    }
+
+    function CensorBadWords($strg) {
+        $replace = "#@*%!";
+        $this->query("select * from ".$this->table['words']);
+        while ($row = $this->fetch_array($this->result)) {
+        	$row['word'] = preg_quote($row['word'], '/');
+			$strg = preg_replace('/'.$row['word'].'/i', $replace, $strg);
+        }
+        return $strg;
+    }
+
+    function gb_error($ERROR) {
+        global $GB_PG;
+        $LANG = &$this->LANG;
+        $VARS = &$this->VARS;
+        $error_html = "";
+        eval("\$error_html = \"".$this->template->get_template($this->GB_TPL['header'])."\";");
+        eval("\$error_html .= \"".$this->template->get_template($this->GB_TPL['error'])."\";");
+        eval("\$error_html .= \"".$this->template->get_template($this->GB_TPL['footer'])."\";");
+        return $error_html;
+    }
+
+	function encryptEmail($email) {
+		$email = trim($email);
+		$retVal = "";
+		if (!empty($email)) {
+			for($i=0; $i<strlen($email); $i++) {
+				$retVal .= dechex(ord($email[$i]));
+			}	
+		}
+		return $retVal;
+	}
+
+}
+
 ?>
\ No newline at end of file
diff -ruN guestbook.new/log.txt guestbook.new.2.4.1/log.txt
--- guestbook.new/log.txt	2005-07-19 11:31:49.000000000 -0500
+++ guestbook.new.2.4.1/log.txt	1969-12-31 18:00:00.000000000 -0600
@@ -1,6 +0,0 @@
-Changed files in this release (2.3.3)
-
-- install.php
-- lib/add.class.php
-- templates/form.php
-
diff -ruN guestbook.new/misc/forget_pass.php guestbook.new.2.4.1/misc/forget_pass.php
--- guestbook.new/misc/forget_pass.php	1969-12-31 18:00:00.000000000 -0600
+++ guestbook.new.2.4.1/misc/forget_pass.php	2006-04-03 08:44:15.000000000 -0500
@@ -0,0 +1,135 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<title>Create new password</title>
+</head>
+<body>
+<?php
+if (file_exists("../admin/config.inc.php")) {
+	include_once "../admin/config.inc.php";
+	include_once "../lib/$DB_CLASS";
+} elseif (file_exists("./admin/config.inc.php")) {
+	include_once "./admin/config.inc.php";
+	include_once "./lib/$DB_CLASS";
+} else {
+	echo "Can't find config.inc.php";
+	exit();
+}
+$GB_DB = array();
+
+function showForm($message="") {
+	echo "
+	<h3>$message</h3>
+	<form name=\"dbForm\" method=\"post\" action=\"{$_SERVER['PHP_SELF']}\">
+	<table border=\"0\" cellspacing=\"2\" cellpadding=\"2\">
+		<tr>
+			<td width=\"120\">Hostname</td>
+			<td><input name=\"data[host]\" type=\"text\" value=\"localhost\"></td>
+		</tr>
+		<tr>
+			<td>Database</td>
+		<td><input type=\"text\" name=\"data[db]\"></td>
+		</tr>
+		<tr>
+			<td>Username</td>
+			<td><input type=\"text\" name=\"data[username]\"></td>
+		</tr>
+		<tr>
+			<td>Password</td>
+			<td><input type=\"password\" name=\"data[password]\"></td>
+		</tr>
+		<tr>
+			<td>&nbsp;</td>
+			<td><input name=\"submit\" type=\"submit\" value=\"Submit\">
+			<input type=\"reset\" value=\"Reset\">
+			<input type=\"hidden\" name=\"go\" value=\"login\"></td>
+		</tr>
+	</table>
+	</form>
+	";
+}
+
+function showAccountForm($hidden="") {
+	echo "
+	<h3>Please enter a new username and password for the admin control panel.</h3>
+	<form name=\"dbForm\" method=\"post\" action=\"{$_SERVER['PHP_SELF']}\">
+	<table border=\"0\" cellspacing=\"2\" cellpadding=\"2\">
+		<tr>
+			<td width=\"120\">Username</td>
+			<td><input type=\"text\" name=\"data[username]\"></td>
+		</tr>
+		<tr>
+			<td>Password</td>
+			<td><input type=\"password\" name=\"data[password]\"></td>
+		</tr>
+		<tr>
+			<td>&nbsp;</td>
+			<td><input name=\"submit\" type=\"submit\" value=\"Submit\">
+			<input type=\"reset\" value=\"Reset\">
+			<input type=\"hidden\" name=\"go\" value=\"change\">$hidden</td>
+		</tr>
+	</table>
+	</form>
+	";
+}
+
+function stripQuotes($postArr) {
+	if (get_magic_quotes_gpc()) {
+		foreach ($postArr as $key => $value) {
+			$postArr[$key] = stripslashes($value);
+		}
+	}
+	return $postArr;
+}
+
+$go = (isset($_POST['go'])) ? $_POST['go'] : "";
+
+if (isset($_POST['data']) && is_array($_POST['data'])) {
+	$_POST['data'] = stripQuotes($_POST['data']);
+}
+switch ($go) {
+
+	case "login":
+		$GB_DB["dbName"] = (isset($_POST['data']['db'])) ? $_POST['data']['db'] : "";
+		$GB_DB["host"]   = (isset($_POST['data']['host'])) ? $_POST['data']['host'] : "";
+		$GB_DB["user"]   = (isset($_POST['data']['username'])) ? $_POST['data']['username'] : "";
+		$GB_DB["pass"]   = (isset($_POST['data']['password'])) ? $_POST['data']['password'] : "";
+		if ($GB_DB["dbName"] == "" || $GB_DB["host"] == "" || $GB_DB["user"] == "") {
+			showForm("Please enter database, hostname and username!");
+		} else {
+			$db = new gbook_sql();
+			$db->connect();
+			$hidden = "";
+			foreach ($GB_DB as $key => $value) {
+				$hidden .= "<input type=\"hidden\" name=\"gbdb[$key]\" value=\"".htmlspecialchars($value)."\">";
+			}
+			showAccountForm($hidden);
+		}
+		break;
+
+	case "change":
+		if (isset($_POST['gbdb']) && is_array($_POST['gbdb'])) {
+			$_POST['gbdb'] = stripQuotes($_POST['gbdb']);
+		}
+		$GB_DB["dbName"] = (isset($_POST['gbdb']['dbName'])) ? $_POST['gbdb']['dbName'] : "";
+		$GB_DB["host"]   = (isset($_POST['gbdb']['host'])) ? $_POST['gbdb']['host'] : "";
+		$GB_DB["user"]   = (isset($_POST['gbdb']['user'])) ? $_POST['gbdb']['user'] : "";
+		$GB_DB["pass"]   = (isset($_POST['gbdb']['pass'])) ? $_POST['gbdb']['pass'] : "";
+		$db = new gbook_sql();
+		$db->connect();
+		if (!empty($_POST['data']['username']) && !empty($_POST['data']['password'])) {		
+			$username = addslashes($_POST['data']['username']);
+			$password = addslashes($_POST['data']['password']);
+			$db->query("UPDATE {$GB_TBL['auth']} SET username='$username', password=PASSWORD('$password') WHERE ID='1'");
+			echo "<h3>Username and password changed.</h3>";
+		} else {
+			echo "<h3>Username or password is empty.</h3>";
+		}
+		break;
+
+	default:
+		showForm();
+}
+?>
+</body>
+</html>
diff -ruN guestbook.new/misc/index.html guestbook.new.2.4.1/misc/index.html
--- guestbook.new/misc/index.html	1969-12-31 18:00:00.000000000 -0600
+++ guestbook.new.2.4.1/misc/index.html	2006-04-03 08:44:15.000000000 -0500
@@ -0,0 +1 @@
+ 
\ No newline at end of file
diff -ruN guestbook.new/misc/update_db.php guestbook.new.2.4.1/misc/update_db.php
--- guestbook.new/misc/update_db.php	1969-12-31 18:00:00.000000000 -0600
+++ guestbook.new.2.4.1/misc/update_db.php	2006-04-03 08:44:15.000000000 -0500
@@ -0,0 +1,61 @@
+<html>
+<head>
+<title>Update DB script</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+<body>
+<xmp>
+<?php
+if (file_exists("../admin/config.inc.php")) {
+	include_once "../admin/config.inc.php";
+	include_once "../lib/$DB_CLASS";
+} elseif (file_exists("./admin/config.inc.php")) {
+	include_once "./admin/config.inc.php";
+	include_once "./lib/$DB_CLASS";
+} else {
+	echo "Can't find config.inc.php";
+	exit();
+}
+
+if (!isset($GB_TBL['cap']) || empty($GB_TBL['cap'])) {
+	echo "Please update config.inc.php first.";
+	exit;
+}
+
+$sqlquery[] = "ALTER TABLE `{$GB_TBL['data']}` CHANGE `browser` `browser` TINYTEXT";
+$sqlquery[] = "ALTER TABLE `{$GB_TBL['priv']}` CHANGE `browser` `browser` TINYTEXT";
+$sqlquery[] = "ALTER TABLE `{$GB_TBL['data']}` CHANGE `host` `host` VARCHAR(255) DEFAULT NULL";
+$sqlquery[] = "ALTER TABLE `{$GB_TBL['priv']}` CHANGE `host` `host` VARCHAR(255) DEFAULT NULL";
+$sqlquery[] = "ALTER TABLE `{$GB_TBL['data']}` CHANGE `email` `email` VARCHAR(100) DEFAULT NULL";
+$sqlquery[] = "ALTER TABLE `{$GB_TBL['priv']}` CHANGE `email` `email` VARCHAR(100) DEFAULT NULL";
+$sqlquery[] = "ALTER TABLE `{$GB_TBL['data']}` CHANGE `location` `location` VARCHAR(100) DEFAULT NULL";
+$sqlquery[] = "ALTER TABLE `{$GB_TBL['priv']}` CHANGE `location` `location` VARCHAR(100) DEFAULT NULL";
+$sqlquery[] = "ALTER TABLE `{$GB_TBL['com']}` CHANGE `host` `host` VARCHAR(255) DEFAULT NULL";
+
+$sqlquery[] = "CREATE TABLE {$GB_TBL['cap']} (
+	session_id char(32) DEFAULT '' NOT NULL,
+	validate_key varchar(64) NOT NULL,
+	timestamp int(11) unsigned NOT NULL,
+	PRIMARY KEY (session_id)
+)";
+
+$db = new gbook_sql();
+$db->connect();
+$res = $db->query("SHOW TABLES LIKE '{$GB_TBL['cap']}'");
+$result = $db->fetch_array($res);
+
+if ($result == false) {
+	echo "Updating db from 2.3.x to 2.4.1 \n\n";
+	for ($i=0; $i<count($sqlquery); $i++) {
+		$db->query($sqlquery[$i]);
+		echo " - $sqlquery[$i]\n";
+	}
+	echo "------------\n\n Update finished.";
+} else {
+	echo "No update required.";
+}
+
+?>
+</xmp>
+</body>
+</html>
diff -ruN guestbook.new/picture.php guestbook.new.2.4.1/picture.php
--- guestbook.new/picture.php	2005-07-19 11:31:49.000000000 -0500
+++ guestbook.new.2.4.1/picture.php	2006-04-03 08:44:15.000000000 -0500
@@ -19,7 +19,13 @@
         }
     }
 }
-$tbl_height = (isset($size[1]) && $size[1]>100) ? $size[1]+$border : 100;
+if (isset($size[1]) && $size[1]>100) {
+	$tbl_height = $size[1]+$border;
+	$tbl_width = "100%";
+} else {
+	$tbl_height = 100;
+	$tbl_width = 100+$border;
+}
 ?>
 <html>
 <head>
@@ -27,7 +33,7 @@
 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
 </head>
 <body bgcolor="#CCCCCC" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
-<table width="100%" border="0" cellspacing="0" cellpadding="0" height="<?php echo $tbl_height; ?>">
+<table width="<?php echo $tbl_width; ?>" border="0" cellspacing="0" cellpadding="0" height="<?php echo $tbl_height; ?>">
   <tr>
     <td align="center" valign="middle">
     <?php
diff -ruN guestbook.new/templates/admin_enter.php guestbook.new.2.4.1/templates/admin_enter.php
--- guestbook.new/templates/admin_enter.php	2005-07-19 11:31:49.000000000 -0500
+++ guestbook.new.2.4.1/templates/admin_enter.php	2006-04-03 08:44:15.000000000 -0500
@@ -1,32 +1,32 @@
-<table border="0" cellspacing="0" cellpadding="2" align="center" width="$VARS[width]">
-  <tr>
-    <td height="45" width="55%"><b><font size="4" face="$VARS[font_face]" color="$VARS[text_color]">$LANG[FormSelect] - $LANG[BookMess5]</font></b></td>
-    <td height="45" width="45%">&nbsp;</td>
-  </tr>
-  <tr>
-    <td width="50%" valign="bottom" class="font2">$LANG[FormEnter]</td>
-    <td width="50%" align="right" valign="bottom" class="font2"> <b><img src="$GB_PG[base_url]/img/return.gif" width="10" height="10"> <a href="$GB_PG[index]">$LANG[BookMess4]</a>
-     | <img src="$GB_PG[base_url]/img/sign.gif" width="9" height="12"> <a href="$GB_PG[addentry]">$LANG[BookMess3]</a></b></td>
-  </tr>
-</table>
-<form method="post" action="$GB_PG[admin]">
-  <table bgcolor="$VARS[tb_bg_color]" border="0" cellspacing="1" cellpadding="5" align="center" width="$VARS[width]">
-    <tr bgcolor="$VARS[tb_hdr_color]">
-      <td colspan="2"><font size="2" face="$VARS[font_face]" color="$VARS[tb_text]"><b>$message</b></font></td>
-    </tr>
-    <tr bgcolor="$VARS[tb_color_1]">
-      <td width="30%" class="font1">$LANG[FormUser]:</td>
-      <td width="70%"><input type="text" name="username" size="30"></td>
-    </tr>
-    <tr bgcolor="$VARS[tb_color_1]">
-      <td width="30%" class="font1">$LANG[FormPass]:</td>
-      <td width="70%"><input type="password" name="password" size="30">
-        <input type="hidden" name="enter" value="1">
-      </td>
-    </tr>
-    <tr bgcolor="$VARS[tb_color_1]">
-      <td width="30%">&nbsp;</td>
-      <td width="70%"><input type="submit" value="$LANG[FormSubmit]" class="input"></td>
-    </tr>
-  </table>
-</form>
+<table border="0" cellspacing="0" cellpadding="2" align="center" width="$VARS[width]">
+  <tr>
+    <td height="45" width="55%"><b><font size="4" face="$VARS[font_face]" color="$VARS[text_color]">$LANG[FormSelect] - $LANG[BookMess5]</font></b></td>
+    <td height="45" width="45%">&nbsp;</td>
+  </tr>
+  <tr>
+    <td width="50%" valign="bottom" class="font2">$LANG[FormEnter]</td>
+    <td width="50%" align="right" valign="bottom" class="font2"> <b><img src="$GB_PG[base_url]/img/return.gif" width="10" height="10"> <a href="$GB_PG[index]">$LANG[BookMess4]</a>
+     | <img src="$GB_PG[base_url]/img/sign.gif" width="9" height="12"> <a href="$GB_PG[addentry]">$LANG[BookMess3]</a></b></td>
+  </tr>
+</table>
+<form method="post" action="$GB_PG[admin]">
+  <table bgcolor="$VARS[tb_bg_color]" border="0" cellspacing="1" cellpadding="5" align="center" width="$VARS[width]">
+    <tr bgcolor="$VARS[tb_hdr_color]">
+      <td colspan="2"><font size="2" face="$VARS[font_face]" color="$VARS[tb_text]"><b>$message</b></font></td>
+    </tr>
+    <tr bgcolor="$VARS[tb_color_1]">
+      <td width="30%" class="font1">$LANG[FormUser]:</td>
+      <td width="70%"><input type="text" name="username" size="30"></td>
+    </tr>
+    <tr bgcolor="$VARS[tb_color_1]">
+      <td width="30%" class="font1">$LANG[FormPass]:</td>
+      <td width="70%"><input type="password" name="password" size="30">
+        <input type="hidden" name="enter" value="1">
+      </td>
+    </tr>
+    <tr bgcolor="$VARS[tb_color_1]">
+      <td width="30%">&nbsp;</td>
+      <td width="70%"><input type="submit" value="$LANG[FormSubmit]" class="input"></td>
+    </tr>
+  </table>
+</form>
diff -ruN guestbook.new/templates/captcha.php guestbook.new.2.4.1/templates/captcha.php
--- guestbook.new/templates/captcha.php	1969-12-31 18:00:00.000000000 -0600
+++ guestbook.new.2.4.1/templates/captcha.php	2006-04-03 08:44:15.000000000 -0500
@@ -0,0 +1,6 @@
+    	<table border="0" cellspacing="2">
+			<tr>
+				<td><img src="$GB_PG[base_url]/image.php?id=$VARS[gbtoken]" border="0"></td>
+				<td><input type="text" name="gb_captcha" size="15"></td>
+			</tr>
+		</table>
diff -ruN guestbook.new/templates/comment.php guestbook.new.2.4.1/templates/comment.php
--- guestbook.new/templates/comment.php	2005-07-19 11:31:49.000000000 -0500
+++ guestbook.new.2.4.1/templates/comment.php	2006-04-03 08:44:15.000000000 -0500
@@ -27,11 +27,11 @@
 
     <tr bgcolor="$VARS[tb_color_1]">
       <td width="32%" class="font1"><img src="$GB_PG[base_url]/img/edit.gif" width="18" height="13">$LANG[BookMess7]:</td>
-      <td><textarea name="comment" cols="32" rows="6"></textarea></td>
+      <td><textarea name="comment" cols="41" rows="6"></textarea></td>
     </tr>
     <tr bgcolor="$VARS[tb_color_1]">
       <td width="32%" class="font1">$LANG[FormName]:</td>
-      <td><input type="text" name="gb_user" size="35" maxlength="25"></td>
+      <td><input type="text" name="gb_user" size="55" maxlength="25"></td>
     </tr>
     
 $COMMENT_PASS
diff -ruN guestbook.new/templates/com_pass.php guestbook.new.2.4.1/templates/com_pass.php
--- guestbook.new/templates/com_pass.php	2005-07-19 11:31:49.000000000 -0500
+++ guestbook.new.2.4.1/templates/com_pass.php	2006-04-03 08:44:15.000000000 -0500
@@ -1,4 +1,4 @@
     <tr bgcolor="$VARS[tb_color_1]">
       <td width="32%" class="font1">$LANG[FormPass]:</td>
-      <td><input type="password" name="pass_comment" size="35"></td>
+      <td><input type="password" name="pass_comment" size="55"></td>
     </tr>
diff -ruN guestbook.new/templates/footer.php guestbook.new.2.4.1/templates/footer.php
--- guestbook.new/templates/footer.php	2005-07-19 11:31:49.000000000 -0500
+++ guestbook.new.2.4.1/templates/footer.php	2006-04-03 08:44:15.000000000 -0500
@@ -1,3 +1,3 @@
-<center><b><font face="Arial, Helvetica, sans-serif" color="#CCCCCC" size="1"><a href="http://www.proxy2.de" target="_blank"><font color="#CCCCCC" size="1">Advanced Guestbook 2.3.3</font></a></font></b></center>
+<center><b><font face="Arial, Helvetica, sans-serif" color="#CCCCCC" size="1"><a href="http://www.proxy2.de" target="_blank"><font color="#CCCCCC" size="1">Advanced Guestbook 2.4.1</font></a></font></b></center>
 </body>
 </html>
diff -ruN guestbook.new/templates/form_aim.php guestbook.new.2.4.1/templates/form_aim.php
--- guestbook.new/templates/form_aim.php	2005-07-19 11:31:49.000000000 -0500
+++ guestbook.new.2.4.1/templates/form_aim.php	2006-04-03 08:44:15.000000000 -0500
@@ -1,4 +1,4 @@
 <tr bgcolor="$VARS[tb_color_1]">
     <td width="25%" class="font1"><img src="$GB_PG[base_url]/img/aim.gif" width="13" height="16"> AIM:</td>
-    <td><input type="text" name="gb_aim" size="42" maxlength="70"></td>
+    <td><input type="text" name="gb_aim" size="55" maxlength="70"></td>
 </tr>
diff -ruN guestbook.new/templates/form_icq.php guestbook.new.2.4.1/templates/form_icq.php
--- guestbook.new/templates/form_icq.php	2005-07-19 11:31:49.000000000 -0500
+++ guestbook.new.2.4.1/templates/form_icq.php	2006-04-03 08:44:15.000000000 -0500
@@ -1,4 +1,4 @@
 <tr bgcolor="$VARS[tb_color_1]">
     <td width="25%" class="font1"><img src="$GB_PG[base_url]/img/icq.gif" width="15" height="16"> ICQ:</td>
-    <td><input type="text" name="gb_icq" size="42" maxlength="20"></td>
+    <td><input type="text" name="gb_icq" size="55" maxlength="20"></td>
 </tr>
diff -ruN guestbook.new/templates/form.php guestbook.new.2.4.1/templates/form.php
--- guestbook.new/templates/form.php	2005-07-19 11:31:49.000000000 -0500
+++ guestbook.new.2.4.1/templates/form.php	2006-04-03 08:44:15.000000000 -0500
@@ -70,26 +70,26 @@
  </tr>
 </table>
 <form method="post" action="$GB_PG[addentry]" name="book" enctype="multipart/form-data" onsubmit="return checkForm()">
-<input type="hidden" name="gb_hash" value="$VARS[gbhash]">
+<input type="hidden" name="gb_token" value="$VARS[gbtoken]">
 <table border="0" cellspacing="1" cellpadding="4" width="$VARS[width]" align="center" bgcolor="$VARS[tb_bg_color]">
   <tr>
     <td colspan="2" bgcolor="$VARS[tb_hdr_color]"><b><font size="2" face="$VARS[font_face]" color="$VARS[tb_text]">$LANG[BookMess3]:</font></b></td>
   </tr>
   <tr bgcolor="$VARS[tb_color_1]">
     <td width="25%" class="font1"><img src="$GB_PG[base_url]/img/user.gif" width="16" height="15"> $LANG[FormName]*:</td>
-    <td><input type="text" name="gb_name" size="42" maxlength="30"></td>
+    <td><input type="text" name="gb_name" size="55" maxlength="30"></td>
   </tr>
   <tr bgcolor="$VARS[tb_color_1]">
     <td width="25%" class="font1"><img src="$GB_PG[base_url]/img/email.gif" width="15" height="15"> $LANG[FormEmail]:</td>
-    <td><input type="text" name="gb_email" size="42" maxlength="30"></td>
+    <td><input type="text" name="gb_email" size="55" maxlength="60"></td>
   </tr>
   <tr bgcolor="$VARS[tb_color_1]">
     <td width="25%" class="font1"><img src="$GB_PG[base_url]/img/location.gif" width="16" height="16"> $LANG[FormLoc]:</td>
-    <td><input type="text" name="gb_location" size="42" maxlength="30"></td>
+    <td><input type="text" name="gb_location" size="55" maxlength="30"></td>
   </tr>
   <tr bgcolor="$VARS[tb_color_1]">
     <td width="25%" class="font1"><img src="$GB_PG[base_url]/img/home.gif" width="16" height="16"> $LANG[FormUrl]:</td>
-    <td><input type="text" name="gb_url" size="42" value="http://" maxlength="45"></td>
+    <td><input type="text" name="gb_url" size="55" value="http://" maxlength="60"></td>
   </tr> 
 
 $OPTIONAL
@@ -133,6 +133,7 @@
   <tr bgcolor="$VARS[tb_color_1]">
     <td width="25%"><div align="left" class="font2">$HTML_CODE<br>$SMILE_CODE<br>$AG_CODE</div></td>
     <td>
+      $CAPTCHA
       <input type="submit" name="gb_action" value="$LANG[FormSubmit]" class="input" onclick="if(flag==1) return false;">
       <input type="submit" name="gb_action" value="$LANG[FormPreview]" class="input" onclick="if(flag==1) return false;">
       <input type="reset" value="$LANG[FormReset]" class="input">
diff -ruN guestbook.new/templates/preview_entry.php guestbook.new.2.4.1/templates/preview_entry.php
--- guestbook.new/templates/preview_entry.php	2005-07-19 11:31:49.000000000 -0500
+++ guestbook.new.2.4.1/templates/preview_entry.php	2006-04-03 08:44:15.000000000 -0500
@@ -28,6 +28,7 @@
  <tr bgcolor="$VARS[tb_color_1]">
    <td width="32%">&nbsp;</td>
    <td>
+    $CAPTCHA
     <input type="button" name="back" value="$LANG[FormBack]" class="input" onclick="javascript:history.back()">
     <input type="submit" name="gb_action" value="$LANG[FormSubmit]" class="input" onclick="if(flag==1) return false;">
     $HIDDEN
