Script zum Anzeigen der aktuellen Konfiguration im Browser...
<?php
/************************************************
* 15.07.2003 12:00 configreader@woerstenfeld.de *
************************************************/
$name = 'ProFTPd Konfiguration';
$script = '/www/scripts/sql2conf.pl';
$driver = 'mysql';
$datenbank = 'ftp';
$user = 'ftp';
$password = 'ftp';
$server = 'localhost';
$tempfile = '/tmp/ftp.config';
$datumsformat = "d.m.Y H:i:s \\U\\h\\r";
$schriftart = "courier";
$normalfarbe = "#004040";
$kontextfarbe = "#4040ff";
$verbose = ""; //"--verbose"
$showsql = ""; //"--show-sql"
echo "<HTML>\n<HEAD>\n<TITLE>$name</TITLE>\n</HEAD>\n<BODY onload=\"window.defaultStatus='--=$name=--';\">\n";
$command = shell_exec("$script --dbdriver=$driver --dbname=$datenbank --dbuser=$user --dbpass=$password --dbserver=$server $verbose $showsql > $tempfile");
$handle = fopen ("$tempfile", "r");
if ($handle)
{
echo "<font color=\"$normalfarbe\" size=-2 face=$schriftart># Konfig aus Datenbank $datenbank@$server vom ".date($datumsformat);
echo "<UL>";
while (!feof ($handle))
{
$buffer = fgets($handle, 4096);
$buffer = nl2br(htmlentities($buffer));
// Anfang Kontext...
if ( stristr($buffer,"&Global") ||
stristr($buffer,"&Anonymous") ||
stristr($buffer,"&Directory ") ||
stristr($buffer,"&Global") ||
stristr($buffer,"&IfClass") ||
stristr($buffer,"&IfDefine") ||
stristr($buffer,"&IfGroup") ||
stristr($buffer,"&IfModule") ||
stristr($buffer,"&IfUser") ||
stristr($buffer,"&Limit") ||
stristr($buffer,"&VirtualHost"))
{
echo "<font color=\"$kontextfarbe\"><UL>";
echo "<nobr><B>".$buffer."</B></nobr>";
}
// Ende Kontext...
elseif (stristr($buffer,"&/Global") ||
stristr($buffer,"&/Anonymous") ||
stristr($buffer,"&/Directory") ||
stristr($buffer,"&/Global") ||
stristr($buffer,"&/IfClass") ||
stristr($buffer,"&/IfDefine") ||
stristr($buffer,"&/IfGroup") ||
stristr($buffer,"&/IfModule") ||
stristr($buffer,"&/IfUser") ||
stristr($buffer,"&/Limit") ||
stristr($buffer,"&/VirtualHost"))
{
echo "<nobr><B>".$buffer."</B></nobr>";
echo "</font></UL>";
}
// Normale Direktive...
else
{
echo "<nobr>&".$buffer."</nobr>";
}
}
}
fclose ($handle);
unlink($tempfile);
echo "</BODY>\n</HTML>";
?>