Location: PHPKode > projects > KISGB (Keep It Simple Guest Book) > functions.php
<?
/*
   KISGB - a Guest Book script written in PHP.
   Copyright (C) 2001-2002 Gaylen Fraley
   hide@address.com

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   License file for more details.
*/
$style = <<<_STYLE_
<style type="text/css">
<!--
.bold {
	font-weight: bold;
}

.italics {
	font-style: italic;
}

.underline {
	text-decoration: underline;
}

.strikethrough {
	text-decoration: line-through;
}

.overline {
	text-decoration: overline;
}

.sized {
	text-size:
}

.quotecodeheader {
	font-family: Verdana, arial, helvetica, sans-serif;
#	font-size: 12px;
	font-weight: bold;
}

.codebody {
	background-color: #FFFFFF;
    font-family: Courier new, courier, mono;
#    font-size: 12px;
    color: #006600;
    border: 1px solid #BFBFBF;
}

.quotebody {
	background-color: #FFFFFF;
    font-family: Courier new, courier, mono;
#    font-size: 12px;
    color: #660002;
	border: 1px solid #BFBFBF;
}

.listbullet {
	list-style-type: disc;
	list-style-position: inside;
}

.listdecimal {
	list-style-type: decimal;
	list-style-position: inside;
}

.listlowerroman {
	list-style-type: lower-roman;
	list-style-position: inside;
}

.listupperroman {
	list-style-type: upper-roman;
	list-style-position: inside;
}

.listloweralpha {
	list-style-type: lower-alpha;
	list-style-position: inside;
}

.listupperalpha {
	list-style-type: upper-alpha;
	list-style-position: inside;
}
-->
</style>
_STYLE_;
echo $style;

function gethost($ip) {
	global $useGetHostByAddr;
	if (!$useGetHostByAddr) return $ip;
	if (isSet($_SERVER)) {
		if (isSet($_SERVER["HTTP_X_FORWARDED_FOR"])) {
			$realip = $_SERVER["HTTP_X_FORWARDED_FOR"];
		} elseif (isSet($_SERVER["HTTP_CLIENT_IP"])) {
			$realip = $_SERVER["HTTP_CLIENT_IP"];
		} else {
			$realip = $_SERVER["REMOTE_ADDR"];
		}

	} else

	if (isSet($HTTP_SERVER_VARS)) {
		if (isSet($HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"])) {
			$realip = $HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"];
		} elseif (isSet($HTTP_SERVER_VARS["HTTP_CLIENT_IP"])) {
			$realip = $HTTP_SERVER_VARS["HTTP_CLIENT_IP"];
		} else {
			$realip = $HTTP_SERVER_VARS["REMOTE_ADDR"];
		}

	} else {
		if ( getenv( 'HTTP_X_FORWARDED_FOR' ) ) {
			$realip = getenv( 'HTTP_X_FORWARDED_FOR' );
		} elseif ( getenv( 'HTTP_CLIENT_IP' ) ) {
			$realip = getenv( 'HTTP_CLIENT_IP' );
		} else {
			$realip = getenv( 'REMOTE_ADDR' );
		}
	}
	return @gethostbyaddr($realip);
}

function setupStuff() {
	if (!isset($_GET) && !isset($_POST)) {
	        $_GET = @$HTTP_GET_VARS;
	        $_POST = @$HTTP_POST_VARS;
	        $_COOKIE = @$HTTP_COOKIE_VARS;
	        $_SESSION = @$HTTP_SESSION_VARS;
	        $_ENV = @$HTTP_ENV_VARS;
	        $_SERVER = @$HTTP_SERVER_VARS;
	}
}

function applyNukeTheme() {
	global $REQUEST_URI, $path_to_nuke_directory;
	$x=parse_url($REQUEST_URI);
	$vars = explode('=',$x['query']);
	$nuke_theme = '';
	for ($i=0;$i<count($vars);$i++) {
		if ($vars[$i]=='nuke_theme') $nuke_theme = $vars[$i+1];
	}
	if (!empty($nuke_theme)) {
		$nuke_theme =  "<LINK REL=\"StyleSheet\" HREF=\"$path_to_nuke_directory/themes/$nuke_theme/style/style.css\" TYPE=\"text/css\">";
	}
		echo  "<LINK REL=\"StyleSheet\" HREF=\"$path_to_nuke_directory/themes/Sand_Journey/style/style.css\" TYPE=\"text/css\">";

	return $nuke_theme;
}

function whoami () {
	global $myIP; global $rmt_ip;
	if ($myIP=="*") return true;
	$ips = explode(",",$myIP);
	for ($i=0;$i<count($ips);$i++) {
		if ($ips[$i]==$rmt_ip||$ips[$i]=="*") return true;
	}
	return false;
}

function check_php_version() {
	// check if version is above 4.0.n
	if (ereg( "[4-9]\.[0-9]\.[0-9].*", phpversion() ));
	else {echo "<html><body><form method=\"post\"><table border=\"1\" width=\"75%\" align=\"center\"><tr><td align=\"center\">This version of KISGB requires PHP version 4.0.x or higher.<br /><br />It appears that you do not have the required version.<br /><br />KISGB cannot continue.  Sorry!</td></tr></table></form>";
	exit();}
}

function makeLink($msg) {
	global $id;
	global $Vwindow_url_color1;
	global $Vwindow_url_color2;
	if (strtolower($id)=="td1") $url_color = $Vwindow_url_color1;
	else $url_color = $Vwindow_url_color2;
	$msg = str_replace("\n"," \n",$msg);//Keeps c/r out of links
        $msg = str_replace("<br"," <br",$msg);//Keeps c/r out of links
	// this next line forces a space in the event someone enters just a url and no space after.
	$msg = $msg." ";
	$chkit = explode(" ",$msg);
	for ($i=0;$i<count($chkit);$i++) {
		if (eregi("([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=])",$chkit[$i])) {
			//  do not convert any text that already has href and *:// in it
			if (FALSE!==strpos(strtolower($chkit[$i]),"href=")||FALSE!==strpos(strtolower($chkit[$i]),"src="));
			elseif (!strpos($chkit[$i],"href=")&&!strpos($chkit[$i],"http://")&&!strpos($chkit[$i],"https://")) {
				$chkit[$i] = eregi_replace("([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=])","<a href=\"\\1://\\2\\3\" target=\"_blank\"><span style=\"color:$url_color;\">\\1://\\2\\3</span></a>", $chkit[$i]);
			}
			elseif (strpos($chkit[$i],"href=")===FALSE&&strpos($chkit[$i],"http://")) {
				$chkit[$i] = eregi_replace("([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=])","<a href=\"\\1://\\2\\3\" target=\"_blank\"><span style=\"color:$url_color;\">\\1://\\2\\3</span></a>", $chkit[$i]);
			}
		}
	}
	$msg = implode(" ",$chkit);
	$msg = " ".$msg; /* Needed to force recognition of hyperlinks in preg_replace routine when link starts at beginning of comment. All the routines here can easily step on each other, so some tricks are required to keep a delicate balance.  Modify with caution! */
	$msg = eregi_replace('<',' <',$msg);
	//  convert any text that already has ftp. in it.
	$msg = preg_replace("/[ |\n](ftp\.[^ ]*\.[^ ]*) /i"," <a href='http://\\1' target='_blank'><span style=\"color:$url_color;\">\\1</span></a> ",$msg);
	//  convert any text that already has www. in it, but not ftp
	$msg = preg_replace("/[ |\n](www[^ ]*\.[^ ]*\.[^ ]*) /i"," <a href='http://\\1' target='_blank'><span style=\"color:$url_color;\">\\1</span></a> ",$msg);
	$msg = str_replace(" \n","\n",$msg);
        $msg = str_replace(" <br","<br",$msg);
	return $msg;
}

function js_getPointer() {
$js_string = <<<_JAVASCRIPT_
	<script type="text/javascript">
		function get_pointer() {
			var agt=navigator.userAgent.toLowerCase();
			var is_ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
			pointer = 'pointer';
			if (is_ie) pointer = 'hand';
			return pointer;
		}
	</script>
_JAVASCRIPT_;
echo $js_string;
}

function wordwrap2($str, $cols, $cut)
{
   $len = strlen($str);
   $tag = 0;
   for ($i = 0; $i < $len; $i++) {
	   $chr = $str[$i];
	   if ($chr == '<') {
		  $tag++;
	   } elseif ($chr == '>') {
		  $tag--;
	   } elseif (!$tag) {
		   if (function_exists('ctype_space') && ctype_space($chr)) $wordlen = 0;
		   elseif (ord($chr)==7||ord($chr)==32||(ord($chr)>=10&&ord($chr)<=13)) $wordlen = 0;
	       else $wordlen++;
	   }

	   if ((!$tag) && ($wordlen) && (!($wordlen % $cols))) {
		   $chr .= $cut;
	  }

	   $result .= $chr;
   }

   return $result;
}

function metaTags() {
	global $charset;
	echo "<meta http-equiv=\"Content-Type\" content=\"text/html; $charset\" />\n";
	echo "<meta name=\"Keywords\" content=\"php,PHP,guestbook,guest book,GuestBook,Guest Book\" />\n";
	echo "<meta name=\"Description\" content=\"KISGB is a robust, easy to use, and fully customizable PHP Guest Book!\" />\n";
	echo "<meta name=\"Author\" content=\"Gaylen Fraley\" />\n";
}

function entryErrorCheck($myArray) {
	global $invalid_email_msg, $badwords, $bad_language_msg, $label_back, $require_name, $require_email,$require_nation, $required_field_missing_msg, $field_size_error_msg, $max_smileys_allowed, $label_smiley_message, $max_name_length, $max_email_length, $max_nation_length, $max_comment_length, $label_comment,$path_to_images;
	$globalMsg = 'global ';
	for ($i=1;$i<17;$i++) {
		if ($i<16) $globalMsg .= '$col'.$i.', ';
		else $globalMsg .= '$col'.$i.'';
	}
	$globalMsg .= ';';
	eval($globalMsg);
	while (list ($key, $val) = each ($myArray)) {
		$val = trim($val);
		for ($i=0;$i<count($badwords);$i++) {
			$tmpval = strip_tags($val);
			if (strpos(strtolower($tmpval),strtolower($badwords[$i]))===false) {}
			else {
				?>
				<table align="center" border="2" width="50%" bgcolor="lightyellow">
				<tr><td align="center"><?=$bad_language_msg?><br /><font color="red"><b><?="$key = $val"?></b></font>
				<br />
				<br />
				<a href="javascript:history.go(-1)"><?=$label_back?></a>
				</td></tr>
				</table>
				<?
				include_once 'footer.php';
				exit;
			}
		}
		if (($key==$col5&&($require_name||!empty($val)))) {
			if (strlen($val)>$max_name_length) {
				$sub = str_replace('???',$max_name_length,$field_size_error_msg);
				?>
				<table align="center" border="2" width="50%" bgcolor="lightyellow">
				<tr><td align="center"><?=str_replace('\n',"<br />",nl2br($sub));?><br /><font color="red"><b><?="$key"?></b></font>
				<br />
				<br />
				<a href="javascript:history.go(-1)"><?=$label_back?></a>
				</td></tr>
				</table>
				<?
				if ($use_footer) include_once 'footer.php';
				exit;
			}
			if ($require_name&&(strlen($val)==0||substr($val,0,1)==" "||empty($val))) {
				?>
				<table align="center" border="2" width="50%" bgcolor="lightyellow">
				<tr><td align="center"><?=str_replace('\n',"<br />",nl2br($required_field_missing_msg));?><br /><font color="red"><b><?="$key = $val"?></b></font>
				<br />
				<br />
				<a href="javascript:history.go(-1)"><?=$label_back?></a>
				</td></tr>
				</table>
				<?
				if ($use_footer) include_once 'footer.php';
				exit;
			}
		}
		if (($key==$col6&&($require_email||!empty($val)))) {
			$re = "/^[^@\s]+@([-a-z0-9]+\.)+[a-z]{2,}$/i";
			if (!preg_match($re,$val)) {
				?>
				<table align="center" border="2" width="50%" bgcolor="lightyellow">
				<tr><td align="center"><?=str_replace('\n',"<br />",nl2br($invalid_email_msg));?><br /><font color="red"><b><?="$key = $val"?></b></font>
				<br />
				<br />
				<a href="javascript:history.go(-1)"><?=$label_back?></a>
				</td></tr>
				</table>
				<?
				if ($use_footer) include_once 'footer.php';
				exit;
			}
			if (strlen($val)>$max_email_length) {
				$sub = str_replace('???',$max_email_length,$field_size_error_msg);
				?>
				<table align="center" border="2" width="50%" bgcolor="lightyellow">
				<tr><td align="center"><?=str_replace('\n',"<br />",nl2br($sub));?><br /><font color="red"><b><?="$key"?></b></font>
				<br />
				<br />
				<a href="javascript:history.go(-1)"><?=$label_back?></a>
				</td></tr>
				</table>
				<?
				if ($use_footer) include_once 'footer.php';
				exit;
			}
			if (require_email&&(strlen($val)==0||substr($val,0,1)==" "||empty($val))) {
				?>
				<table align="center" border="2" width="50%" bgcolor="lightyellow">
				<tr><td align="center"><?=str_replace('\n',"<br />",nl2br($required_field_missing_msg));?><br /><font color="red"><b><?="$key = $val"?></b></font>
				<br />
				<br />
				<a href="javascript:history.go(-1)"><?=$label_back?></a>
				</td></tr>
				</table>
				<?
				if ($use_footer) include_once 'footer.php';
				exit;
			}
		}
		if (($key==$col13&&($require_nation||!empty($val)))) {
			if ($require_nation&&(strlen($val)==0||substr($val,0,1)==" "||$val=="blank.gif"||empty($val))) {
				?>
				<table align="center" border="2" width="50%" bgcolor="lightyellow">
				<tr><td align="center"><?=str_replace('\n',"<br />",nl2br($required_field_missing_msg));?><br /><font color="red"><b><?="$key = $val"?></b></font>
				<br />
				<br />
				<a href="javascript:history.go(-1)"><?=$label_back?></a>
				</td></tr>
				</table>
				<?
				if ($use_footer) include_once 'footer.php';
				exit;
			}
		}
		if ($key!=$col14) continue;
		if (!(strpos(strtolower($val),'<img')===FALSE&&strpos(strtolower($val),'&lt;img')===FALSE)) {
			$cnt_img = substr_count(strtolower($val),'&lt;img') + substr_count(strtolower($val),'<img');
			if ($cnt_img>$max_smileys_allowed) {
				$val = str_replace('smilies/',"$path_to_images/smilies/",$val);
				?>
				<table align="center" border="2" width="50%" bgcolor="lightyellow">
				<tr><td align="center"><?=$label_smiley_message?><br /><font color="red"><b><?="$key = $val"?></b></font>
				<br />
				<br />
				<a href="javascript:history.go(-1)"><?=$label_back?></a>
				</td></tr>
				</table>
				<?
				if ($use_footer) include_once 'footer.php';
				exit;
			}
		}
		if (strlen($val)>$max_comment_length) {
			?>
			<table align="center" border="2" width="50%" bgcolor="lightyellow">
			<tr><td align="center"><?=$label_comment;?>
			<br />
			<br />
			<a href="javascript:history.go(-1)"><?=$label_back?></a>
			</td></tr>
			</table>
			<?
			if ($use_footer) include_once 'footer.php';
			exit;
		}
		if (empty($val)||strlen($val)==0||substr($val,0,1)==" ") {
			?>
			<table align="center" border="2" width="50%" bgcolor="lightyellow">
			<tr><td align="center"><?=str_replace('\n',"<br />",nl2br($required_field_missing_msg));?><br /><font color="red"><b><?="$key = $val"?></b></font>
			<br />
			<br />
			<a href="javascript:history.go(-1)"><?=$label_back?></a>
			</td></tr>
			</table>
			<?
			if ($use_footer) include_once 'footer.php';
			exit;
		}
	}
}

function registerUser() {
	return;
	/*** 7/19/2002 ***/
	global $path_to_registry,$allow_registering,$password,$registry_msg,$label_back,$name,$label_register;
	if ($allow_registering) {
		if (file_exists($path_to_registry)) {
			$registry = file($path_to_registry);
			$registry = explode('%',$registry[0]);
			$registered = FALSE;
			for ($i=0;$i<count($registry);$i++) {
				$registryx = explode('=',$registry[$i]);
				if (strtolower("$registryx[0]") == strtolower("$name")&&"$registryx[1]"!="$password") {
				?>
					<table align="center" border="2" width="50%" bgcolor="lightyellow">
					<tr><td align="center"><?=$registry_msg?><br /><br />
					<a href="javascript:history.go(-1)"><?=$label_back?></a>
					</td></tr>
					</table>
				<?
				exit;
				}
				else if (strtolower("$registryx[0]") == strtolower("$name")) $registered = TRUE;
			}
/************* NOT YET DEVELOPED -- IN PROGRESS -- DO NOT USE *************
			if (!$registered) { $label_register = "Register";
				?>
					<table align="center" border="2" width="50%" bgcolor="lightyellow">
					<tr><td align="center">This user name is not yet registered.  Would you like to register this name and all information?  Registering a name allows your information to be stored and you will not have to re-enter it on each visit. If you select the <?=$label_register?> link below, the information that you entered on the previous page will be added to the guestbook AND the information will be stored for usage on your next visits.<br /><br />
					<a href="register_user.php"><?=$label_register?></a>&nbsp;&nbsp;&nbsp;<a href="javascript:history.go(-1)"><?=$label_back?></a>
					</td></tr>
					</table>
				<?
				exit;
			}
************* NOT YET DEVELOPED -- IN PROGRESS -- DO NOT USE ************/
		}
	}
}

function BBCODE($Text) {
	global $quoteBoxStyle;
/**
	//the bbcode tags..
	$bbc_a=array("[str]","[/str]","[b]","[/b]","[u]","[/u]","[big]","[/big]","[huge]","[/huge]","[email]","[/email]","[url]","[/url]","[red]","[/red]","[orange]","[/orange]","[green]","[/green]","[blue]","[/blue]","[quote]","[/quote]","[code]","[/code]","[img]","[/img]");

	//bbcode gets converted to..
	$bbc_b=array("<strike>","</strike>","<b>","</b>","<u>","</u>","<font size=4>","</font>","<font size=8>","</font>","<a href=\"mailto:","\">E-Mail Link</a>","<a href=\"http://","\" target=\"blank\">Web Link</a>","<font color=#ff0000>","</font>","<font color=#ffaa66>","</font>","<font color=#66ff66>","</font>","<font color=#6666ff>","</font>","<blockquote style=\"border:$quoteBoxStyle;\">","</blockquote>","<code>","</code>","<img>","</img>");

	$bbc_num=count($bbc_a);
	$loop=0;
	while($loop<$bbc_num) {
		if (FALSE!==strpos($bbcode,'[url]')) {
			$urlstart = strpos($bbcode,'[url]');
			$urlchk = 1;
		}
		$bbcode=str_replace($bbc_a[$loop], $bbc_b[$loop], $bbcode);
		if ($urlchk) {
			$bbcode = str_replace('http://http://','http://',$bbcode);
			for ($i=$urlstart;$i<strlen($bbcode);$i++) {
				$start = strpos($bbcode,'http://',$i);
				$start = $start+7;
				$stop  = strpos($bbcode,'" tar');
				$link  = substr($bbcode,$start,$stop-$start);
				$bbcode = str_replace('Web Link',$link,$bbcode);
				if ($stop>=$i) break;
				$i=$stop-1;
			}
		}
		$loop++;
	}
	return $bbcode;
**/
            // Set up the parameters for a URL search string
            $URLSearchString = " a-zA-Z0-9\:\/\-\?\&\.\=\_\~\#\'";
            // Set up the parameters for a MAIL search string
            $MAILSearchString = $URLSearchString . " a-zA-Z0-9\.@";

            // Perform URL Search
            $Text = preg_replace("/\[url\]([$URLSearchString]*)\[\/url\]/", '<a href="$1" target="_blank">$1</a>', $Text);
            $Text = preg_replace("(\[url\=([$URLSearchString]*)\]([$URLSearchString]*)\[/url\])", '<a href="$1" target="_blank">$2</a>', $Text);

            // Perform MAIL Search
            $Text = preg_replace("(\[mail\]([$MAILSearchString]*)\[/mail\])", '<a href="mailto:$1">$1</a>', $Text);
            $Text = preg_replace("/\[mail\=([$MAILSearchString]*)\](.+?)\[\/mail\]/", '<a href="mailto:$1">$2</a>', $Text);

            // Check for bold text
            $Text = preg_replace("(\[b\](.+?)\[\/b])is",'<span class="bold">$1</span>',$Text);

            // Check for quote text
//            $Text = preg_replace("(\[quote\](.+?)\[\/quote])is",'<blockquote style="border:'.$quoteBoxStyle.';">$1</blockquote>',$Text);

            // Check for Italics text
            $Text = preg_replace("(\[i\](.+?)\[\/i\])is",'<span class="italics">$1</span>',$Text);

            // Check for Underline text
            $Text = preg_replace("(\[u\](.+?)\[\/u\])is",'<span class="underline">$1</span>',$Text);

            // Check for strike-through text
            $Text = preg_replace("(\[s\](.+?)\[\/s\])is",'<span class="strikethrough">$1</span>',$Text);

            // Check for over-line text
            $Text = preg_replace("(\[o\](.+?)\[\/o\])is",'<span class="overline">$1</span>',$Text);

            // Check for colored text
            $Text = preg_replace("(\[color=(.+?)\](.+?)\[\/color\])is","<span style=\"color: $1\">$2</span>",$Text);

            // Check for sized text
            $Text = preg_replace("(\[size=(.+?)\](.+?)\[\/size\])is","<span style=\"font-size: $1px\">$2</span>",$Text);

            // Check for list text
            $Text = preg_replace("/\[list\](.+?)\[\/list\]/is", '<ul class="listbullet">$1</ul>' ,$Text);
            $Text = preg_replace("/\[list=1\](.+?)\[\/list\]/is", '<ul class="listdecimal">$1</ul>' ,$Text);
            $Text = preg_replace("/\[list=i\](.+?)\[\/list\]/s", '<ul class="listlowerroman">$1</ul>' ,$Text);
            $Text = preg_replace("/\[list=I\](.+?)\[\/list\]/s", '<ul class="listupperroman">$1</ul>' ,$Text);
            $Text = preg_replace("/\[list=a\](.+?)\[\/list\]/s", '<ul class="listloweralpha">$1</ul>' ,$Text);
            $Text = preg_replace("/\[list=A\](.+?)\[\/list\]/s", '<ul class="listupperalpha">$1</ul>' ,$Text);
            $Text = str_replace("[*]", "<li>", $Text);

            // Check for font change text
            $Text = preg_replace("(\[font=(.+?)\](.+?)\[\/font\])","<span style=\"font-family: $1;\">$2</span>",$Text);

            // Check for [code] text
            $Text = preg_replace("/\[code\](.+?)\[\/code\]/is","$codebody", $Text);

            // Images
            // [img]pathtoimage[/img]
            $Text = preg_replace("/\[img\](.+?)\[\/img\]/", '<img src="$1">', $Text);
            // [img=widthxheight]image source[/img]
            $Text = preg_replace("/\[img\=([0-9]*)x([0-9]*)\](.+?)\[\/img\]/", '<img src="$3" height="$2" width="$1">', $Text);

	$bbc_a=array("[str]","[/str]","[b]","[/b]","[u]","[/u]","[big]","[/big]","[huge]","[/huge]","[email]","[/email]","[url]","[/url]","[red]","[/red]","[orange]","[/orange]","[green]","[/green]","[blue]","[/blue]","[quote]","[/quote]","[code]","[/code]","[img]","[/img]");

	$bbc_b=array("<strike>","</strike>","<b>","</b>","<u>","</u>","<font size=4>","</font>","<font size=8>","</font>","<a href=\"mailto:","\">E-Mail Link</a>","<a href=\"http://","\" target=\"blank\">Web Link</a>","<font color=#ff0000>","</font>","<font color=#ffaa66>","</font>","<font color=#66ff66>","</font>","<font color=#6666ff>","</font>","<blockquote style=\"border:$quoteBoxStyle;\">","</blockquote>","<code>","</code>","<img>","</img>");

	$bbc_num=count($bbc_a);
	$loop=0;
	while($loop<$bbc_num) {
		$Text=str_replace($bbc_a[$loop], $bbc_b[$loop], $Text);
		$loop++;
	}

	return $Text;
}

function dateShift($date) {
	global $moderateEntries;
	$dateS[0] = 1;
	$dateS[1] = 0;
	if (strlen($date)>10) {
		$dateS[0] = substr($date,0,1);
		if ($dateS[0]) $dateS[1] = 10000000000;
		else $dateS[1] = 0;
	}
	if (!$moderateEntries) $dateS[0]=1;
	return $dateS;
}
?>
Return current item: KISGB (Keep It Simple Guest Book)