Location: PHPKode > projects > Admbook > admin/ip-ban.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);
	include("../banned-ip-data.php");
	if (!isset($error))
		$error = "";
	if (!isset($style))
		$style = "";
	if (!isset($banned))
		$banned = null;
	$contentCnt = sizeof($banned);
	$messageToPage = "50";
	$inverse = true;
?>
<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>
<link href="../style.css" type="text/css" rel="stylesheet"/>
<style type="text/css">
<!--
#error {
	color : <?=$constant['error-color']?>
}

.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" height="1%">
		<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>Ip banlist</b></td>
				</tr>
				</table>
			</td>
		</tr>
		</table>
		<br/>
<?php
	$pageLine = pagesNumber($contentCnt, $messageToPage, $page, "ip-ban.php", $constant['page-in-line'], "page: ", "total: ", "headerlink");
	if ($pageLine != "")
	{
?>		<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"><?=$pageLine?></td>
				</tr>
				</table>
			</td>
		</tr>
		</table>
<?php
	}
	if ($contentCnt > 0)
	{
?>
		<form action="ip-ban-del.php" method="get">
		<input type="hidden" name="page" value="<?=$page?>"/>
		<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 bgcolor="<?=$inverse ? $constant['admin-message-background-color'] : $constant['message-background-color']?>">
					<td width="1%" class="text">&nbsp;</td>
					<td class="text"><b>&nbsp;&nbsp;ip or proxy</b></td>
				</tr>
<?
		$z = $page*$messageToPage - ($messageToPage-1);
		$currentContent = outputPageContent($banned,$page,$messageToPage);
		for ($i = 0; $i < sizeof($currentContent); $i++)
		{
			if ($inverse)
				$inverse = false;
			else
				$inverse = true;
?>
				<tr bgcolor="<?=$inverse ? $constant['admin-message-background-color'] : $constant['message-background-color']?>">
					<td><input type="checkbox" name="id[]" value="<?=$z;?>"/></td>
					<td class="text">&nbsp;&nbsp;<a href="ip-ban-del.php?id=<?=$z?>" class="<?=$inverse ? "adminlink" : "messagelink"?>"><?=long2ip($banned[$i])?></a>&nbsp;&nbsp;</td>
				</tr>
<?php
			$z++;
		}
?>				</table>
			</td>
		</tr>
		</table>
		<table width="100%" border="0" cellpadding="0" cellspacing="0">
		<tr>
			<td><img src="../img/sp.gif" width="1" height="5"/></td>
		</tr>
		<tr>
			<td bgcolor="<?=$constant['border-color']?>"><img src="../img/sp.gif" width="1" height="1"/></td>
		</tr>
		<tr>
			<td><img src="../img/sp.gif" width="1" height="5"/></td>
		</tr>
		<tr>
			<td align="right">
				<input type="button" value="check all" class="halfbutton" onClick="javascript:check(true)"/><input type="button" value="uncheck all" class="halfbutton" onClick="javascript:check(false)"/><br/>
				<input type="submit" value="delete" class="button"/>
			</td>
		</tr>
		</table>
		</form>
<?php
	}
	$timer->stop();
?>
	</td>
</tr>
</tr>
	<form action="ip-ban-add.php" method="post">
	<input type="hidden" name="page" value="<?=$page?>"/>
	<td valign="top" align="right">
		<br/>
		<table width="230" border="0" cellpadding="0" cellspacing="0">
<?php
	if ($error != "")
	{
?>
		<tr>
			<td colspan="3" 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 class="text" nowrap><span class="ip">new banned ip :</span></td>
			<td width="10"><spacer width="10" height="1" type="block"></td>
			<td width="170"><input type="text" size="16" name="ip" value="<?php if (isset($ip)) { print stripslashes($ip); session_unregister("ip"); }?>" maxlength="50" class="field"/></td>
		</tr>
		<tr>
			<td colspan="3" height="10"><spacer width="1" height="10" type="block"></td>
		</tr>
		<tr>
			<td colspan="3" align="right"><input type="submit" value="add" 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>
</tr>
<tr>
	<td valign="bottom" align="right" height="1">
		<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