167 lines
4.2 KiB
PHP
167 lines
4.2 KiB
PHP
<?php
|
|
/*
|
|
# Fuer debugging
|
|
error_reporting(E_ALL);
|
|
ini_set('display_errors', 1);
|
|
#echo __LINE__."<br>";
|
|
*/
|
|
error_reporting(E_ALL);
|
|
ini_set('display_errors', 1);
|
|
|
|
|
|
include_once 'classes/lg-on_Smarty.class.php';
|
|
$smarty = new lgon_Smarty();
|
|
require_once("config.inc.php");
|
|
require_once("func_rollenrechte.php");
|
|
$templatename = substr(basename($_SERVER['PHP_SELF']),0,-3)."html";
|
|
require_once "language/german.inc.php";
|
|
|
|
|
|
// Rechteüberprüfung
|
|
$db = dbconnect();
|
|
if ($user_admin == ""){ require("index.php"); exit;} //Wenn man nicht angemeldet ist, darf man nicht auf die Seite
|
|
if(!rore($user_admin,'a_stat','RE')){require("lib/rechte.php");exit;}
|
|
// Rechteüberprüfung ende
|
|
|
|
|
|
|
|
|
|
if(!isset($_GET["sort"])){
|
|
$sort = "datumsort";
|
|
}else{
|
|
$sort = $_GET["sort"];
|
|
}
|
|
$smarty->assign('sort', "$sort");
|
|
|
|
if(!isset($_GET["option"])){
|
|
$option = "ASC";
|
|
}else{
|
|
$option = $_GET["option"];
|
|
}
|
|
if($option == 'ASC'){
|
|
$smarty->assign('option', 'DESC');
|
|
$option = "DESC";
|
|
}else{
|
|
$smarty->assign('option', 'ASC');
|
|
$option = "ASC";
|
|
}
|
|
|
|
|
|
|
|
// DATABASE variables and query
|
|
$db = dbconnect();
|
|
|
|
// Rechteüberprüfung historie
|
|
if(rore($user_admin,'r_historie','RE')){
|
|
$rechte = 1;
|
|
}else{
|
|
$rechte = 0;
|
|
}
|
|
// Rechteüberprüfung ende
|
|
|
|
|
|
$query = "SELECT u.vaid, u.vorname, u.nachname, u.user, COUNT(l.`uid`) as `logins`, DATE_Format(max(datum), '%d.%m.%Y %H:%i:%s') as datum, DATE_Format(max(datum), '%Y%m%d%H%i%s') as datumsort
|
|
FROM `admin` as u
|
|
LEFT JOIN `userlog` as l
|
|
ON u.`user` = l.`uid`
|
|
WHERE u.inaktiv !='J'
|
|
GROUP BY u.`user`
|
|
ORDER BY $sort $option ";
|
|
|
|
$result = $db->query( $query)
|
|
or die ("Cannot execute query");
|
|
|
|
while ($row = $result->fetch_array()){
|
|
$nachname2 = str_replace(' ', '|', $row['nachname']);
|
|
$vorname2 = str_replace(' ', '|', $row['vorname']);
|
|
|
|
if($rechte == 1){
|
|
|
|
$result_rechte_anz = $db->query("SELECT count(*) Anz
|
|
FROM historie
|
|
WHERE vaid='$row[vaid]'");
|
|
$row_rechte_anz = $result_rechte_anz->fetch_array();
|
|
if($row_rechte_anz['Anz'] > 0){
|
|
$rechte_anz = 1;
|
|
}else{
|
|
$rechte_anz = 0;
|
|
}
|
|
|
|
}
|
|
|
|
if($rechte == 1 and $rechte_anz == 1){
|
|
$link = 1;
|
|
}else{
|
|
$link = 0;
|
|
}
|
|
|
|
$row['vorname2'] = $vorname2;
|
|
$row['nachname2'] = $nachname2;
|
|
$row['link'] = $link;
|
|
$value[] = $row;
|
|
}
|
|
|
|
$smarty->assign('table_data', $value);
|
|
|
|
|
|
|
|
$query2 = "SELECT u.vaid, u.vorname, u.nachname, u.user, COUNT(l.`uid`) as `logins`, DATE_Format(max(datum), '%d.%m.%Y %H:%i:%s') as datum, DATE_Format(max(datum), '%Y%m%d%H%i%s') as datumsort
|
|
FROM `admin` as u
|
|
LEFT JOIN `userlog` as l
|
|
ON u.`user` = l.`uid`
|
|
WHERE u.inaktiv ='J'
|
|
GROUP BY u.`user`
|
|
ORDER BY $sort $option ";
|
|
$result2 = $db->query( $query2)
|
|
or die ("Cannot execute query2");
|
|
|
|
while ($row2 = $result2->fetch_array()){
|
|
$nachname2 = str_replace(' ', '|', $row2['nachname']);
|
|
$vorname2 = str_replace(' ', '|', $row2['vorname']);
|
|
|
|
if($rechte == 1){
|
|
|
|
$result_rechte_anz = $db->query("SELECT count(*) Anz
|
|
FROM historie
|
|
WHERE vaid='$row2[vaid]'");
|
|
|
|
$row_rechte_anz = $result_rechte_anz->fetch_array();
|
|
|
|
if($row_rechte_anz['Anz'] > 0){
|
|
$rechte_anz = 1;
|
|
}else{
|
|
$rechte_anz = 0;
|
|
}
|
|
|
|
}
|
|
|
|
if($rechte == 1 and $rechte_anz == 1){
|
|
$link = 1;
|
|
}else{
|
|
$link = 0;
|
|
}
|
|
|
|
$row2['vorname2'] = $vorname2;
|
|
$row2['nachname2'] = $nachname2;
|
|
$row2['link'] = $link;
|
|
$value2[] = $row2;
|
|
}
|
|
$smarty->assign('table_data2', $value2);
|
|
|
|
|
|
$result = $db->query("SELECT COUNT(*) as Anzahl FROM userlog");
|
|
$userlog = $result->fetch_array();
|
|
|
|
$smarty->assign('Anzahl', "$userlog[Anzahl]");
|
|
|
|
$result2 = $db->query("SELECT datum as datsort, DATE_Format(datum, '%d.%m.%Y') as datum FROM userlog ORDER BY datsort ASC limit 1");
|
|
$firstuser = $result2->fetch_array();
|
|
|
|
$smarty->assign('DatumFirst', "$firstuser[datum]");
|
|
|
|
|
|
$smarty->assign('useronline_stat_month', "<img src='./graph.php'>");
|
|
$smarty->assign('useronline_stat_user', "<img src='./graph_user.php'>");
|
|
|
|
$smarty->display("$template/$templatename");
|
|
?>
|