Location: PHPKode > projects > Admbook > index.php
<?php
	class Timer {
		var $startTime;
		var $endTime;
		function start() {
			$this->startTime = gettimeofday();
		}
		function stop() {
			$this->endTime = gettimeofday();
		}
		function elapsed() {
			return (($this->endTime["sec"] - $this->startTime["sec"]) * 1000000 + ($this->endTime["usec"] - $this->startTime["usec"])) / 1000000;
		}
	}
	$timer = new Timer();
	$timer->start();
	session_start();
	include("lib.php");
	include("settings-data.php");
	if (file_exists("content-data.php"))
		include("content-data.php");
	else
		createFile("content-data.php");
	include("useragent.php");
	$userAgent = @$ENV['HTTP_USER_AGENT'];
	$browser = getBrowser($arrBrowser,$userAgent);
	$system = getSystem($arrSystem,$userAgent);
	$formatedMailBody = "Browser: ".$browser['browser']." ".$browser['version']."\nSystem Os: ".$system."\nUser Agent: ".$userAgent;
	if (!isset($content))
		$content[0]['ip'] = "";
	$contentCnt = sizeof($content);
	$errMessage = "";
	if (!isset($userId))
		$userId = "";
	if (!isset($error))
		$error = "";
	if (!isset($style))
		$style = "";
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>admbook :: version <?=$constant['version']?></title>
<?php
	if ($constant['charset'] != "")
	{
?>
<meta http-equiv="Content-Type" content="text/html; charset=<?=$constant['charset']?>"/>
<?php
	}
?>
<script language="JavaScript" src="script.js" type="text/javascript"></script>
<?php
	if($constant['smile-in-message'])
	{
?>		
<script language="JavaScript" type="text/javascript">
<!--
	function setSmile(str)
	{
		obj = document.guestbook.message;
		obj.focus();
		obj.value =	obj.value + str;
	}
//-->
</script>
<?php
	}
?>
<link href="style.css" type="text/css" rel="stylesheet"/>
<style type="text/css">
<!--
input.field {
	width : 370px
}

#error {
	color : <?=$constant['error-color']?>
}

input.button {
	width : 450px;
}

textarea {
	width : 450px;
}

.text {
	font : 8pt "Verdana","Arial Cyr", "Arial","Tahoma","Helvetica", sans-serif;
	color : <?=$constant['text-color']?>
}

.link {
	font : 8pt "Verdana","Arial Cyr", "Arial","Tahoma","Helvetica", sans-serif;
	color : <?=$constant['link-color']?>
}

.messagetext {
	font : 8pt "Verdana","Arial Cyr", "Arial","Tahoma","Helvetica", sans-serif;
	color : <?=$constant['message-text-color']?>
}

.messagelink {
	font : 8pt "Verdana","Arial Cyr", "Arial","Tahoma","Helvetica", sans-serif;
	color : <?=$constant['message-link-color']?>
}

.admintext {
	font : 8pt "Verdana","Arial Cyr", "Arial","Tahoma","Helvetica", sans-serif;
	color : <?=$constant['admin-message-text-color']?>
}

.adminlink {
	font : 8pt "Verdana","Arial Cyr", "Arial","Tahoma","Helvetica", sans-serif;
	color : <?=$constant['admin-message-link-color']?>
}

.headertext {
	font : 8pt "Verdana","Arial Cyr", "Arial","Tahoma","Helvetica", sans-serif;
	color : <?=$constant['header-text-color']?>
}

.headerlink {
	font : 8pt "Verdana","Arial Cyr", "Arial","Tahoma","Helvetica", sans-serif;
	color : <?=$constant['header-link-color']?>
}

<?=$style?>
-->
</style>
</head>
<body bgcolor="<?=$constant['background-color']?>" text="<?=$constant['text-color']?>" link="<?=$constant['link-color']?>" vlink="<?=$constant['link-color']?>" alink="<?=$constant['link-color']?>" leftmargin="0" marginwidth="0" topmargin="0" marginheight="0">
<table width="760" border="0" cellpadding="0" cellspacing="0" align="center" height="100%">
<tr>
	<td valign="top" class="text">
		<table width="760" border="0" cellpadding="0" cellspacing="0">
		<tr>
			<td bgcolor="<?=$constant['border-color']?>">
				<table width="100%" border="0" cellpadding="2" cellspacing="1">
				<tr>
					<td bgcolor="<?=$constant['header-background-color']?>" class="headertext" id="book-title">Admbook versi0n <?=$constant['version']?></td>
				</tr>
				</table>
			</td>
		</tr>
		</table>
		<br/>
		<table width="760" border="0" cellpadding="0" cellspacing="0">
		<tr>
			<td bgcolor="<?=$constant['border-color']?>">
				<table width="100%" border="0" cellpadding="2" cellspacing="1">
				<tr>
					<td bgcolor="<?=$constant['header-background-color']?>" class="headertext" align="center" width="50%"><a href="index.php#post"><b>Send message</b></a></td>
				</tr>
				</table>
			</td>
		</tr>
		</table>
		<br/>
<?php
	$pageLine = pagesNumber($contentCnt, $constant['messages-to-page'], $page, "index.php", $constant['page-in-line'], "page: ", "total: ");
	if ($pageLine != "")
	{
?>
		<table width="760" border="0" cellpadding="0" cellspacing="0">
		<tr>
			<td bgcolor="<?=$constant['border-color']?>">
				<table width="100%" border="0" cellpadding="2" cellspacing="1">
				<tr>
					<td class="headertext" bgcolor="<?=$constant['header-background-color']?>"><?=$pageLine?></td>
				</tr>
				</table>
			</td>
		</tr>
		</table>
		<br/>
<?php
	}
?>
<?php
	$currentContent = outputPageContent($content, $page, $constant['messages-to-page']);
	for ($i = 0; $i < sizeof($currentContent); $i++)
	{
		if (isset($currentContent[$i]['ip']) && $currentContent[$i]['ip'] != "")
		{
?>
		<table width="760" border="0" cellpadding="0" cellspacing="0">
		<tr>
			<td bgcolor="<?=$constant['border-color']?>">
				<table width="100%" border="0" cellpadding="0" cellspacing="1">
				<tr>
					<td>
						<table width="100%" border="0" cellpadding="2" cellspacing="0" bgcolor="<?=$constant['message-background-color']?>">
<?php
			// name and email as link >>
			if ($currentContent[$i]['name'] != "")
			{
?>						<tr>
							<td width="1%" align="center"><img src="img/name.gif" width="11" height="14" border="0" alt="Name"/></td>
							<td class="messagetext"><?php 
							if ($currentContent[$i]['mail'] != "") {
								print '<a href="mailto:'.$currentContent[$i]['mail'].'">'.censoredData($currentContent[$i]['name']).'</a>';
							}
							else {
								print censoredData($currentContent[$i]['name']);
							}
							$check['status'] = false;
							$check['id'] = -1;
							$check = checkPublishName($currentContent[$i]['name'], "");
							if(!$check['status'])
								print ' [<a href="javascript:info(\'user-info.php?id='.$check['id'].'\',450,250)">info</a>]';
							?></td>
						</tr>
<?php
			}
			// name and email as link <<
			// url >>
			if ($currentContent[$i]['url'] != "")
			{
?>						<tr>
							<td align="center"><img src="img/url.gif" width="18" height="18" border="0" alt="Url"/></td>
							<td class="messagetext"><a href="<?=$currentContent[$i]['url']?>"><?=censoredData($currentContent[$i]['url'])?></a></td>
						</tr>
<?php
		}
			// url <<
			// icq >>
			if ($currentContent[$i]['icq'] != "")
			{
?>						<tr>
							<td><img src="http://online.mirabilis.com/scripts/online.dll?icq=<?=$currentContent[$i]['icq']?>&img=5" width="18" height="18" alt="User status"/></td>
							<td><a href="http://web.icq.com/whitepages/message_me/1,,,00.icq?uin=<?=$currentContent[$i]['icq']?>&action=message" class="messagelink"><?=$currentContent[$i]['icq']?></a></td>
						</tr>
<?php
			}
			// icq <<
			// date and time >>
			if ($currentContent[$i]['time'] != "")
			{
?>						<tr>
							<td align="center"><img src="img/date.gif" width="17" height="18" border="0" alt="Date and Time"/></td>
							<td class="messagetext">[<?=getFullDate($currentContent[$i]['time'], $constant['locale']).", ".getTime($currentContent[$i]['time'])?>]</td>
						</tr>
						<tr>
							<td><img src="img/sp.gif" width="1" height="1" border="0"/></td>
							<td><hr size="1" color="<?=$constant['border-color']?>"/></td>
						</tr>
<?php
			}
			// date and time <<
			// message >>
			if ($currentContent[$i]['message'] != "")
			{
?>						<tr>
							<td><img src="img/sp.gif" width="18" height="20" border="0"/></td>
							<td class="messagetext" valign="top"><?=convertSmile(censoredData($currentContent[$i]['message']));?></td>
						</tr>
<?php
			}
			// message <<
			if ($currentContent[$i]['admin-name'] != "")
			{
?>						</table>
					</td>
				</tr>
				<tr>
					<td>
						<table width="100%" border="0" cellpadding="2" cellspacing="0" bgcolor="<?=$constant['admin-message-background-color']?>">
<?php
			}
			// admin name >>
			if ($currentContent[$i]['admin-name'] != "")
			{
?>						<tr>
							<td width="1%" align="center"><img src="img/admin-name.gif" width="11" height="14" border="0" alt="Admin name"/></td>
							<td class="admintext" valign="bottom"><?php
							if (isset($currentContent[$i]['admin-mail']) && $currentContent[$i]['admin-mail'] != "")
								print '<a href="mailto:'.$currentContent[$i]['admin-mail'].'"><b>'.$currentContent[$i]['admin-name'].'</b></a>';
							else
								print "<b>".$currentContent[$i]['admin-name']."</b>";
							$check['status'] = false;
							$check['id'] = -1;
							$check = checkPublishName($currentContent[$i]['admin-name'], "");
							if(!$check['status'])
								print ' [<a href="javascript:info(\'user-info.php?id='.$check['id'].'\',450,250)">info</a>]';
							?></td>
						</tr>
<?php
			}
			// admin name <<
			// admin date and time >>
			if ($currentContent[$i]['admin-time'] != "")
			{
?>						<tr>
							<td align="center"><img src="img/date.gif" width="17" height="18" border="0" alt="Date and Time"/></td>
							<td class="admintext">[<?=getFullDate($currentContent[$i]['admin-time'], $constant['locale']).", ".getTime($currentContent[$i]['admin-time'])?>]</td>
						</tr>
						<tr>
							<td><img src="img/sp.gif" width="1" height="1" border="0"/></td>
							<td><hr size="1" color="<?=$constant['border-color']?>"/></td>
						</tr>
<?php
			}
			//admin date and time <<
			// admin message >>
			if ($currentContent[$i]['admin-message'] != "")
			{
?>						<tr>
							<td><img src="img/sp.gif" width="18" height="20" border="0"/></td>
							<td class="admintext" valign="top"><?=convertSmile($currentContent[$i]['admin-message'])?></td>
						</tr>
<?php
			}
			// admin message <<
?>
						</table>
					</td>
				</tr>
				</table>
			</td>
		</tr>
		</table>
		<br/>
<?php
		}
	}
	if ($pageLine != "")
	{
?>
		<table width="760" border="0" cellpadding="0" cellspacing="0">
		<tr>
			<td bgcolor="<?=$constant['border-color']?>">
				<table width="100%" border="0" cellpadding="2" cellspacing="1">
				<tr>
					<td class="headertext" bgcolor="<?=$constant['header-background-color']?>"><?=$pageLine?></td>
				</tr>
				</table>
			</td>
		</tr>
		</table>
		<br/>
<?php
	}
?>
		<div align="right" style="width:760px">
		<a name="post">&nbsp;</a>
		<table border="0" cellpadding="2" cellspacing="0">
		<form action="write.php" method="post" name="guestbook">
		<input type="hidden" name="page" value="<?=$page?>"/>
<?php
		if ($error != "")
		{
?>
		<tr>
			<td colspan="5" class="text">
				<b>Detect following errors:</b><br/>
				<span id="error"><?=$error?></span>
				</div>
				<br/>
			</td>
		</tr>
<?php
			session_unregister("error");
			session_unregister("style");
		}
?>
		<tr>
			<td align="center"><img src="img/name.gif" width="11" height="14" border="0" alt="Name"/></td>
			<td><img src="img/sp.gif" width="5" height="1"/></td>
			<td class="text"><span class="name">Name: </span></td>
			<td><img src="img/sp.gif" width="5" height="1"/></td>
			<td><input type="text" size="26" name="name" value="<?php if (isset($name)) { print stripslashes($name); session_unregister("name"); } else { if(isset($cookie['name'])) print stripslashes($cookie['name']); } ?>" maxlength="50" class="field"/></td>
		</tr>
		<tr>
			<td align="center"><img src="img/url.gif" width="18" height="18" border="0" alt="Url"/></td>
			<td><img src="img/sp.gif" width="1" height="1"/></td>
			<td class="text"><span class="url">Url: </span></td>
			<td><img src="img/sp.gif" width="1" height="1"/></td>
			<td><input type="text" size="26" name="url" maxlength="50" value="<?php if (isset($url)) { print stripslashes($url); session_unregister("url"); } else { if(isset($cookie['url'])) print stripslashes($cookie['url']); else print "http://"; } ?>" class="field"/></td>
		</tr>
		<tr>
			<td align="center"><img src="img/mail.gif" width="18" height="15" border="0" alt="e-mail"/></td>
			<td><img src="img/sp.gif" width="1" height="1"/></td>
			<td class="text"><span class="email">E-mail: </span></td>
			<td><img src="img/sp.gif" width="1" height="1"/></td>
			<td><input type="text" size="26" name="email" value="<?php if (isset($email)) { print stripslashes($email); session_unregister("email"); } else { if(isset($cookie['mail'])) print stripslashes($cookie['mail']); } ?>" maxlength="50" class="field"/></td>
		</tr>
		<tr>
			<td align="center"><img src="img/icq.gif" width="17" height="18" border="0" alt="Icq"/></td>
			<td><img src="img/sp.gif" width="1" height="1"/></td>
			<td class="text"><span class="icq">Icq: </span></td>
			<td><img src="img/sp.gif" width="1" height="1"/></td>
			<td><input type="text" size="26" name="icq" value="<?php if (isset($icq)) { print stripslashes($icq); session_unregister("icq"); } else { if(isset($cookie['icq'])) print stripslashes($cookie['icq']); } ?>" maxlength="25" class="field"/></td>
		</tr>
		<tr>
			<td align="center"><img src="img/message.gif" width="15" height="18" border="0" alt="Message"/></td>
			<td><img src="img/sp.gif" width="1" height="1"/></td>
			<td colspan="3" class="text"><span class="message">Message:</span></td>
		</tr>
		<tr>
			<td colspan="5" align="right"><textarea name="message" rows="15" cols="35" wrap="virtual"><?php if (isset($message)) { $p = ""; $constant['bold-in-message'] ? $p .= "<b>" : $p .= ""; $constant['italic-in-message'] ? $p .= "<i>" : $p .= ""; print strip_tags(stripslashes(br2nl($message)),$p); session_unregister("message"); } ?></textarea></td>
		</tr>
		<tr>
			<td colspan="5" align="right"><input type="submit" value="send" class="button"/></td>
		</tr>
<?php
		if($constant['smile-in-message'])
		{
?>		
		<tr>
			<td colspan="5" align="right">
				<a href="javascript:setSmile(' :) ')"><img src="img/smile.gif" width="15" height="15" border="0"/></a>
				<a href="javascript:setSmile(' ;) ')"><img src="img/wink.gif" width="15" height="15" border="0"/></a>
				<a href="javascript:setSmile(' 8) ')"><img src="img/cool.gif" width="15" height="15" border="0"/></a>
				<a href="javascript:setSmile(' :J ')"><img src="img/curve-smile.gif" width="15" height="15" border="0"/></a>
				<a href="javascript:setSmile(' :P ')"><img src="img/tongue.gif" width="15" height="15" border="0"/></a>
				<a href="javascript:setSmile(' :D ')"><img src="img/biggrin.gif" width="15" height="15" border="0"/></a>
				<a href="javascript:setSmile(' :( ')"><img src="img/frown.gif" width="15" height="15" border="0"/></a>
				<a href="javascript:setSmile(' :o ')"><img src="img/astonish.gif" width="15" height="15" border="0"/></a>
				<a href="javascript:setSmile(' %) ')"><img src="img/crazy.gif" width="15" height="15" border="0"/></a>
				<a href="javascript:setSmile(' :[] ')"><img src="img/fright.gif" width="15" height="15" border="0"/></a>
				<a href="javascript:setSmile(' :smoke: ')"><img src="img/smoke.gif" width="21" height="20" border="0"/></a>				
				<a href="javascript:setSmile(' :evil: ')"><img src="img/evil.gif" width="15" height="15" border="0"/></a>
				<a href="javascript:setSmile(' :apple: ')"><img src="img/apple.gif" width="15" height="15" border="0"/></a>
				<a href="javascript:setSmile(' :moo: ')"><img src="img/moo.gif" width="16" height="16" border="0"/></a>
			</td>
		</tr>
<?php
		}
		$timer->stop();
?>
		</form>
		<tr>
			<td colspan="5" class="text" align="right">
				<br/>
				<div><a href="admin/index.php?page=<?=$page?>" class="link">administration</a></div>
<?php
		if(session_is_registered("login"))
		{
?>
				<div><a href="user-logout.php?page=<?=$page?>" class="link">logout admin</a></div>
<?php
		}
		if(session_is_registered("userId"))
		{
?>
				<div><a href="user-logout.php?page=<?=$page?>" class="link">logout user</a></div>
				<div><a href="user-edit.php?id=<?=$userId?>&page=<?=$page?>" class="link">edit user profile</a></div>
<?php
		}
		else
		{
?>
				<div><a href="user-registration.php" class="link">optional registration</a></div>
				<div><a href="user-login.php?page=<?=$page?>" class="link">authorization user</a></div>
<?php
		}
?>
				<br/>
				<div><a href="http://www.low.ru/dev/guestbook/" class="link" target="_top">download sources</a></div>
				<div><a href="readme-ru.html" class="link"><b>read this help (ru)</b></a></div>
				<div><a href="readme-en.html" class="link"><b>read this help (en)</b></a></div>
				<div><a href="http://faq.saterenko.ru/" class="link" target="_top"><b>read this faq (ru)</b></a></div>
			</td>
		</tr>
		</table>
		</div>
		<br/>
	</td>
</tr>
<tr>
	<td valign="bottom" height="1">
		<table width="760" border="0" cellpadding="0" cellspacing="0">
		<tr>
			<td bgcolor="<?=$constant['border-color']?>">
				<table width="760" border="0" cellpadding="2" cellspacing="1">
				<tr>
					<td width="50%" bgcolor="<?=$constant['header-background-color']?>" class="headertext" align="center"><span class="text">&copy;&nbsp;</span>trent&nbsp;<a href="http://www.low.ru/dev/guestbook/" class="text" target="_top">Download this guestbook</a>&nbsp;</td>
					<td width="50%" bgcolor="<?=$constant['header-background-color']?>" class="headertext" align="center"><span class="text">&nbsp;&nbsp;&nbsp;</span><a href="http://www.mylov.ru" onclick="location.href='http://partner.mylov.ru/link.phtml?pid=10359084&lid=553';return false;" class="link" target="_top">Çíàêîìñòâà è îáùåíèå</a>&nbsp;</td>
				</tr>
				</table>
			</td>
		</tr>
		</table>
	</td>
</tr>
</table>
</body>
<!-- generation time <?=$timer->elapsed()." sec";?> -->
</html>
Return current item: Admbook