Location: PHPKode > projects > CourierAdmin > srv/www/htdocs/courieradmin/logins.php
<?php
/*
Courieradmin V1, Administration of Courier Mailserver
Copyright (C) 2003  Daniel Heule

This file is part of Courieradmin.

Courieradmin is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

Courieradmin is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Courieradmin; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/
require_once("common.php");
if($_SESSION['user']['right_listlogins'] != 1) exit;
if(!$CourierAdmin_ListLogins) exit;
if(!isset($_SESSION['logins_anzahl'])) $_SESSION['logins_anzahl'] = 100;
if(!isset($_SESSION['logins_filter'])) $_SESSION['logins_filter'] = "";
if(!isset($_SESSION['logins_refresh'])) $_SESSION['logins_refresh'] = 0;
if(isset($_REQUEST['logins_anzahl'])) $_SESSION['logins_anzahl'] = $_REQUEST['logins_anzahl'];
if(isset($_REQUEST['logins_filter'])) $_SESSION['logins_filter'] = $_REQUEST['logins_filter'];
if(isset($_REQUEST['logins_refresh']) && $_REQUEST['logins_refresh'] != "") $_SESSION['logins_refresh'] = $_REQUEST['logins_refresh'];
elseif(!isset($_REQUEST['logins_refresh']) && $_REQUEST['logins_act'] == "Werte neu Setzen")
{
 $_SESSION['logins_refresh'] = 0;
}
if($_SESSION['user']['domain'] != '*')
{
 exec("sudo -u ".$CourierAdmin_sh_root_user." ".$CourierAdmin_path."/bin/sudo_root.php report_login ".$_SESSION['user']['domain']." ".$_SESSION['logins_filter'],$output);
}
else
{
 exec("sudo -u ".$CourierAdmin_sh_root_user." ".$CourierAdmin_path."/bin/sudo_root.php report_login ".$_SESSION['logins_filter'],$output);
}
?>
<html>
<head>
<title>Letzte Logins, Courieradmin (c) by Nerve</title>
<?php
if($_SESSION['logins_refresh'] == 1)
{
 echo"<meta http-equiv=\"refresh\" content=\"".$CourierAdmin_default_refresh_time."\">";
}
?>
</head>
<body>
<h1>Letzte Logins bei Courier</h1>
<form name="Formular" method="post" action="<%=$self%>" target="_self">
<b>Anzahl Zeilen : </b><input size=20 name="logins_anzahl" value="<?php print($_SESSION['logins_anzahl']);?>"><br>
<b>Automatisch auffrischen ? : </b> <input type="checkbox" name="logins_refresh" value="1" <?php if($_SESSION['logins_refresh'] > 0) echo "checked";?>><br>
<b>Filter : </b><input size=20 name="logins_filter" value="<?php echo $_SESSION['logins_filter']; ?>"><br>
<input type=submit name="logins_act" value="Werte neu Setzen"><br>
</form>
<?php
echo "<table border=\"1\"><tr><th>Zeitpunkt:</th><th>Dienst:</th><th>Konto:</th><th>IP-Adresse:</th><th>Hostname:</th></tr>\n";
krsort($output);
$listanz = 0;
foreach ($output as $key => $value)
{
 sscanf($value,'%s%s%s%s%s LOGIN, %s%s%s', &$mon, &$tag, &$zeit, &$host, &$methode, &$user, &$ipadr, &$prot);
 echo "<tr>";
 //   echo "<td>$key</td>";
 echo "<td>$tag $mon $zeit</td>";
 //   echo "<td>$host</td>";
 echo "<td>".substr($methode, 0, -1)."</td>";
 echo "<td>".substr($user, 5, -1)."</td>";
 echo "<td>".substr($ipadr, 4, -2)."</td>";
 echo "<td>".gethostbyaddr(substr($ipadr, 4, -2))."</td>";
 echo "</tr>\n";
 $listanz++;
 if($listanz > $_SESSION['logins_anzahl']) break;
}
echo "</table>";
?>
</body>
</html>
                                                                                                                                                                                                                                                                                                            
Return current item: CourierAdmin