Поделюсь без вопросов, всего 2 PHP файла и и картинка логотипа...
файл login.php
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
<title>Chaiznet Local Area Network</title>
<style type="text/css">
<!--
.header1 {
font-family: "Times New Roman", Times, serif;
font-size: 14px;
font-weight: bold;
}
.header2 {
font-family: "Times New Roman", Times, serif;
font-size: 14px;
margin: 0px;
}
.header3 {
font-family: "Times New Roman", Times, serif;
font-size: 12px;
font-weight: bold;
}
.formheader {
font-family: "Times New Roman", Times, serif;
font-size: 12px;
font-weight: bold;
margin: 0px;
padding: 0px;
}
.formtext {
font-family: "Times New Roman", Times, serif;
font-size: 12px;
}
.forminput {
font-family: "Times New Roman", Times, serif;
font-size: 12px;
font-weight: normal;
width: 120px;
border-top-style: solid;
border-right-style: solid;
border-bottom-style: solid;
border-left-style: solid;
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
height: 18px;
margin: 0px;
padding: 0px;
}
.formkey {
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-top-style: solid;
border-right-style: solid;
border-bottom-style: solid;
border-left-style: solid;
font-family: "Times New Roman", Times, serif;
font-size: 12px;
font-weight: bold;
width: 80px;
}
.errorheader2 {
font-family: "Times New Roman", Times, serif;
font-size: 14px;
margin: 0px;
color: #FF0000;
}
.navigationheader1 {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
margin: 0px;
}
.navigationtext {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
margin: 0px;
}
.navigationtextselect {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
margin: 0px;
background-color: #eeeeee;
}
.navigationheader2 {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
padding: 0px;
margin: 0px;
}
.havigationline {
font-family: Arial, Helvetica, sans-serif;
font-size: 9px;
border-top-style: none;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
padding: 0px;
}
a:link {
text-decoration: none;
font-family: "Times New Roman", Times, serif;
font-size: 12px;
font-weight: normal;
color: #000000;
}
a:visited {
text-decoration: none;
color: #000000;
font-family: "Times New Roman", Times, serif;
font-size: 12px;
font-weight: normal;
}
a:hover {
text-decoration: none;
color: #FF0000;
background-color: #999999;
font-family: "Times New Roman", Times, serif;
font-size: 12px;
font-weight: normal;
}
.listboxs {
background-color:#F5F5F5;
border:1px #666666 solid;
font-size: 10px;
color: black;
//margin: 0px;
font-family: verdana, arial, helvetica, geneva, sans-serif;
}
.formkey2 {
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-top-style: solid;
border-right-style: solid;
border-bottom-style: solid;
border-left-style: solid;
font-family: "Times New Roman", Times, serif;
font-size: 12px;
font-weight: bold;
}
-->
</style>
</head>
<body>
<table width="100%" border="0" align="center">
<tr>
<td width="238" align="left" valign="top"><img src="logo.jpg" width="238" height="86" /></td>
<td width="501"><p><span class="header1">Информация о пользователях</span></p>
</td>
</tr>
<tr><td>
</td><td>
<p class='header2'>Пожалуйста введите Ваш логин и пароль,</p>
<p class='header2'>для просмотра информации о Вашем трафике.</p>
<form id="authform" name="authform" method="post" action="">
<table width="258" border="0" align="left" cellpadding="1" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td height="19" colspan="2" bgcolor="#999999" class="formheader"><div align="center">Форма ввода </div></td>
</tr>
<tr>
<td width="123" class="formtext">Логин:</td>
<td width="125" class="formtext">Пароль:</td>
</tr>
<tr>
<td><label>
<input name="username" type="text" class="forminput" id="username" maxlength="32" />
</label></td>
<td><label>
<input name="password" type="password" class="forminput" id="password" maxlength="32" />
</label></td>
</tr>
<tr>
<td colspan="2"><label>
<div align="center">
<input name="Submit2" type="submit" class="formkey" value="Вход" />
</div>
</label></td>
</tr>
</table>
</form>
</table>
<p align="center" class="header2"> </p>
<p align="center" class="header2"> </p>
</body>
</html>
Файл index.php
<?php
session_start();
$filename = "stargazer.log";
if ($HTTP_GET_VARS['mode']=="exit")
{
session_unset();
header ("Location: index.php");
}
$opn=false;
if (($HTTP_POST_VARS['username']) &&
($HTTP_POST_VARS['password']<>""))
if (($HTTP_POST_VARS['username']=="adminstat") &&
($HTTP_POST_VARS['password']=="adminpass"))
{
$HTTP_SESSION_VARS['login']=$HTTP_POST_VARS['username'];
$HTTP_SESSION_VARS['password']=$HTTP_POST_VARS['password'];
$admin="@stargazer";
$read="cash";
$opn=true;
}
if (($HTTP_SESSION_VARS['login']=="adminstat") &&
($HTTP_SESSION_VARS['password']=="adminpass"))
$valid=true;
else
$valid=false;
if (!$valid)
{
include "login.php";
exit;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
<title>Admin statistic</title>
<style type="text/css">
<!--
.style4 {
color: #000000;
font-weight: bold;
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
}
.style5 {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
}
.selectstyle1 {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
clip: rect(auto,auto,auto,auto);
color: #000000;
display: block;
}
.listboxs {
background-color:#F5F5F5;
border:1px #666666 solid;
font-size: 10px;
color: black;
//margin: 0px;
font-family: verdana, arial, helvetica, geneva, sans-serif;
}
.navigationheader {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
margin-left: 25px;
}
.navigationclient {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
margin-left: 40px;
margin-top: 0px;
margin-bottom: 0px;
}
.formkey {
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-top-style: solid;
border-right-style: solid;
border-bottom-style: solid;
border-left-style: solid;
font-family: "Times New Roman", Times, serif;
font-size: 12px;
font-weight: bold;
width: 80px;
}
-->
</style>
</head>
<?php
if ($HTTP_GET_VARS['read']=="")
$read="cash";
else
$read=$HTTP_GET_VARS['read'];
$dsr=$HTTP_POST_VARS['datestart'];
$dsp=$HTTP_POST_VARS['datestop'];
$user=$HTTP_POST_VARS['user'];
$admin=$HTTP_POST_VARS['admin'];
$adminip=$HTTP_POST_VARS['adminip'];
if ($admin=="")
$admin="*";
if ($user=="")
$user="*";
if ($adminip=="")
$adminip="*";
if ($read=="cash")
$title="Статистика пополнения счетов";
if ($read=="credit")
$title="Статистика установки кредитов";
if ($opn)
{
$admin="*";
$user="*";
$adminip="*";
$dsp=date("23:59 d.m.Y",mktime());
$dsr=date("00:00 01.m.Y",mktime());
$read="cash";
}
?>
<body>
<table width="577" border="0">
<tr>
<td width="150"><img src="logo.jpg" width="150" height="150" /></td>
<td width="429"><p align="center"><strong><?php print $title; ?></strong></p>
<form id="form2" name="form2" method="post" action="">
<table width="200" border="0">
<tr>
<td class="style5"><div align="right">С:</div></td>
<td>
<label>
<input name="datestart" type="text" class="listboxs" value="<?php print $dsr; ?>"/>
</label></td>
<td class="style5"><div align="right">По:</div></td>
<td><label>
<input name="datestop" type="text" class="listboxs" value="<?php print $dsp; ?>"/>
</label></td>
<td> </td>
</tr>
<tr>
<td class="style5"><div align="right">Администарор:</div></td>
<td><input name="admin" type="text" class="listboxs" id="admin" value="<?php print $admin; ?>"/></td>
<td class="style5"><div align="right">Пользователь:</div></td>
<td><label>
<input name="user" type="text" class="listboxs" id="user" value="<?php print $user; ?>"/>
</label></td>
<td> </td>
</tr>
<tr>
<td nowrap="nowrap" class="style5">IP-администратора: </td>
<td><input name="adminip" type="text" class="listboxs" id="adminip" value="<?php print $adminip; ?>"/></td>
<td class="style5"> </td>
<td><div align="right">
<input name="Submit2" type="submit" class="formkey" value="Статистика" />
</div></td>
<td> </td>
</tr>
</table>
</form> </td>
</tr>
<tr>
<td align="left" valign="top"><p align="center" class="navigationheader">Навигация</p>
<p align="center" class="navigationheader"> </p>
<p class="navigationheader"><a href="index.php?read=cash">Пополнения</a></p>
<p class="navigationheader"><a href="index.php?read=credit">Кредиты</a></p>
<p class="navigationclient"> </p>
<p class="navigationheader"><a href="index.php?mode=exit">Выход</a></p></td>
<td align="left" valign="bottom">
<table width="200" border="0" align="left">
<tr align="center" valign="top" bgcolor="#999999">
<td nowrap="nowrap"><span class="style4">Дата</span></td>
<td nowrap="nowrap"><span class="style4">Администратор</span></td>
<td nowrap="nowrap" class="style4">IP</td>
<td nowrap="nowrap" class="style4">Пользователь</td>
<td nowrap="nowrap"><span class="style4">Дебет</span></td>
<td nowrap="nowrap"><span class="style4">Кредет</span></td>
</tr>
<?php
function cashdata($filedata)
{
$tmp=explode (" ",$filedata);
if (($tmp[8]=="'cash'") &&
($tmp[9]=="parameter") &&
($tmp[10]=="changed"))
{
$res['admin']=substr(substr($tmp[4],1),0,strlen($tmp[4])-3);
$res['user']=substr(substr($tmp[7],1),0,strlen($tmp[7])-3);
$res['adminip']=substr($tmp[5],0,strlen($tmp[5])-1);
$res['cashold']=substr(substr($tmp[12],1),0,strlen($tmp[12])-3);
$res['cashnew']=substr(substr($tmp[14],1),0,strlen($tmp[14])-3);
$res['cash']=round($res['cashnew']-$res['cashold'],5);
$d=substr($tmp[0],8,2);
$m=substr($tmp[0],5,2);
$y=substr($tmp[0],0,4);
$H=substr($tmp[1],0,2);
$I=substr($tmp[1],3,2);
$S=substr($tmp[1],6,2);
$res['date']=mktime($H,$I,$S,$m,$d,$y);
if ($res['date']==0)
return false;
else
return $res;
}
}
function creditdata($filedata)
{
$tmp=explode (" ",$filedata);
if (($tmp[8]=="'credit'") &&
($tmp[9]=="parameter") &&
($tmp[10]=="changed"))
{
$res['admin']=substr(substr($tmp[4],1),0,strlen($tmp[4])-3);
$res['user']=substr(substr($tmp[7],1),0,strlen($tmp[7])-3);
$res['adminip']=substr($tmp[5],0,strlen($tmp[5])-1);
$res['cashold']=substr(substr($tmp[12],1),0,strlen($tmp[12])-3);
$res['cashnew']=substr(substr($tmp[14],1),0,strlen($tmp[14])-3);
$res['cash']=round($res['cashnew']-$res['cashold'],5);
$d=substr($tmp[0],8,2);
$m=substr($tmp[0],5,2);
$y=substr($tmp[0],0,4);
$H=substr($tmp[1],0,2);
$I=substr($tmp[1],3,2);
$S=substr($tmp[1],6,2);
$res['date']=mktime($H,$I,$S,$m,$d,$y);
if ($res['date']==0)
return false;
else
return $res;
}
}
function query ($res,$datestart,$dateend, $admin,$adminip, $user)
{
if ($admin=="*")
$sadmin=true;
else if ($res['admin']==$admin)
$sadmin=true;
else $sadmin=false;
if ($user=="*")
$suser=true;
else if ($res['user']==$user)
$suser=true;
else $suser=false;
if ($adminip=="*")
$sadminip=true;
else if ($res['adminip']==$adminip)
$sadminip=true;
else $sadminip=false;
if ($datestart==0)
$sdatestart=true;
else if ($res['date']>=$datestart)
$sdatestart=true;
else $sdatestart=false;
if ($dateend==0)
$sdateend=true;
else if ($res['date']<=$dateend)
$sdateend=true;
else $sdateend=false;
if (($sadmin==true) &&
($sadminip==true) &&
($suser==true) &&
($sdatestart==true) &&
($sdateend==true))
return true;
else
return false;
}
$fp = fopen($filename, "r");
if (!$fp)
{
echo "error";
exit;
}
$sumdeb=0;
$sumcred=0;
$datestart=0;
$datestop=mktime;
if ($dsr<>"")
$datestart=mktime (substr($dsr,0,2),substr($dsr,3,2),0,substr($dsr,9,2), substr($dsr,6,2),substr($dsr,12,4));
if ($dsp<>"")
$datestop=mktime(substr($dsp,0,2),substr($dsp,3,2),0,substr($dsp,9,2), substr($dsp,6,2),substr($dsp,12,4));
while (!feof($fp))
{
if ($read=="cash")
$res=cashdata(fgets($fp));
if ($read=="credit")
$res=creditdata(fgets($fp));
if ($res)
if (query ($res,$datestart,$datestop, $admin,$adminip, $user))
{
$debet=0;
$credet=0;
if ($read=="cash")
if ($res[cash]>=0)
$debet=$res[cash];
else
$credet=-1*$res[cash];
if ($read=="credit")
if ($res[cash]>=0)
$credet=$res[cash];
else
$debet=-1*$res[cash];
print " <tr>\n
<td align='center' nowrap='nowrap' bgcolor='#dddddd' class='style5'>".date("H:i d.m.Y",$res['date'])."</td>\n
<td bgcolor='#dddddd' class='style5'>".$res['admin']."</td>\n
<td align='center' bgcolor='#dddddd' class='style5'>".$res['adminip']."</td>\n
<td align='left' bgcolor='#dddddd' class='style5'>".$res['user']."</td>\n
<td align='right' bgcolor='#dddddd' class='style5'> $debet </td>\n
<td align='right' bgcolor='#dddddd' class='style5'> $credet </td>\n
</tr>\n
";
$sumdeb=$sumdeb+$debet;
$sumcred=$sumcred+$credet;
}
}
?>
<tr>
<td align="center" nowrap="nowrap" bgcolor="#999999" class="style4">Итого</td>
<td bgcolor="#999999" class="style5"> </td>
<td align="center" bgcolor="#999999" class="style5"> </td>
<td align="right" bgcolor="#999999" class="style5"> </td>
<td align="right" bgcolor="#999999" class="style5"><?php print $sumdeb; ?></td>
<td align="right" bgcolor="#999999" class="style5"><?php print $sumcred; ?></td>
</tr>
</table>
<p> </p>
<p> </p>
<p> </p></td>
</tr>
</table>
<p> </p>
<p> </p>
</body>
</html>
Ничего сложного, 15 минут позора и админом быть намного проще...
PS Login:adminstat, password:adminpass, было очень лень делать многопользовательскую, просто нужна была рабочая модель, поэтому только 1 админ. Для логотипа используется файл logo.jpg.
ChaizNet-Local Area Network