Version 1
dateiname.php
<?php
/*************************************
* ftp-online für proftpd *
* PHP-Verbindungsviewer für proftpd *
* ftp-online@woerstenfeld.de *
* Version 1 - 09:40 29.07.2003 *
*************************************/
#### Konfiguration ####
$refresh = 1; # Alle x Sekunden neu laden
$title = "--=FTP-Online=--"; # Fenstertitel
$font = "Verdana"; # Schriftart
$headline = "Offene Verbindungen"; # Ueberschrift
$button1 = "START"; # Startknopf
$button2 = "STOPP"; # Stoppknopf
$befehl = "/usr/local/bin/ftpwho -v"; # Auszufuehrender Befehl
$tempfile = "/tmp/ftp.online"; # Temporäre Datei
$content = "Da ist ein Fehler :o/"; # Fehlermeldung
if (!isset($_GET["loop"]))
{
$do_refresh = true;
$start_stop = "?loop=0";
$button = $button2;
}
else
{
$start_stop = "";
$button = $button1;
}
$command = shell_exec("$befehl > $tempfile");
$handle = fopen ("$tempfile", "r");
if ($handle)
{
$content = "<FONT size=\"-2\" face=\"$font\">\n";
while (!feof ($handle))
{
$buffer = fgets($handle, 4096);
if (stristr($buffer,"\n")) $content .= "<BR>";
if (stristr($buffer,"service class")) $content .= "<HR>";
$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") || stristr($buffer,"no users") || stristr($buffer,"cating"))
{
$content .= "<b><nobr>".$buffer."</nobr></b>";
}
elseif (stristr($buffer,"users"))
{
$content .= "<nobr><font color=\"#4040ff\"><B>".$buffer."</B></font></nobr>";
}
else
{
$content .= "<nobr><font color=\"#404040\">".$buffer."</font></nobr>";
}
}
fclose ($handle);
$content .= "<HR>";
unlink("$tempfile");
}
$body = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n";
$body .= " <HTML>\n";
$body .= " <HEAD>\n";
$body .= " <META http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\">\n";
if ($do_refresh == true ) $body .= " <META HTTP-EQUIV=Refresh CONTENT=\"$refresh; URL=http://".$_SERVER["HTTP_HOST"].$_SERVER["PHP_SELF"]."\">\n";
$body .= " <TITLE>$refresh</TITLE>\n";
$body .= " </HEAD>\n";
$body .= " <BODY onload=\"window.defaultStatus='".$refresh."';\">\n";
$body .= " <A href=\"http://".$_SERVER["HTTP_HOST"].$_SERVER["PHP_SELF"].$start_stop."\"><FONT face=\"$font\" size=\"-2\">$button</FONT></A>\n";
$body .= " <BR>\n";
$body .= " <FONT face=\"$font\"><BIG>$headline<BIG></FONT>\n";
$body .= " <BR>\n";
$body .= " ".$content."<BR>\n";
$body .= " </BODY>\n";
$body .= " </HTML>\n";
echo $body;
### ENDE ###
?>