diff options
author | Philip Häusler <msquare@notrademark.de> | 2011-06-03 14:48:05 +0200 |
---|---|---|
committer | Philip Häusler <msquare@notrademark.de> | 2011-06-03 14:48:05 +0200 |
commit | ded7bcb0b49e101c0414034fe1ff168a043b6a75 (patch) | |
tree | c62f8e5c8a355c39268dc064fc6ddf42d054cce7 | |
parent | 7e91f4821aee41589dd744a9540f15b76d729bab (diff) |
debug -> admin log
-rw-r--r-- | includes/funktion_db_list.php | 100 | ||||
-rw-r--r-- | includes/pages/admin_log.php | 51 | ||||
-rw-r--r-- | www-ssl/admin/debug.php | 58 |
3 files changed, 100 insertions, 109 deletions
diff --git a/includes/funktion_db_list.php b/includes/funktion_db_list.php index 3e2878da..35bb7255 100644 --- a/includes/funktion_db_list.php +++ b/includes/funktion_db_list.php @@ -1,64 +1,62 @@ <?php - function funktion_db_list($Table_Name) { - global $con; - $SQL = "SELECT * FROM `".$Table_Name."`"; - $Erg = mysql_query($SQL, $con); - // anzahl zeilen - $Zeilen = mysql_num_rows($Erg); +// Gibt eine Tabelle generisch als HTML aus +function funktion_db_list($Table_Name) { + global $con; - $Anzahl_Felder = mysql_num_fields($Erg); + $html = ""; - echo "<table class=\"border\" cellpadding=\"2\" cellspacing=\"1\">"; - echo "<caption>DB: $Table_Name</caption>"; + $SQL = "SELECT * FROM `" . $Table_Name . "`"; + $Erg = mysql_query($SQL, $con); - echo "<tr class=\"contenttopic\">"; - for ($m = 0 ; $m < $Anzahl_Felder ; $m++) - { - echo "<th>". mysql_field_name($Erg, $m). "</th>"; - } - echo "</tr>"; + // anzahl zeilen + $Zeilen = mysql_num_rows($Erg); - for ($n = 0 ; $n < $Zeilen ; $n++) - { - echo "<tr class=\"content\">"; - for ($m = 0 ; $m < $Anzahl_Felder ; $m++) - { - echo "<td>".mysql_result($Erg, $n, $m). "</td>"; - } - echo "</tr>"; - } - echo "</table>"; -} + $Anzahl_Felder = mysql_num_fields($Erg); -function funktion_db_element_list_2row( $TopicName, $SQL) -{ - $html = ""; - $html .= "<table class=\"border\" cellpadding=\"2\" cellspacing=\"1\">\n"; - $html .= "<caption>$TopicName</caption>"; -# $html .= "<tr class=\"contenttopic\"> <td><h1>$TopicName</h1></td> </tr>\n"; + $html .= "<table class=\"border\" cellpadding=\"2\" cellspacing=\"1\">"; + $html .= "<caption>DB: $Table_Name</caption>"; - $Erg = sql_query($SQL); - - $html .= "<tr class=\"contenttopic\">"; - for ($m = 0 ; $m < mysql_num_fields($Erg) ; $m++) - { - $html .= "<th>". mysql_field_name($Erg, $m). "</th>"; - } - $html .= "</tr>"; + $html .= "<tr class=\"contenttopic\">"; + for ($m = 0; $m < $Anzahl_Felder; $m++) { + $html .= "<th>" . mysql_field_name($Erg, $m) . "</th>"; + } + $html .= "</tr>"; - for ($n = 0 ; $n < mysql_num_rows($Erg) ; $n++) - { - $html .= "<tr class=\"content\">"; - for ($m = 0 ; $m < mysql_num_fields($Erg) ; $m++) - { - $html .= "<td>".mysql_result($Erg, $n, $m). "</td>"; - } - $html .= "</tr>"; - } - $html .= "</table>\n"; - return $html; + for ($n = 0; $n < $Zeilen; $n++) { + $html .= "<tr class=\"content\">"; + for ($m = 0; $m < $Anzahl_Felder; $m++) { + $html .= "<td>" . mysql_result($Erg, $n, $m) . "</td>"; + } + $html .= "</tr>"; + } + $html .= "</table>"; + return $html; } +function funktion_db_element_list_2row($TopicName, $SQL) { + $html = ""; + $html .= "<table class=\"border\" cellpadding=\"2\" cellspacing=\"1\">\n"; + $html .= "<caption>$TopicName</caption>"; + # $html .= "<tr class=\"contenttopic\"> <td><h1>$TopicName</h1></td> </tr>\n"; + + $Erg = sql_query($SQL); + + $html .= "<tr class=\"contenttopic\">"; + for ($m = 0; $m < mysql_num_fields($Erg); $m++) { + $html .= "<th>" . mysql_field_name($Erg, $m) . "</th>"; + } + $html .= "</tr>"; + + for ($n = 0; $n < mysql_num_rows($Erg); $n++) { + $html .= "<tr class=\"content\">"; + for ($m = 0; $m < mysql_num_fields($Erg); $m++) { + $html .= "<td>" . mysql_result($Erg, $n, $m) . "</td>"; + } + $html .= "</tr>"; + } + $html .= "</table>\n"; + return $html; +} ?> diff --git a/includes/pages/admin_log.php b/includes/pages/admin_log.php index 5f112f03..2798b2cf 100644 --- a/includes/pages/admin_log.php +++ b/includes/pages/admin_log.php @@ -1,5 +1,7 @@ <?php function admin_log() { + require_once ("includes/funktion_db_list.php"); + $html = ""; $SQL = "SELECT * FROM `ChangeLog` ORDER BY `Time` DESC LIMIT 0,10000"; $Erg = sql_query($SQL); @@ -19,6 +21,55 @@ function admin_log() { } else { $html .= "Log is empty..."; } + $html .= "<hr />"; + + $html .= "<h1>Web Counter</h1>"; + $html .= funktion_db_list("Counter"); + + /* + $html .= "<h1>Raeume</h1> <br />"; + funktion_db_list("Raeume"); + + $html .= "<h1>Schichtbelegung</h1> <br />"; + funktion_db_list("Schichtbelegung"); + + $html .= "<h1>Schichtplan</h1> <br />Hier findest du alle bisher eingetragenen Schichten:"; + funktion_db_list("Schichtplan"); + + $html .= "<h1>User</h1> <br />"; + funktion_db_list("User"); + + $html .= "<h1>News</h1> <br />"; + funktion_db_list("News"); + + $html .= "<h1>FAQ</h1> <br />"; + funktion_db_list("FAQ"); + + $html .= "Deaktiviert"; + */ + + $html .= "<hr>\n"; + $html .= funktion_db_element_list_2row("Tshirt-Size aller engel", "SELECT `Size`, COUNT(`Size`) FROM `User` GROUP BY `Size`"); + $html .= "<br />\n"; + $html .= funktion_db_element_list_2row("Tshirt ausgegeben", "SELECT `Size`, COUNT(`Size`) FROM `User` WHERE `Tshirt`='1' GROUP BY `Size`"); + $html .= "<br />\n"; + $html .= funktion_db_element_list_2row("Tshirt nicht ausgegeben (Gekommen=1)", "SELECT COUNT(`Size`), `Size` FROM `User` WHERE `Gekommen`='1' and `Tshirt`='0' GROUP BY `Size`"); + + $html .= "<hr>\n"; + $html .= funktion_db_element_list_2row("Hometown", "SELECT COUNT(`Hometown`), `Hometown` FROM `User` GROUP BY `Hometown`"); + $html .= "<br />\n"; + $html .= funktion_db_element_list_2row("Engeltypen", "SELECT COUNT(`Art`), `Art` FROM `User` GROUP BY `Art`"); + + $html .= "<hr>\n"; + $html .= funktion_db_element_list_2row("Gesamte Arbeit", "SELECT COUNT(*) AS `Count [x]`, SUM(Shifts.Len) as `Sum [h]` from Shifts LEFT JOIN ShiftEntry USING(SID)"); + $html .= "<br />\n"; + $html .= funktion_db_element_list_2row("Geleisteter Arbeit", "SELECT COUNT(*) AS `Count [x]`, SUM(Shifts.Len) as `Sum [h]` from Shifts LEFT JOIN ShiftEntry USING(SID) WHERE (ShiftEntry.UID!=0)"); + + $html .= "<hr>\n"; + $html .= funktion_db_element_list_2row("Gesamte Arbeit (Ohne Raum aufabau (RID=7)", "SELECT COUNT(*) AS `Count [x]`, SUM(Shifts.Len) as `Sum [h]` from Shifts LEFT JOIN ShiftEntry USING(SID) WHERE (Shifts.RID!=7)"); + $html .= "<br />\n"; + $html .= funktion_db_element_list_2row("Geleisteter Arbeit (Ohne Raum aufabau (RID=7)", "SELECT COUNT(*) AS `Count [x]`, SUM(Shifts.Len) as `Sum [h]` from Shifts LEFT JOIN ShiftEntry USING(SID) WHERE (ShiftEntry.UID!=0) AND (Shifts.RID!=7)"); + return $html; } ?> diff --git a/www-ssl/admin/debug.php b/www-ssl/admin/debug.php deleted file mode 100644 index ec1b2c9f..00000000 --- a/www-ssl/admin/debug.php +++ /dev/null @@ -1,58 +0,0 @@ -<?php -require_once ('../bootstrap.php'); - -$title = "Debug-Liste"; -$header = "Datenbank-Auszug"; -include ("includes/header.php"); -include ("includes/funktion_db_list.php"); - -echo "<h1>Web Counter</h1>"; -funktion_db_list("Counter"); - -/* -echo "<h1>Raeume</h1> <br />"; -funktion_db_list("Raeume"); - -echo "<h1>Schichtbelegung</h1> <br />"; -funktion_db_list("Schichtbelegung"); - -echo "<h1>Schichtplan</h1> <br />Hier findest du alle bisher eingetragenen Schichten:"; -funktion_db_list("Schichtplan"); - -echo "<h1>User</h1> <br />"; -funktion_db_list("User"); - -echo "<h1>News</h1> <br />"; -funktion_db_list("News"); - -echo "<h1>FAQ</h1> <br />"; -funktion_db_list("FAQ"); - -echo "Deaktiviert"; -*/ - -echo "<hr>\n"; -funktion_db_element_list_2row("Tshirt-Size aller engel", "SELECT `Size`, COUNT(`Size`) FROM `User` GROUP BY `Size`"); -echo "<br />\n"; -funktion_db_element_list_2row("Tshirt ausgegeben", "SELECT `Size`, COUNT(`Size`) FROM `User` WHERE `Tshirt`='1' GROUP BY `Size`"); -echo "<br />\n"; -funktion_db_element_list_2row("Tshirt nicht ausgegeben (Gekommen=1)", "SELECT COUNT(`Size`), `Size` FROM `User` WHERE `Gekommen`='1' and `Tshirt`='0' GROUP BY `Size`"); - -echo "<hr>\n"; -funktion_db_element_list_2row("Hometown", "SELECT COUNT(`Hometown`), `Hometown` FROM `User` GROUP BY `Hometown`"); -echo "<br />\n"; -funktion_db_element_list_2row("Engeltypen", "SELECT COUNT(`Art`), `Art` FROM `User` GROUP BY `Art`"); - -echo "<hr>\n"; -funktion_db_element_list_2row("Gesamte Arbeit", "SELECT COUNT(*) AS `Count [x]`, SUM(Shifts.Len) as `Sum [h]` from Shifts LEFT JOIN ShiftEntry USING(SID)"); -echo "<br />\n"; -funktion_db_element_list_2row("Geleisteter Arbeit", "SELECT COUNT(*) AS `Count [x]`, SUM(Shifts.Len) as `Sum [h]` from Shifts LEFT JOIN ShiftEntry USING(SID) WHERE (ShiftEntry.UID!=0)"); - -echo "<hr>\n"; -funktion_db_element_list_2row("Gesamte Arbeit (Ohne Raum aufabau (RID=7)", "SELECT COUNT(*) AS `Count [x]`, SUM(Shifts.Len) as `Sum [h]` from Shifts LEFT JOIN ShiftEntry USING(SID) WHERE (Shifts.RID!=7)"); -echo "<br />\n"; -funktion_db_element_list_2row("Geleisteter Arbeit (Ohne Raum aufabau (RID=7)", "SELECT COUNT(*) AS `Count [x]`, SUM(Shifts.Len) as `Sum [h]` from Shifts LEFT JOIN ShiftEntry USING(SID) WHERE (ShiftEntry.UID!=0) AND (Shifts.RID!=7)"); - -include ("includes/footer.php"); -?> - |