admin user

This commit is contained in:
Philip Häusler 2011-06-03 06:40:29 +02:00
parent 705370aec6
commit 35fe4b3ed6
6 changed files with 165 additions and 30 deletions

View File

@ -3,7 +3,7 @@
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Erstellungszeit: 03. Juni 2011 um 03:49
-- Erstellungszeit: 03. Juni 2011 um 04:40
-- Server Version: 5.1.44
-- PHP-Version: 5.3.1
@ -71,23 +71,24 @@ CREATE TABLE IF NOT EXISTS `Counter` (
--
INSERT INTO `Counter` (`URL`, `Anz`) VALUES
('news', 187),
('news', 190),
('login', 26),
('logout', 13),
('start', 26),
('faq', 19),
('credits', 3),
('register', 3),
('register', 8),
('admin_rooms', 89),
('admin_angel_types', 71),
('user_settings', 126),
('user_messages', 113),
('admin_groups', 117),
('admin_groups', 125),
('user_questions', 55),
('admin_questions', 42),
('admin_faq', 55),
('admin_news', 32),
('news_comments', 151);
('news_comments', 151),
('admin_user', 55);
-- --------------------------------------------------------
@ -133,7 +134,7 @@ CREATE TABLE IF NOT EXISTS `GroupPrivileges` (
`privilege_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `group_id` (`group_id`,`privilege_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=51 ;
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=64 ;
--
-- Daten für Tabelle `GroupPrivileges`
@ -145,15 +146,17 @@ INSERT INTO `GroupPrivileges` (`id`, `group_id`, `privilege_id`) VALUES
(40, -2, 4),
(41, -2, 3),
(23, -1, 2),
(48, -4, 14),
(46, -4, 7),
(62, -4, 16),
(61, -4, 6),
(44, -2, 11),
(43, -2, 9),
(12, -5, 10),
(47, -4, 13),
(49, -4, 12),
(60, -4, 12),
(59, -4, 14),
(45, -2, 8),
(50, -4, 6);
(58, -4, 13),
(57, -4, 7),
(63, -4, 5);
-- --------------------------------------------------------
@ -265,7 +268,7 @@ CREATE TABLE IF NOT EXISTS `Privileges` (
`desc` varchar(1024) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=16 ;
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=17 ;
--
-- Daten für Tabelle `Privileges`
@ -286,7 +289,8 @@ INSERT INTO `Privileges` (`id`, `name`, `desc`) VALUES
(12, 'admin_questions', 'Answer user''s questions'),
(13, 'admin_faq', 'Edit FAQs'),
(14, 'admin_news', 'Administrate the news section'),
(15, 'news_comments', 'User can comment news');
(15, 'news_comments', 'User can comment news'),
(16, 'admin_user', 'Administrate the angels');
-- --------------------------------------------------------
@ -984,8 +988,8 @@ INSERT INTO `Sprache` (`TextID`, `Sprache`, `Text`) VALUES
('admin/dect.php', 'EN', 'Dect'),
('admin/dect_call.php', 'DE', ' '),
('admin/dect_call.php', 'EN', ' '),
('admin/user.php', 'DE', 'Engelliste'),
('admin/user.php', 'EN', 'Drone-list'),
('admin_user', 'DE', 'Engelliste'),
('admin_user', 'EN', 'Manage angels'),
('admin/userDefaultSetting.php', 'DE', 'Engel Voreinstellungen'),
('admin/userDefaultSetting.php', 'EN', 'Drone Default Setting'),
('admin/UserPicture.php', 'DE', 'Benutzerbilder'),
@ -1072,7 +1076,7 @@ CREATE TABLE IF NOT EXISTS `User` (
--
INSERT INTO `User` (`UID`, `Nick`, `Name`, `Vorname`, `Alter`, `Telefon`, `DECT`, `Handy`, `email`, `ICQ`, `jabber`, `Size`, `Passwort`, `Gekommen`, `Aktiv`, `Tshirt`, `color`, `Sprache`, `Avatar`, `Menu`, `lastLogIn`, `CreateDate`, `Art`, `kommentar`, `Hometown`) VALUES
(1, 'admin', '', '', 0, '', '', '', '', '', '', 'L', '21232f297a57a5a743894a0e4a801fc3', 0, 0, 0, 10, 'DE', 115, 'L', 1307072950, '0000-00-00 00:00:00', '', '', ''),
(1, 'admin', '', '', 0, '', '', '', '', '', '', 'L', '21232f297a57a5a743894a0e4a801fc3', 0, 0, 0, 10, 'DE', 115, 'L', 1307075960, '0000-00-00 00:00:00', '', '', ''),
(147, 'msquare', '', '', 23, '', '', '', 'msquare@notrademark.de', '', '', 'L', 'e10adc3949ba59abbe56e057f20f883e', 0, 0, 0, 6, 'EN', 0, 'L', 1307042703, '2011-06-02 00:55:09', '', '', '');
-- --------------------------------------------------------

View File

@ -34,32 +34,31 @@
function funktion_db_element_list_2row( $TopicName, $SQL)
{
global $con;
$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";
echo "<table class=\"border\" cellpadding=\"2\" cellspacing=\"1\">\n";
echo "<caption>$TopicName</caption>";
# echo "<tr class=\"contenttopic\"> <td><h1>$TopicName</h1></td> </tr>\n";
$Erg = mysql_query($SQL, $con);
echo mysql_error($con);
$Erg = sql_query($SQL);
echo "<tr class=\"contenttopic\">";
$html .= "<tr class=\"contenttopic\">";
for ($m = 0 ; $m < mysql_num_fields($Erg) ; $m++)
{
echo "<th>". mysql_field_name($Erg, $m). "</th>";
$html .= "<th>". mysql_field_name($Erg, $m). "</th>";
}
echo "</tr>";
$html .= "</tr>";
for ($n = 0 ; $n < mysql_num_rows($Erg) ; $n++)
{
echo "<tr class=\"content\">";
$html .= "<tr class=\"content\">";
for ($m = 0 ; $m < mysql_num_fields($Erg) ; $m++)
{
echo "<td>".mysql_result($Erg, $n, $m). "</td>";
$html .= "<td>".mysql_result($Erg, $n, $m). "</td>";
}
echo "</tr>";
$html .= "</tr>";
}
echo "</table>\n";
$html .= "</table>\n";
return $html;
}
?>

View File

@ -0,0 +1,111 @@
<?php
function admin_user() {
include ("includes/funktion_db_list.php");
$html = "";
// Userliste, keine UID uebergeben...
$html .= "<a href=\"" . page_link_to("register") . "\">Neuen Engel eintragen &raquo;</a><br /><br />\n";
if (!isset ($_GET["OrderBy"]))
$_GET["OrderBy"] = "Nick";
$SQL = "SELECT * FROM `User` ORDER BY `" . $_GET["OrderBy"] . "` ASC";
$Erg = sql_query($SQL);
// anzahl zeilen
$Zeilen = mysql_num_rows($Erg);
$html .= "Anzahl Engel: $Zeilen<br /><br />\n";
$html .= '
<table width="100%" class="border" cellpadding="2" cellspacing="1"> <thead>
<tr class="contenttopic">
<th>
<a href="' . page_link_to("admin_user") . '&OrderBy=Nick">Nick</a>
</th>
<th><a href="' . page_link_to("admin_user") . '&OrderBy=Vorname">Vorname</a> <a href="' . page_link_to("admin_user") . '&OrderBy=Name">Name</a></th>
<th><a href="' . page_link_to("admin_user") . '&OrderBy=Alter">Alter</a></th>
<th>
<a href="' . page_link_to("admin_user") . '&OrderBy=email">E-Mail</a>
</th>
<th><a href="' . page_link_to("admin_user") . '&OrderBy=Size">Gr&ouml;&szlig;e</a></th>
<th><a href="' . page_link_to("admin_user") . '&OrderBy=Gekommen">Gekommen</a></th>
<th><a href="' . page_link_to("admin_user") . '&OrderBy=Aktiv">Aktiv</a></th>
<th><a href="' . page_link_to("admin_user") . '&OrderBy=Tshirt">T-Shirt</a></th>
<th><a href="' . page_link_to("admin_user") . '&OrderBy=CreateDate">Registrier</a></th>
<th>&Auml;nd.</th>
</tr></thead>';
$Gekommen = 0;
$Active = 0;
$Tshirt = 0;
for ($n = 0; $n < $Zeilen; $n++) {
$title = "";
$user_groups = sql_select("SELECT * FROM `UserGroups` JOIN `Groups` ON (`Groups`.`UID` = `UserGroups`.`group_id`) WHERE `UserGroups`.`uid`=" . sql_escape(mysql_result($Erg, $n, "UID")) . " ORDER BY `Groups`.`Name`");
$groups = array ();
foreach ($user_groups as $user_group) {
$groups[] = $user_group['Name'];
}
$title .= 'Groups: ' . join(", ", $groups) . "<br />";
if (strlen(mysql_result($Erg, $n, "Telefon")) > 0)
$title .= "Tel: " . mysql_result($Erg, $n, "Telefon") . "<br />";
if (strlen(mysql_result($Erg, $n, "Handy")) > 0)
$title .= "Handy: " . mysql_result($Erg, $n, "Handy") . "<br />";
if (strlen(mysql_result($Erg, $n, "DECT")) > 0)
$title .= "DECT: <a href=\"./dect.php?custum=" . mysql_result($Erg, $n, "DECT") . "\">" .
mysql_result($Erg, $n, "DECT") . "</a><br />";
if (strlen(mysql_result($Erg, $n, "Hometown")) > 0)
$title .= "Hometown: " . mysql_result($Erg, $n, "Hometown") . "<br />";
if (strlen(mysql_result($Erg, $n, "lastLogIn")) > 0)
$title .= "Last login: " . date("Y-m-d H:i", mysql_result($Erg, $n, "lastLogIn")) . "<br />";
if (strlen(mysql_result($Erg, $n, "Art")) > 0)
$title .= "Type: " . mysql_result($Erg, $n, "Art") . "<br />";
if (strlen(mysql_result($Erg, $n, "ICQ")) > 0)
$title .= "ICQ: " . mysql_result($Erg, $n, "ICQ") . "<br />";
if (strlen(mysql_result($Erg, $n, "jabber")) > 0)
$title .= "jabber: " . mysql_result($Erg, $n, "jabber") . "<br />";
$html .= "<tr class=\"content\">\n";
$html .= "\t<td>" . mysql_result($Erg, $n, "Nick") . "</td>\n";
$html .= "\t<td>" . mysql_result($Erg, $n, "Vorname") . " " . mysql_result($Erg, $n, "Name") . "</td>\n";
$html .= "\t<td>" . mysql_result($Erg, $n, "Alter") . "</td>\n";
$html .= "\t<td>";
if (strlen(mysql_result($Erg, $n, "email")) > 0)
$html .= "<a href=\"mailto:" . mysql_result($Erg, $n, "email") . "\">" .
mysql_result($Erg, $n, "email") . "</a>";
$html .= '<div class="hidden">' . $title . '</div>';
$html .= "</td>\n";
$html .= "\t<td>" . mysql_result($Erg, $n, "Size") . "</td>\n";
$Gekommen += mysql_result($Erg, $n, "Gekommen");
$html .= "\t<td>" . mysql_result($Erg, $n, "Gekommen") . "</td>\n";
$Active += mysql_result($Erg, $n, "Aktiv");
$html .= "\t<td>" . mysql_result($Erg, $n, "Aktiv") . "</td>\n";
$Tshirt += mysql_result($Erg, $n, "Tshirt");
$html .= "\t<td>" . mysql_result($Erg, $n, "Tshirt") . "</td>\n";
$html .= "<td>" . mysql_result($Erg, $n, "CreateDate") . "</td>";
$html .= "\t<td>" . '<a href="">Edit</a>' .
"</td>\n";
$html .= "</tr>\n";
}
$html .= "<tr>" .
"<td></td><td></td><td></td><td></td><td></td>" .
"<td>$Gekommen</td><td>$Active</td><td>$Tshirt</td><td></td><td></td></tr>\n";
$html .= "\t</table>\n";
// Ende Userliste
$html .= "<hr /><h2>Statistics</h2>";
$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 .= "<br />\n";
$html .= funktion_db_element_list_2row("Used Groups", "SELECT Groups.Name AS 'GroupName', COUNT(Groups.Name) AS Count FROM `UserGroups` " .
"LEFT JOIN `Groups` ON Groups.UID = UserGroups.group_id " .
"WHERE (UserGroups.group_id!='NULL') " .
"GROUP BY `GroupName` " .
"");
return $html;
}
?>

View File

@ -31,6 +31,7 @@ function make_navigation() {
// Admin Navigation
$menu .= make_navigation_for(Get_Text('admin/'), array (
"admin_user",
"admin_usershifts",
"admin_questions",
"admin_angel_types",

View File

@ -120,6 +120,22 @@ textarea {
width: 300px;
}
.hidden {
background: #fff;
border: 1px solid #888;
display: none;
font-size: 12px;
padding: 4px;
}
td .hidden {
position: absolute;
}
tr:hover .hidden {
display: block;
}
.clear {
clear: both;
}

View File

@ -66,6 +66,10 @@ if (in_array($p, $privileges)) {
elseif ($p == "admin_questions") {
$content = admin_questions();
}
elseif ($p == "admin_user") {
require_once ('includes/pages/admin_user.php');
$content = admin_user();
}
elseif ($p == "admin_news") {
require_once ('includes/pages/admin_news.php');
$content = admin_news();