PHP-Script für
ftpwho-Anzeige im Browser
<HTML>
<HEAD>
<TITLE>Administration</TITLE>
</HEAD>
<BODY onload="window.defaultStatus='--=Administration=--';">
<H2>Offene Verbindungen...</H2>
<?php
$command = shell_exec('/usr/local/bin/ftpwho -v >/tmp/ftp.online');
$handle = fopen ("/tmp/ftp.online", "r");
if ($handle)
{
echo "<font size=-2 face=verdana><UL>";
while (!feof ($handle))
{
$buffer = fgets($handle, 4096);
$buffer = str_replace("client", "<HR>Client",strtolower($buffer));
$buffer = str_replace("retr", "<font color=red><b>retr</b></font>",strtolower($buffer));
$buffer = str_replace("idle", "<font color=green><b>idle</b></font>",strtolower($buffer));
$buffer = str_replace("stor", "<font color=red><b>stor</b></font>",strtolower($buffer));
if (stristr($buffer,"stor") || stristr($buffer,"retr") || stristr($buffer,"idle"))
{
echo "<b><nobr>".$buffer."</nobr></b><BR>";
}
elseif (stristr($buffer,"users"))
{
echo "<nobr><font color=\"#4040ff\"><B>".$buffer."</B></font></nobr>";
}
else
{
echo "<nobr><font color=\"#404040\">".$buffer."</font></nobr>";
}
}
fclose ($handle);
unlink("/tmp/ftp.online");
echo '<META HTTP-EQUIV=Refresh CONTENT="1; URL=http://'.$_SERVER["HTTP_HOST"].$_SERVER["PHP_SELF"].'">';
}
?>
</BODY>
</HTML>
Nicht schön aber geht... :wink: