Location: PHPKode > projects > Admbook > admin/edit.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("../settings-data.php");
	include("../lib.php");
	checkPermissions($login, $password);
	if (file_exists("../content-data.php"))
		include("../content-data.php");
	if (!isset($error))
		$error = "";
	if (!isset($style))
		$style = "";
	if (!isset($id))
		$id = "";
	if (!isset($content[$id-1]))
	{
		session_destroy();
		Header("Location: login.php");exit;
	}
	$currentContent = $content[$id-1];
	$currentContent['message'] = br2nl($currentContent['message']);
	$currentContent['admin-message'] = br2nl($currentContent['admin-message']);
?>
<html>
<head>
<title>admbook :: version <?=$constant['version']?></title>
<?php
	if ($constant['charset'] != "")
	{
?>
<meta http-equiv="Content-Type" content="text/html; charset=<?=$constant['charset']?>"/>
<?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 : 490px;
}

input.halfbutton {
	width : 245px;
}

textarea {
	width : 490px;
}

.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>
	<form action="update.php" method="post">
	<input type="hidden" name="page" value="<?=$page?>"/>
	<input type="hidden" name="id" value="<?=$id?>"/>
	<td valign="top">
		<table width="100%" 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="100%" 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"><b>Edit message</b></td>
				</tr>
				</table>
			</td>
		</tr>
		</table>
		<br/>
		<div align="right">
		<table border="0" cellpadding="2" cellspacing="0">
<?php
	if ($error != "")
	{
?>
		<tr>
			<td colspan="5" class="text">
				<b>Detect following errors:</b><br/>
				<span id="error"><?=$error?></span><br/>
			</td>
		</tr>
<?php
		session_unregister("error");
		session_unregister("style");
	}
?>
		<tr>
			<td align="center"><img src="../img/ip.gif" width="18" height="11" border="0" alt="Ip"/></td>
			<td><img src="../img/sp.gif" width="5" height="1"/></td>
			<td class="text">Ip:</td>
			<td><img src="../img/sp.gif" width="5" height="1"/></td>
			<td class="text"><a href="ip-ban-add.php?ip=<?=$currentContent['ip']?>" class="link"><?=$currentContent['ip']?></a></td>
		</tr>
		<tr>
			<td align="center"><img src="../img/ip.gif" width="18" height="11" border="0" alt="Host"/></td>
			<td><img src="../img/sp.gif" width="5" height="1"/></td>
			<td class="text">Host:</td>
			<td><img src="../img/sp.gif" width="5" height="1"/></td>
			<td class="text"><?=$currentContent['host']?></td>
		</tr>
<?php
	if ($currentContent['proxy'] != "")
	{
?>
		<tr>
			<td align="center"><img src="../img/ip.gif" width="18" height="11" border="0" alt="Proxy"/></td>
			<td><img src="../img/sp.gif" width="5" height="1"/></td>
			<td class="text">Proxy:</td>
			<td><img src="../img/sp.gif" width="5" height="1"/></td>
			<td class="text"><a href="ip-ban-add.php?ip=<?=$currentContent['proxy']?>" class="link"><?=$currentContent['proxy']?></a></td>
		</tr>
<?php
	}
?>
		<tr>
			<td align="center"><img src="../img/name.gif" width="11" height="14" border="0" alt="Admin 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 { print $currentContent['name']; } ?>" maxlength="30" 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="128" value="<?php if (isset($url)) { print stripslashes($url); session_unregister("url"); } else { print $currentContent['url']; } ?>" 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 { print $currentContent['mail']; } ?>" maxlength="128" class="field"/></td>
		</tr>
		<tr>
			<td align="center"><img src="../img/icq.gif" width="16" height="16" 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 { print $currentContent['icq']; } ?>" maxlength="25" class="field"/></td>
		</tr>
		<tr>
			<td align="center"><img src="../img/date.gif" width="17" height="18" border="0" alt="Date and Time"/></td>
			<td><img src="../img/sp.gif" width="1" height="1"/></td>
			<td class="text">Date:</td>
			<td><img src="../img/sp.gif" width="1" height="1"/></td>
			<td class="text"> [<?=getFullDate($currentContent['time'], $constant['locale']).", ".getTime($currentContent['time'])?>]</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"); } else { $p = ""; $constant['bold-in-message'] ? $p .= "<b>" : $p .= ""; $constant['italic-in-message'] ? $p .= "<i>" : $p .= ""; print strip_tags(stripslashes(br2nl($currentContent['message'])),$p); } ?></textarea></td>
		</tr>
<?php
	if ($currentContent['admin-name'] != "")
	{
?>
		<tr>
			<td align="center"><img src="../img/name.gif" width="11" height="14" border="0" alt="Admin name"/></td>
			<td><img src="../img/sp.gif" width="5" height="1"/></td>
			<td class="text"><span class="adminname">Admin name:</span></td>
			<td><img src="../img/sp.gif" width="5" height="1"/></td>
			<td><input type="text" size="26" name="admName" value="<?php if (isset($admName)) { print stripslashes($admName); session_unregister("admName"); } else { print $currentContent['admin-name']; } ?>" maxlength="50" class="field"/></td>
		</tr>
		<tr>
			<td align="center"><img src="../img/mail.gif" width="18" height="15" border="0" alt="Admin e-mail"/></td>
			<td><img src="../img/sp.gif" width="5" height="1"/></td>
			<td class="text"><span class="adminmail">Admin e-mail:</span></td>
			<td><img src="../img/sp.gif" width="5" height="1"/></td>
			<td><input type="text" size="26" name="admMail" value="<?php if (isset($admMail)) { print stripslashes($admMail); session_unregister("admMail"); } else { if (isset($currentContent['admin-mail']) && $currentContent['admin-mail'] != "" )  print $currentContent['admin-mail']; } ?>" maxlength="128" class="field"/></td>
		</tr>
		<tr>
			<td align="center"><img src="../img/message.gif" width="15" height="18" border="0" alt="Admin message"/></td>
			<td><img src="../img/sp.gif" width="1" height="1"/></td>
			<td colspan="3" class="text"><span class="adminmessage">Admin message:</span></td>
		</tr>
		<tr>
			<td colspan="5" align="right"><textarea name="admMessage" rows="15" cols="35" wrap="virtual"><?php if (isset($admMessage)) {  $p = ""; $constant['bold-in-message'] ? $p .= "<b>" : $p .= ""; $constant['italic-in-message'] ? $p .= "<i>" : $p .= ""; print strip_tags(stripslashes(br2nl($admMessage)),$p); session_unregister("admMessage"); } else { $p = ""; $constant['bold-in-message'] ? $p .= "<b>" : $p .= ""; $constant['italic-in-message'] ? $p .= "<i>" : $p .= ""; print strip_tags(stripslashes(br2nl($currentContent['admin-message'])),$p); } ?></textarea>
		</tr>
		<tr>
			<td align="center"><img src="../img/date.gif" width="17" height="18" border="0" alt="Date and Time"/></td>
			<td><img src="../img/sp.gif" width="1" height="1"/></td>
			<td class="text">Date:</td>
			<td><img src="../img/sp.gif" width="1" height="1"/></td>
			<td class="text"> [<?=getFullDate($currentContent['admin-time'], $constant['locale']).", ".getTime($currentContent['admin-time'])?>]</td>
		</tr>
		<tr>
			<td colspan="5" height="10"><spacer width="1" height="10" type="block"></td>
		</tr>
<?php
	}
?>
		<tr>
			<td colspan="5" align="right">
				<input type="submit" value="update" class="button"/><br/>
				<input type="button" value="back" class="halfbutton" onClick="javascript:window.location.href='index.php?page=<?=$page?>'"/><input type="button" value="logout" class="halfbutton" onClick="javascript:window.location.href='logout.php'"/>
			</td>
		</tr>
		</table>
	</td>
	</form>
<?
	$timer->stop();
?>
</tr>
<tr>
	<td valign="bottom" align="right" height="1" class="text">
		<br/>
		<table width="100%" border="0" cellpadding="0" cellspacing="0">
		<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>
<!-- generation time <?=$timer->elapsed()." sec";?> -->
</body>
</html>
Return current item: Admbook