<?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("../users-data.php");
$inverse = true;
$messageToPage = "50";
if (!isset($user))
$user = null;
if (!isset($error))
$error = "";
if (!isset($style))
$style = "";
$contentCnt = sizeof($user);
?>
<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>User list</b></td>
</tr>
</table>
</td>
</tr>
</table>
<br/>
<?php
$pageLine = pagesNumber($contentCnt, $messageToPage, $page, "user-list.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="user-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="<?=$constant['header-background-color']?>">
<td class="text"> </td>
<td class="headertext" nowrap> user name </td>
<td class="headertext" nowrap> user mail </td>
<td class="headertext" nowrap> user status </td>
<?
$z = $page*$messageToPage - ($messageToPage-1);
$currentContent = outputPageContent($user,$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 width="1"><input type="checkbox" name="id[]" value="<?=$z;?>"/></td>
<td width="1%" nowrap class="text"> <a href="user-del.php?id=<?=$z?>" class="<?=$inverse ? "adminlink" : "messagelink"?>"><?=$currentContent[$i]['name']?></a> </td>
<td width="1%" nowrap class="text"> <a href="user-del.php?id=<?=$z?>" class="<?=$inverse ? "adminlink" : "messagelink"?>"><?=$currentContent[$i]['mail']?></a> </td>
<td class="text"> <a href="user-status.php?id=<?=$z?>" class="<?=$inverse ? "adminlink" : "messagelink"?>"><?=$currentContent[$i]['status'] ? "+" : "-" ?></a> </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
}
?>
</td>
</tr>
</tr>
<form action="user-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");
}
$timer->stop();
?>
<tr>
<td class="text" nowrap><span class="username">new user name:</span></td>
<td width="10"><spacer width="10" height="1" type="block"></td>
<td width="170"><input type="text" size="16" name="userName" value="<?php if (isset($userName)) { print stripslashes($userName); session_unregister("userName"); }?>" maxlength="30" class="field"/></td>
</tr>
<tr>
<td class="text" nowrap><span class="usermail">new user mail:</span></td>
<td width="10"><spacer width="10" height="1" type="block"></td>
<td width="170"><input type="text" size="16" name="userMail" value="<?php if (isset($userMail)) { print stripslashes($userMail); session_unregister("userMail"); }?>" maxlength="128" class="field"/></td>
</tr>
<tr>
<td class="text" nowrap><span class="userpassword">new user password:</span></td>
<td width="10"><spacer width="10" height="1" type="block"></td>
<td width="170"><input type="password" size="16" name="newUserPassword" value="<?php if (isset($newUserPassword)) { print stripslashes($newUserPassword); session_unregister("newUserPassword"); }?>" maxlength="30" class="field"/></td>
</tr>
<tr>
<td class="text" nowrap><span class="userpassword">confirm password:</span></td>
<td width="10"><spacer width="10" height="1" type="block"></td>
<td width="170"><input type="password" size="16" name="confirmUserPassword" value="<?php if (isset($confirmUserPassword)) { print stripslashes($confirmUserPassword); session_unregister("confirmUserPassword"); }?>" maxlength="30" class="field"/></td>
</tr>
<tr>
<td class="text" nowrap>status:</td>
<td width="10"><spacer width="10" height="1" type="block"></td>
<td width="170" class="text">
<input type="radio" name="userStatus" value="enabled" <?php if (isset($userStatus)) { if ($userStatus) { print "checked=\"checked\""; } session_unregister("userStatus"); } else { print "checked=\"checked\""; }?>/>enabled
<input type="radio" name="userStatus" value="disabled" <?php if (isset($userStatus)) { if (!$userStatus) { print "checked=\"checked\""; } session_unregister("userStatus"); }?>/>disabled
</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"/></td>
</tr>
<tr>
<td colspan="3" align="right"><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">© </span>trent <a href="http://www.low.ru/dev/guestbook/" class="text" target="_top">Download this guestbook</a> </td>
<td width="50%" bgcolor="<?=$constant['header-background-color']?>" class="headertext" align="center"><span class="text"> </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> </td>
</tr>
</table>
</td>
</tr>
</table>
<!-- generation time <?=$timer->elapsed()." sec";?> -->
</body>
</html>