Remove unused PHP files related to Hyper-V and Storage dashboards
- Deleted `cluster-detail2.php`, `constants.inc copy.php`, `D.php`, and `Dashboard2.php`. These files were no longer in use and contributed to unnecessary clutter in the codebase. - Cleaned up references to removed files.
This commit is contained in:
@@ -27,7 +27,7 @@
|
||||
</head>
|
||||
|
||||
<body class="bg-light text-dark">
|
||||
<?php include $_SERVER['DOCUMENT_ROOT']."/include/db_connect.php" ; ?> <!-- Database connexion -->
|
||||
<?php include $_SERVER['DOCUMENT_ROOT']."/../../include/db_connect.php" ; ?> <!-- Database connexion -->
|
||||
<div class="container-fluid">
|
||||
<div class="row flex-nowrap">
|
||||
<!-- Left NAVBAR -->
|
||||
@@ -38,7 +38,7 @@
|
||||
<div class="col py-3">
|
||||
<?php
|
||||
$server = $_GET['server'];
|
||||
DB_ENTRY02();
|
||||
$conn = DB_ENTRY02();
|
||||
$rs = $conn->query("SELECT * FROM GlobalCrossover where Server = '$server'");
|
||||
|
||||
?>
|
||||
@@ -281,9 +281,9 @@
|
||||
|
||||
}
|
||||
?>
|
||||
<input type='text' class='form-control visually-hidden' name="server" id="server" value='<?php echo $_GET['server']; ?>'>
|
||||
<label for="server"></label><input type='text' class='form-control visually-hidden' name="server" id="server" value='<?php echo $_GET['server']; ?>'>
|
||||
<hr>
|
||||
<center><button id="button" type="submit" class="btn btn-primary btn-lg"><i class="bi bi-arrow-clockwise"></i><b> Submit</b></button></center>
|
||||
<div style="text-align: center;"><button id="button" type="submit" class="btn btn-primary btn-lg"><i class="bi bi-arrow-clockwise"></i><b> Submit</b></button></div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<?php include $_SERVER['DOCUMENT_ROOT']."/include/db_connect.php" ; ?> <!-- Database connexion -->
|
||||
<?php include $_SERVER['DOCUMENT_ROOT']."/../../include/db_connect.php" ; ?> <!-- Database connexion -->
|
||||
<div class="container-fluid">
|
||||
<div class="row flex-nowrap">
|
||||
<!-- Left NAVBAR -->
|
||||
@@ -40,7 +40,7 @@
|
||||
//var_dump($_POST);
|
||||
$server = $_POST['server'];
|
||||
// Update Databases
|
||||
DB_ENTRY02();
|
||||
$conn = DB_ENTRY02();
|
||||
if(isset($_POST['AD']) && $_POST['AD'] !==''){
|
||||
$conn->query("INSERT INTO CrossoverExclusions (server,AD) VALUES ('$server','".substr($_POST['AD'], 0, 20)."') ON DUPLICATE KEY UPDATE AD ='".substr($_POST['AD'], 0, 20)."'");
|
||||
$conn->query("UPDATE GlobalCrossover SET AD='".substr($_POST['AD'], 0, 20)."' where server = '$server'");
|
||||
@@ -81,13 +81,12 @@
|
||||
<!-- Page Title -->
|
||||
<h1><span class="badge text-bg-secondary font-weight-bold" style="width:100%;"><?php echo $server ;?></span></h1>
|
||||
<br>
|
||||
<div class="alert alert-success" role="alert"><h2><center>Exception(s) enregistrée(s) !</center></h2></div>
|
||||
<div class="alert alert-success" role="alert"><h2 class="text-center">Exception(s) enregistrée(s) !</h2></div>
|
||||
<!-- <meta http-equiv="refresh" content="3;url=/crossover/Detail.php?server=<?php //echo $server ; ?>" /> -->
|
||||
<!-- Main content -->
|
||||
</div>
|
||||
<!-- End of main content -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
|
||||
@@ -1,537 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
|
||||
<!-- Page Title -->
|
||||
<title>Web Infra Reports</title>
|
||||
|
||||
<!-- JQuery -->
|
||||
<script src="/js/jquery-3.6.1.min.js"></script>
|
||||
<!-- Bootstrap -->
|
||||
<link rel="stylesheet" href="/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="/css/bootstrap-icons/bootstrap-icons.css">
|
||||
<link rel="stylesheet" href="/css/preloader.css">
|
||||
<script src="/js/bootstrap.bundle.min.js"></script>
|
||||
<!-- Bootstrap-tables -->
|
||||
<link rel="stylesheet" href="/css/bootstrap-table.min.css">
|
||||
<script src="/js/bootstrap-table.min.js"></script>
|
||||
<script src="/js/bootstrap-table-fr-FR.min.js"></script>
|
||||
<script src="/js/tableExport.min.js"></script>
|
||||
<script src="/js/bootstrap-table-export.min.js"></script>
|
||||
<script src="/js/libs/js-xlsx/xlsx.core.min.js"></script>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<?php include $_SERVER['DOCUMENT_ROOT']."/include/preloader.inc.html" ; ?> <!-- Preloader -->
|
||||
<?php include $_SERVER['DOCUMENT_ROOT']."/include/db_connect.php" ; ?> <!-- Database connexion -->
|
||||
<?php //include $_SERVER['DOCUMENT_ROOT']."/include/functions.inc.php" ; ?> <!-- Functions -->
|
||||
<div class="container-fluid">
|
||||
<div class="row flex-nowrap">
|
||||
<!-- Left NAVBAR -->
|
||||
<div class="col-auto col-md-2 col-xl-2 px-sm-2 px-0 bg-dark" style="-ms-flex: 0 0 230px;flex: 0 0 230px;">
|
||||
<?php include $_SERVER['DOCUMENT_ROOT']."/navbar.html" ; ?> <!-- Left Navbar -->
|
||||
</div>
|
||||
<!-- Display -->
|
||||
<div class="col py-3">
|
||||
<!-- Page Title -->
|
||||
<h1><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">Global Crossover</span></h1>
|
||||
|
||||
<!-- Main content -->
|
||||
<div class="row" style="zoom: 80%">
|
||||
<!-- Get DATAs -->
|
||||
<?php
|
||||
// get all departements
|
||||
DB_Data_Read();
|
||||
$sql = "select distinct substring(dpt,1,Charindex('-',dpt)-1) as dpt1 from globalcrossover where dpt like '%-%' order by dpt1";
|
||||
$rs=odbc_exec($conn,$sql);
|
||||
$opt = "<select class='form-select' id='DPT' name='DPT'><option selected></option>";
|
||||
while ($row = odbc_fetch_array($rs)) {
|
||||
if(isset($row['dpt1'])){
|
||||
$opt .= "<option value='".$row['dpt1']."*'%>".$row['dpt1']."<b>*</b></option>" ;
|
||||
}
|
||||
}
|
||||
$opt .= "<option disabled>──────────</option>" ;
|
||||
$sql = "select distinct dpt from globalcrossover where dpt <> '' order by dpt";
|
||||
$rs=odbc_exec($conn,$sql);
|
||||
while ($row = odbc_fetch_array($rs)) {
|
||||
$opt .= "<option value='".$row['dpt']."'>".$row['dpt']."</option>" ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$opt .="</select>" ;
|
||||
|
||||
$vir="checked";$phy="checked";$dpt="";
|
||||
$where = ""; $typ="";
|
||||
if(isset($_GET['AA'])){
|
||||
$aa="checked"; $where .= "crit = 'AA' or ";
|
||||
}else{$aa="unchecked";}
|
||||
if(isset($_GET['A'])){
|
||||
$a="checked"; $where .= "crit = 'A' or ";
|
||||
}else{$a="unchecked";}
|
||||
if(isset($_GET['B'])){
|
||||
$b="checked"; $where .= "crit = 'B' or ";
|
||||
}else{$b="unchecked";}
|
||||
if(isset($_GET['C'])){
|
||||
$c="checked"; $where .= "crit = 'C' or ";
|
||||
}else{$c="unchecked";}
|
||||
if(isset($_GET['no'])){
|
||||
$no="checked"; $where .= "(crit = '' or crit is null) or ";
|
||||
}else{$no="unchecked";}
|
||||
$crit = rtrim($where, "or ");
|
||||
|
||||
if(isset($_GET['PHY'])){
|
||||
$phy="checked";
|
||||
if(!isset($_GET['VIR'])){
|
||||
$typ .= " AND virtual = 'N'";
|
||||
}
|
||||
}else{$phy="unchecked";}
|
||||
|
||||
if(isset($_GET['VIR'])){
|
||||
$vir="checked";
|
||||
if(!isset($_GET['PHY'])){
|
||||
$typ .= " AND virtual = 'Y'";
|
||||
}
|
||||
}else{$vir="unchecked";}
|
||||
|
||||
|
||||
DB_Data_Read();
|
||||
if($crit <> ""){
|
||||
$sql = "SELECT * FROM GlobalCrossover where ($crit) and Server <> '' ";
|
||||
}else{
|
||||
$sql = "SELECT * FROM GlobalCrossover where Server <> '' ";
|
||||
}
|
||||
if($typ <> ""){
|
||||
$sql .= $typ ;
|
||||
}
|
||||
|
||||
if(isset($_GET['DPT']) && $_GET['DPT'] <> ""){
|
||||
$dpt = strtoupper($_GET['DPT']);
|
||||
$d = str_replace('*','',$dpt) ;
|
||||
$sql .= " AND dpt like '$d%' " ;
|
||||
}else{
|
||||
$dpt="";
|
||||
}
|
||||
|
||||
$sql .= " order by Server";
|
||||
//echo $sql ;
|
||||
|
||||
$rs=odbc_exec($conn,$sql);
|
||||
?>
|
||||
|
||||
<!-- Criticity selection -->
|
||||
<form class="row row-cols-lg-auto g-3 align-items-center" action="/crossover/GlobalCrossover.php">
|
||||
<div class="col-12"></div>
|
||||
<div class="col-12 border rounded">
|
||||
<small>
|
||||
<b>Criticity Filter : </b>
|
||||
<div class="form-check form-check-inline form-switch">
|
||||
<input class="form-check-input" type="checkbox" role="switch" id="AA" <?php echo $aa;?> name="AA" value="1">
|
||||
<label class="form-check-label" for="AA">AA</label>
|
||||
</div>
|
||||
<div class="form-check form-check-inline form-switch">
|
||||
<input class="form-check-input" type="checkbox" role="switch" id="A" <?php echo $a;?> name="A" value="1">
|
||||
<label class="form-check-label" for="A">A</label>
|
||||
</div>
|
||||
<div class="form-check form-check-inline form-switch">
|
||||
<input class="form-check-input" type="checkbox" role="switch" id="B" <?php echo $b;?> name="B" value="1">
|
||||
<label class="form-check-label" for="B">B</label>
|
||||
</div>
|
||||
<div class="form-check form-check-inline form-switch">
|
||||
<input class="form-check-input" type="checkbox" role="switch" id="C" <?php echo $c;?> name="C" value="1">
|
||||
<label class="form-check-label" for="C">C</label>
|
||||
</div>
|
||||
<div class="form-check form-check-inline form-switch">
|
||||
<input class="form-check-input" type="checkbox" role="switch" id="no" <?php echo $no;?> name="no" value="1">
|
||||
<label class="form-check-label" for="no">Empty</label>
|
||||
</div>
|
||||
</small>
|
||||
</div>
|
||||
<div class="col-12"></div>
|
||||
<div class="col-12 border rounded">
|
||||
<small>
|
||||
<b>Type : </b>
|
||||
<div class="form-check form-check-inline form-switch">
|
||||
<input class="form-check-input" type="checkbox" role="switch" id="PHY" <?php echo $phy;?> name="PHY" value="1">
|
||||
<label class="form-check-label" for="PHY">Physical</label>
|
||||
</div>
|
||||
<div class="form-check form-check-inline form-switch">
|
||||
<input class="form-check-input" type="checkbox" role="switch" id="VIR" <?php echo $vir;?> name="VIR" value="1">
|
||||
<label class="form-check-label" for="VIR">Virtual</label>
|
||||
</div>
|
||||
</small>
|
||||
</div>
|
||||
|
||||
<div class="col-12"></div>
|
||||
<div class="col-12">
|
||||
<?php echo str_replace('<option selected></option>','<option selected>'.$dpt.'</option><option></option>',$opt); ?>
|
||||
</div>
|
||||
|
||||
<div class="col-12"></div>
|
||||
<div class="col-12">
|
||||
<button type="submit" class="btn btn-primary btn-small ">Apply</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
<table class='table table-bordered table-hover table-sm' id='t1'
|
||||
data-toggle="table" data-search="true" data-show-columns="true" data-pagination="true" data-export-types="['xlsx','csv','json']" data-loading-template="loadingTemplate"
|
||||
data-page-list="[20, 50, 100, All]" data-page-size="Tout" data-height="620" data-show-export="true" data-sortable="true"
|
||||
>
|
||||
<thead>
|
||||
<th data-field="Name" data-sortable="true">Name</th>
|
||||
<th data-field="OS" data-sortable="true">Operating System</th>
|
||||
<th data-field="Criticity" data-sortable="true">Criticity</th>
|
||||
<th data-field="Departement" data-sortable="true">Departement</th>
|
||||
<th data-field="AD" data-sortable="true">AD</th>
|
||||
<th data-field="ADlu" data-sortable="true" data-visible="false">AD Last Logon</th>
|
||||
<th data-field="GLPI" data-sortable="true">GLPI</th>
|
||||
<th data-field="GLPIlu" data-sortable="true" data-visible="false" data-footer-formatter="FI">Last FI Inventory</th>
|
||||
<th data-field="SCCM" data-sortable="true">SCCM<br></th>
|
||||
<th data-field="SCCMlu" data-sortable="true" data-visible="false">SCCM Last Heartbeat</th>
|
||||
<th data-field="EPO" data-sortable="true">EPO</th>
|
||||
<th data-field="EPOlu" data-sortable="true" data-visible="false">EPO Last Update</th>
|
||||
<th data-field="Backup" data-sortable="true">Backup</th>
|
||||
<th data-field="NBUlu" data-sortable="true" data-visible="false">Last Backup</th>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<!-- Display DATAs -->
|
||||
<?php
|
||||
$ok=0;$total=0;$nOS=0;$nAD=0;$nSCCM=0;$nGLPI=0;$nFI=0;$nEPO=0;$nNBU=0;$nDPM=0;
|
||||
while ($row = odbc_fetch_array($rs)) {
|
||||
$total++ ;
|
||||
echo "<tr>";
|
||||
if(isset($row['AD']) && isset($row['GLPI']) && isset($row['SCCM']) && isset($row['EPO']) && isset($row['NBU'])){
|
||||
echo "<td class='bg-success text-white'><b><a href='\crossover\Detail.php?server=".$row['Server']."' target='_blank' class='link-light'>".$row['Server']."</a></b></td>";
|
||||
$ok++;
|
||||
}else{
|
||||
echo "<td><b><a href='\crossover\Detail.php?server=".$row['Server']."' target='_blank'>".$row['Server']."</a></b></td>";
|
||||
}
|
||||
if($row['OS']){
|
||||
if(preg_match('(XP|2003|Windows NT|2000|2008|7)', $row['OS']) !== 1) {
|
||||
$nOS++;
|
||||
echo "<td>".$row['OS']."</td>";
|
||||
} else {
|
||||
echo "<td class='bg-warning'>".$row['OS']."</td>";
|
||||
}
|
||||
}else{
|
||||
echo "<td class='bg-warning'> </td>";
|
||||
}
|
||||
echo "<td>".$row['crit']."</td>";
|
||||
echo "<td>".$row['dpt']."</td>";
|
||||
|
||||
// AD
|
||||
if($row['AD'] == 'Y'){
|
||||
$date1=date_create($row['ADlu']);
|
||||
$diff=date_diff($date1,date_create(date("Y-m-d")));
|
||||
if($diff->format("%R%a") > 60){
|
||||
echo "<td class='text-success' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(220,53,69,1) 100%);'>OK</td>";
|
||||
echo "<td class='bg-danger text-white'>".$row['ADlu']." (".$diff->format("%R%a")." days)</td>";
|
||||
}else{
|
||||
$nAD++;
|
||||
echo "<td class='bg-success text-success'>OK</td>";
|
||||
echo "<td class='bg-success text-white'>".$row['ADlu']."</td>";
|
||||
}
|
||||
}else{
|
||||
|
||||
if(isset($row['AD'])){
|
||||
$nAD++;
|
||||
echo "<td class='bg-secondary'><small>".$row['AD']."</small></td>";
|
||||
echo "<td class='bg-secondary text-secondary'> </td>";
|
||||
$nSCCM++;
|
||||
}else{
|
||||
echo "<td class='bg-warning text-warning'>Missing</td>";
|
||||
echo "<td class='bg-warning text-warning'> </td>";
|
||||
}
|
||||
}
|
||||
|
||||
// GLPI
|
||||
if($row['GLPI'] == 'Y'){
|
||||
$date1=date_create($row['GLPIlu']);
|
||||
$diff=date_diff($date1,date_create(date("Y-m-d")));
|
||||
if($diff->format("%R%a") > 7){
|
||||
echo "<td class='text-success' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(220,53,69,1) 100%);'>OK</td>";
|
||||
echo "<td class='bg-danger text-white'>".$row['GLPIlu']." (".$diff->format("%R%a")." days)</td>";
|
||||
}else{
|
||||
if($row['GLPIlu'] <> ""){
|
||||
echo "<td class='bg-success text-success'>OK</td>";
|
||||
$nFI++;
|
||||
echo "<td class='bg-success text-white'>".$row['GLPIlu']."</td>";
|
||||
}else{
|
||||
echo "<td class='text-success' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(255,193,7,1) 100%);'>OK</td>";
|
||||
echo "<td class='bg-warning text-warning'>Missing</td>";
|
||||
}
|
||||
}
|
||||
$nGLPI++;
|
||||
}else{
|
||||
echo "<td class='bg-warning text-warning'>Missing</td>";
|
||||
echo "<td class='bg-warning text-warning'> </td>";
|
||||
}
|
||||
|
||||
// SCCM
|
||||
if($row['SCCM'] == 'Y'){
|
||||
$date1=date_create($row['SCCMlu']);
|
||||
$diff=date_diff($date1,date_create(date("Y-m-d")));
|
||||
if($diff->format("%R%a") > 7){
|
||||
echo "<td class='text-success' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(220,53,69,1) 100%);'>OK</td>";
|
||||
echo "<td class='bg-danger text-white'>".$row['SCCMlu']." (".$diff->format("%R%a")." days)</td>";
|
||||
}else{
|
||||
echo "<td class='bg-success text-success'>OK</td>";
|
||||
echo "<td class='bg-success text-white'>".$row['SCCMlu']."</td>";
|
||||
$nSCCM++;
|
||||
}
|
||||
}else{
|
||||
if(isset($row['SCCM'])){
|
||||
echo "<td class='bg-secondary'><small>".$row['SCCM']."</small></td>";
|
||||
echo "<td class='bg-secondary text-secondary'> </td>";
|
||||
$nSCCM++;
|
||||
}else{
|
||||
echo "<td class='bg-warning text-warning'>Missing</td>";
|
||||
echo "<td class='bg-warning text-warning'> </td>";
|
||||
}
|
||||
}
|
||||
|
||||
// EPO
|
||||
if($row['EPO'] == 'Y'){
|
||||
$date1=date_create($row['EPOlu']);
|
||||
$diff=date_diff($date1,date_create(date("Y-m-d")));
|
||||
if($diff->format("%R%a") > 7){
|
||||
echo "<td class='text-success' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(220,53,69,1) 100%);'>OK</td>";
|
||||
echo "<td class='bg-danger text-white'>".$row['EPOlu']." (".$diff->format("%R%a")." days)</td>";
|
||||
}else{
|
||||
echo "<td class='bg-success text-success'>OK</td>";
|
||||
echo "<td class='bg-success text-white'>".$row['EPOlu']."</td>";
|
||||
$nEPO++;
|
||||
}
|
||||
}else{
|
||||
if(isset($row['EPO'])){
|
||||
echo "<td class='bg-secondary'><small>".$row['EPO']."</small></td>";
|
||||
echo "<td class='bg-secondary text-secondary'> </td>";
|
||||
$nEPO++;
|
||||
}else{
|
||||
echo "<td class='bg-warning text-warning'>Missing</td>";
|
||||
echo "<td class='bg-warning text-warning'> </td>";
|
||||
}
|
||||
}
|
||||
|
||||
// BACKUP
|
||||
if($row['NBU'] == 'Y'){
|
||||
$date1=date_create($row['NBUlu']);
|
||||
$diff=date_diff($date1,date_create(date("Y-m-d")));
|
||||
if($diff->format("%R%a") > 30){
|
||||
echo "<td class='text-white' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(220,53,69,1) 100%);'>OK (NBU)</td>";
|
||||
echo "<td class='bg-danger text-white'>".$row['NBUlu']." (".$diff->format("%R%a")." days)</td>";
|
||||
}else{
|
||||
echo "<td class='bg-success text-white'>OK (NBU)</td>";
|
||||
echo "<td class='bg-success text-white'>".$row['NBUlu']."</td>";
|
||||
$nNBU++;
|
||||
}
|
||||
}else{
|
||||
if($row['DPM'] == 'Y'){
|
||||
$date1=date_create($row['DPMlu']);
|
||||
$diff=date_diff($date1,date_create(date("Y-m-d")));
|
||||
if($diff->format("%R%a") > 30){
|
||||
echo "<td class='text-white' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(220,53,69,1) 100%);'>OK (DPM)</td>";
|
||||
echo "<td class='bg-danger text-white'>".$row['DPMlu']." (".$diff->format("%R%a")." days)</td>";
|
||||
}else{
|
||||
echo "<td class='bg-success text-white'>OK (DPM)</td>";
|
||||
echo "<td class='bg-success text-white'>".$row['DPMlu']."</td>";
|
||||
$nDPM++;
|
||||
}
|
||||
}else{
|
||||
if(isset($row['NBU'])){
|
||||
echo "<td class='bg-secondary'><small>".$row['NBU']."</small></td>";
|
||||
echo "<td class='bg-secondary text-secondary'> </td>";
|
||||
}else{
|
||||
if(isset($row['DPM'])){
|
||||
echo "<td class='bg-secondary'><small>".$row['DPM']."</small></td>";
|
||||
echo "<td class='bg-secondary text-secondary'> </td>";
|
||||
}
|
||||
echo "<td class='bg-warning text-warning'>Missing</td>";
|
||||
echo "<td class='bg-warning text-warning'> </td>";
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
|
||||
*/
|
||||
echo "</tr>";
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
<button id="button" type="button" class="btn btn-primary btn-sm invisible"><i class="bi bi-arrow-clockwise"></i><b> Generate KPI</b></button>
|
||||
<div class="row flex-nowrap text-center" style="zoom: 80%">
|
||||
<div class="col"> <!-- CARTE Devices -->
|
||||
<div class="card border-secondary mb-3">
|
||||
<div class="card-header "><b>Devices</b></div>
|
||||
<div class="card-body">
|
||||
<h2><span class="badge text-bg-secondary font-weight-bold" id="KPIDEVICE"></span></h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col"> <!-- CARTE OS -->
|
||||
<div class="card border-secondary mb-3">
|
||||
<div class="card-header"><b>Supported OS</b></div>
|
||||
<div class="card-body">
|
||||
<h2><span class="badge text-bg-secondary font-weight-bold" id="KPIOS"></span></h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col"> <!-- CARTE AD -->
|
||||
<div class="card border-secondary mb-3">
|
||||
<div class="card-header"><b>AD</b></div>
|
||||
<div class="card-body">
|
||||
<h2><span class="badge text-bg-secondary font-weight-bold" id="KPIAD"></span></h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col"> <!-- CARTE GLPI/FI -->
|
||||
<div class="card border-secondary mb-3">
|
||||
<div class="card-header"><b>GLPI/FI</b></div>
|
||||
<div class="card-body">
|
||||
<h2><span class="badge text-bg-secondary font-weight-bold" id="KPIGLPI"></span></h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col"> <!-- CARTE SCCM -->
|
||||
<div class="card border-secondary mb-3">
|
||||
<div class="card-header"><b>SCCM</b></div>
|
||||
<div class="card-body">
|
||||
<h2><span class="badge text-bg-secondary font-weight-bold" id="KPISCCM"></span></h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col"> <!-- CARTE EPO -->
|
||||
<div class="card border-secondary mb-3">
|
||||
<div class="card-header"><b>EPO</b></div>
|
||||
<div class="card-body">
|
||||
<h2><span class="badge text-bg-secondary font-weight-bold" id="KPIEPO"></span></h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col"> <!-- CARTE NBU -->
|
||||
<div class="card border-secondary mb-3">
|
||||
<div class="card-header"><b>Backup</b></div>
|
||||
<div class="card-body">
|
||||
<h2><span class="badge text-bg-secondary font-weight-bold" id="KPINBU"></span></h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- End of main content -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo '<script type="text/javascript">', "$('#button').click();", '</script>' ;?>
|
||||
</body>
|
||||
|
||||
<script>
|
||||
function dateDiffInDays(a) {
|
||||
const _MS_PER_DAY = 1000 * 60 * 60 * 24;
|
||||
return Math.floor((Date.now() - new Date(a)) / _MS_PER_DAY);
|
||||
}
|
||||
|
||||
var $table = $('#t1')
|
||||
var $button = $('#button')
|
||||
|
||||
$(function() {
|
||||
$button.click(function () {
|
||||
$data = $table.bootstrapTable('getData')
|
||||
$dl = $data.length
|
||||
$nSCCM=0; $nAD=0; $nGLPI=0;$nEPO=0;$nNBU=0;$nOS=0;
|
||||
for( $i=0 ; $i < $dl ; $i++ ){
|
||||
if ($data[$i]['AD'] !== 'Missing') { $nAD++ ; }
|
||||
if ((dateDiffInDays($data[$i]['ADlu'].split(" ")[0]) > 60 || $data[$i]['ADlu'] == 'Missing') && $data[$i]['SCCM'] == 'OK'){ $nAD-- ;}
|
||||
if ($data[$i]['SCCM'] !== 'Missing') { $nSCCM++ ; }
|
||||
if ((dateDiffInDays($data[$i]['SCCMlu'].split(" ")[0]) > 7 || $data[$i]['SCCMlu'] == 'Missing') && $data[$i]['SCCM'] == 'OK'){ $nSCCM-- ;}
|
||||
if ($data[$i]['GLPI'] !== 'Missing') { $nGLPI++ ; }
|
||||
if ((dateDiffInDays($data[$i]['GLPIlu'].split(" ")[0]) > 7 || $data[$i]['GLPIlu'] == 'Missing') && $data[$i]['GLPI'] == 'OK'){ $nGLPI-- ;}
|
||||
if ($data[$i]['EPO'] !== 'Missing') { $nEPO++ ; }
|
||||
if ((dateDiffInDays($data[$i]['EPOlu'].split(" ")[0]) > 7 || $data[$i]['EPOlu'] == 'Missing') && $data[$i]['EPO'] == 'OK'){ $nEPO-- ;}
|
||||
if ($data[$i]['Backup'] !== 'Missing') { $nNBU++ ; }
|
||||
if ((dateDiffInDays($data[$i]['NBUlu'].split(" ")[0]) > 30 || $data[$i]['NBUlu'] == 'Missing') && $data[$i]['Backup'].split(" ")[0] == 'OK'){ $nNBU-- ;}
|
||||
if (($data[$i]['OS'].includes('XP') || $data[$i]['OS'].includes('2000') || $data[$i]['OS'].includes('2003') || $data[$i]['OS'].includes('2008') || $data[$i]['OS'].includes('7') || $data[$i]['OS'].includes('Windows NT')) == false) { $nOS++ ;}
|
||||
}
|
||||
|
||||
document.getElementById("KPIAD").innerHTML = Math.round($nAD/$dl*100) + "%";
|
||||
if(Math.round($nAD/$dl*100) >=90){
|
||||
document.getElementById("KPIAD").className = "badge text-bg-success font-weight-bold";
|
||||
}else if(Math.round($nAD/$dl*100) >=75){
|
||||
document.getElementById("KPIAD").className = "badge text-bg-warning font-weight-bold";
|
||||
}else{
|
||||
document.getElementById("KPIAD").className = "badge text-bg-danger font-weight-bold";
|
||||
}
|
||||
|
||||
document.getElementById("KPIGLPI").innerHTML = Math.round($nGLPI/$dl*100) + "%";
|
||||
if(Math.round($nGLPI/$dl*100) >=90){
|
||||
document.getElementById("KPIGLPI").className = "badge text-bg-success font-weight-bold";
|
||||
}else if(Math.round($nGLPI/$dl*100) >=75){
|
||||
document.getElementById("KPIGLPI").className = "badge text-bg-warning font-weight-bold";
|
||||
}else{
|
||||
document.getElementById("KPIGLPI").className = "badge text-bg-danger font-weight-bold";
|
||||
}
|
||||
|
||||
document.getElementById("KPISCCM").innerHTML = Math.round($nSCCM/$dl*100) + "%";
|
||||
if(Math.round($nSCCM/$dl*100) >=90){
|
||||
document.getElementById("KPISCCM").className = "badge text-bg-success font-weight-bold";
|
||||
}else if(Math.round($nSCCM/$dl*100) >=75){
|
||||
document.getElementById("KPISCCM").className = "badge text-bg-warning font-weight-bold";
|
||||
}else{
|
||||
document.getElementById("KPISCCM").className = "badge text-bg-danger font-weight-bold";
|
||||
}
|
||||
|
||||
document.getElementById("KPIEPO").innerHTML = Math.round($nEPO/$dl*100) + "%";
|
||||
if(Math.round($nEPO/$dl*100) >=90){
|
||||
document.getElementById("KPIEPO").className = "badge text-bg-success font-weight-bold";
|
||||
}else if(Math.round($nEPO/$dl*100) >=75){
|
||||
document.getElementById("KPIEPO").className = "badge text-bg-warning font-weight-bold";
|
||||
}else{
|
||||
document.getElementById("KPIEPO").className = "badge text-bg-danger font-weight-bold";
|
||||
}
|
||||
|
||||
document.getElementById("KPINBU").innerHTML = Math.round($nNBU/$dl*100) + "%";
|
||||
if(Math.round($nNBU/$dl*100) >=90){
|
||||
document.getElementById("KPINBU").className = "badge text-bg-success font-weight-bold";
|
||||
}else if(Math.round($nNBU/$dl*100) >=75){
|
||||
document.getElementById("KPINBU").className = "badge text-bg-warning font-weight-bold";
|
||||
}else{
|
||||
document.getElementById("KPINBU").className = "badge text-bg-danger font-weight-bold";
|
||||
}
|
||||
|
||||
document.getElementById("KPIOS").innerHTML = Math.round($nOS/$dl*100) + "%";
|
||||
if(Math.round($nOS/$dl*100) >=90){
|
||||
document.getElementById("KPIOS").className = "badge text-bg-success font-weight-bold";
|
||||
}else if(Math.round($nOS/$dl*100) >=75){
|
||||
document.getElementById("KPIOS").className = "badge text-bg-warning font-weight-bold";
|
||||
}else{
|
||||
document.getElementById("KPIOS").className = "badge text-bg-danger font-weight-bold";
|
||||
}
|
||||
|
||||
document.getElementById("KPIDEVICE").innerHTML = $dl;
|
||||
})
|
||||
})
|
||||
|
||||
$table.on('all.bs.table', function () {
|
||||
var $button = $('#button')
|
||||
$button.click() ;
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
<!-- remove preloader after loading -->
|
||||
<script>
|
||||
$(window).on('load', function() {
|
||||
$('.preloader').addClass('preloader-deactivate');
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
<body class="bg-light text-dark">
|
||||
<?php include $_SERVER['DOCUMENT_ROOT'] . "/include/preloader.inc.html"; ?> <!-- Preloader -->
|
||||
<?php include $_SERVER['DOCUMENT_ROOT'] . "/include/db_connect.php"; ?> <!-- Database connexion -->
|
||||
<?php include $_SERVER['DOCUMENT_ROOT'] . "/../../include/db_connect.php"; ?> <!-- Database connexion -->
|
||||
<?php //include $_SERVER['DOCUMENT_ROOT']."/include/functions.inc.php" ; ?> <!-- Functions -->
|
||||
<div class="container-fluid">
|
||||
<div class="row flex-nowrap">
|
||||
@@ -45,58 +45,12 @@
|
||||
|
||||
<!-- Main content -->
|
||||
<div class="row" style="zoom: 80%">
|
||||
<!-- Get DATAs -->
|
||||
<?php
|
||||
DB_ENTRY02();
|
||||
$result = $conn->query("select * from GlobalCrossover where server not like 'WS%' order by server ");
|
||||
if (isset($_GET['filter'])) {
|
||||
switch ($_GET['filter']) {
|
||||
case "AD":
|
||||
$result = $conn->query("select * from GlobalCrossover where AD is null or (ADlu is not null and DATEDIFF(now(),ADlu) > 45) order by server");
|
||||
echo "<h2><center><span class='badge text-bg-danger font-weight-bold'>Filter : AD non compliant</span></center></h2>";
|
||||
break;
|
||||
case "OS":
|
||||
$result = $conn->query("select * from GlobalCrossover where OS like '%2003%' or OS like '%2008%' order by server");
|
||||
echo "<h2><center><span class='badge text-bg-danger font-weight-bold'>Filter : OS non compliant</span></center></h2>";
|
||||
break;
|
||||
case "GLPI":
|
||||
$result = $conn->query("select * from GlobalCrossover where GLPI is null or GLPIlu is null or DATEDIFF(now(),GLPIlu) > 7 order by server");
|
||||
echo "<h2><center><span class='badge text-bg-danger font-weight-bold'>Filter : GLPI/FI non compliant</span></center></h2>";
|
||||
break;
|
||||
case "SCCM":
|
||||
$result = $conn->query("select * from GlobalCrossover where SCCM is null or (SCCMlu is not null and DATEDIFF(now(),SCCMlu) > 7) order by server");
|
||||
echo "<h2><center><span class='badge text-bg-danger font-weight-bold'>Filter : SCCM non compliant</span></center></h2>";
|
||||
break;
|
||||
case "NESSUS":
|
||||
$result = $conn->query("select * from GlobalCrossover where EPO is null order by server");
|
||||
echo "<h2><center><span class='badge text-bg-danger font-weight-bold'>Filter : NESSUS non compliant</span></center></h2>";
|
||||
break;
|
||||
case "NBU":
|
||||
$result = $conn->query("select * from GlobalCrossover where NBU is null or (NBUlu is not null and DATEDIFF(now(),NBUlu) > 30) order by server");
|
||||
echo "<h2><center><span class='badge text-bg-danger font-weight-bold'>Filter : Backup non compliant</span></center></h2>";
|
||||
break;
|
||||
case "SCOM":
|
||||
$result = $conn->query("select * from GlobalCrossover where SCOM is null order by server");
|
||||
echo "<h2><center><span class='badge text-bg-danger font-weight-bold'>Filter : SCOM non compliant</span></center></h2>";
|
||||
break;
|
||||
case "zabbix":
|
||||
$result = $conn->query("select * from GlobalCrossover where zabbix is null order by server");
|
||||
echo "<h2><center><span class='badge text-bg-danger font-weight-bold'>Filter : Zabbix non compliant</span></center></h2>";
|
||||
break;
|
||||
case "S1":
|
||||
$result = $conn->query("select * from GlobalCrossover where S1 is null or (S1lu is not null and DATEDIFF(now(),S1lu) > 7) order by server");
|
||||
echo "<h2><center><span class='badge text-bg-danger font-weight-bold'>Filter : SentinelOne non compliant</span></center></h2>";
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<table class='table table-bordered table-hover table-sm' id='t1' data-toggle="table" data-search="true"
|
||||
data-show-columns="true" data-pagination="true" data-export-types="['xlsx','csv','json']"
|
||||
data-loading-template="loadingTemplate" data-page-list="[20, 50, 100, All]" data-page-size="Tout"
|
||||
data-height="620" data-show-export="true" data-sortable="true">
|
||||
data-show-columns="true" data-pagination="true" data-export-types="['xlsx','csv','json']"
|
||||
data-loading-template="loadingTemplate" data-page-list="[20, 50, 100, All]" data-page-size="Tout"
|
||||
data-show-export="true" data-sortable="true">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-field="Name" data-sortable="true">Name</th>
|
||||
<th data-field="OS" data-sortable="true">Operating System</th>
|
||||
<th data-field="Criticity" data-sortable="true">Criticity</th>
|
||||
@@ -115,222 +69,226 @@
|
||||
<th data-field="Zabbix" data-sortable="true">Zabbix</th>
|
||||
<th data-field="S1" data-sortable="true">SentinelOne</th>
|
||||
<th data-field="S1lu" data-sortable="true" data-visible="false">S1 Last Update</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<!-- Display DATAs -->
|
||||
<?php
|
||||
$conn = DB_ENTRY02();
|
||||
// Base query
|
||||
$sql = "SELECT * FROM GlobalCrossover";
|
||||
$whereClauses = ["server NOT LIKE 'WS%'"];
|
||||
$params = [];
|
||||
$types = "";
|
||||
|
||||
$ok = 0;
|
||||
$total = 0;
|
||||
$nOS = 0;
|
||||
$nAD = 0;
|
||||
$nSCCM = 0;
|
||||
$nGLPI = 0;
|
||||
$nFI = 0;
|
||||
$nNESSUS = 0;
|
||||
$nNBU = 0;
|
||||
$nDPM = 0;
|
||||
$nS1 = 0;
|
||||
while ($row = mysqli_fetch_array($result)) {
|
||||
$total++;
|
||||
echo "<tr>";
|
||||
if (isset($row['AD']) && isset($row['GLPI']) && isset($row['SCCM']) && isset($row['EPO']) && (isset($row['NBU']) || isset($row['DPM'])) && isset($row['SCOM'])) {
|
||||
echo "<td class='bg-success text-white'><b><a href='\crossover\Detail.php?server=" . $row['Server'] . "' target='_blank' class='link-light'>" . $row['Server'] . "</a></b></td>";
|
||||
//echo "<td class='bg-success text-white'><b>".$row['Server']."</b></td>";
|
||||
$ok++;
|
||||
} else {
|
||||
echo "<td><b><a href='\crossover\Detail.php?server=" . $row['Server'] . "' target='_blank'>" . $row['Server'] . "</a></b></td>";
|
||||
//echo "<td><b>".$row['Server']."</b></td>";
|
||||
}
|
||||
if ($row['OS']) {
|
||||
if (preg_match('(XP|2003|Windows NT|2000|2008|Windows 7|2012)', $row['OS']) !== 1) {
|
||||
$nOS++;
|
||||
echo "<td>" . $row['OS'] . "</td>";
|
||||
} else {
|
||||
echo "<td class='bg-warning text-black'>" . $row['OS'] . "</td>";
|
||||
// Handle filters securely using prepared statements
|
||||
if (isset($_GET['filter'])) {
|
||||
$filter = $_GET['filter'];
|
||||
$filterTitle = "Filter : " . htmlspecialchars($filter) . " non compliant";
|
||||
|
||||
switch ($filter) {
|
||||
case "AD":
|
||||
$whereClauses[] = "AD IS NULL OR (ADlu IS NOT NULL AND DATEDIFF(now(), ADlu) > 45)";
|
||||
break;
|
||||
case "OS":
|
||||
$whereClauses[] = "OS LIKE '%2003%' OR OS LIKE '%2008%'";
|
||||
break;
|
||||
case "GLPI":
|
||||
$whereClauses[] = "GLPI IS NULL OR GLPIlu IS NULL OR DATEDIFF(now(), GLPIlu) > 7";
|
||||
break;
|
||||
case "SCCM":
|
||||
$whereClauses[] = "SCCM IS NULL OR (SCCMlu IS NOT NULL AND DATEDIFF(now(), SCCMlu) > 7)";
|
||||
break;
|
||||
case "NESSUS":
|
||||
$whereClauses[] = "EPO IS NULL";
|
||||
break;
|
||||
case "NBU":
|
||||
$whereClauses[] = "NBU IS NULL OR (NBUlu IS NOT NULL AND DATEDIFF(now(), NBUlu) > 30)";
|
||||
break;
|
||||
case "SCOM":
|
||||
$whereClauses[] = "SCOM IS NULL";
|
||||
break;
|
||||
case "zabbix":
|
||||
$whereClauses[] = "zabbix IS NULL";
|
||||
break;
|
||||
case "S1":
|
||||
$whereClauses[] = "S1 IS NULL OR (S1lu IS NOT NULL AND DATEDIFF(now(), S1lu) > 7)";
|
||||
break;
|
||||
default:
|
||||
$filterTitle = null; // No valid filter
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
echo "<td class='bg-warning'> </td>";
|
||||
}
|
||||
echo "<td>" . $row['crit'] . "</td>";
|
||||
echo "<td>" . $row['dpt'] . "</td>";
|
||||
|
||||
// AD
|
||||
if ($row['AD'] == 'Y') {
|
||||
$date1 = date_create($row['ADlu']);
|
||||
$diff = date_diff($date1, date_create(date("Y-m-d")));
|
||||
if ($diff->format("%R%a") > 45) {
|
||||
echo "<td class='text-white' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(220,53,69,1) 100%);'>OK</td>";
|
||||
echo "<td class='bg-danger text-white'>" . $row['ADlu'] . " (" . $diff->format("%R%a") . " days)</td>";
|
||||
} else {
|
||||
$nAD++;
|
||||
echo "<td class='bg-success text-white'>OK</td>";
|
||||
echo "<td class='bg-success text-white'>" . $row['ADlu'] . "</td>";
|
||||
}
|
||||
} else {
|
||||
|
||||
if (isset($row['AD'])) {
|
||||
$nAD++;
|
||||
echo "<td class='bg-secondary'><small>" . $row['AD'] . "</small></td>";
|
||||
echo "<td class='bg-secondary text-secondary'> </td>";
|
||||
$nSCCM++;
|
||||
} else {
|
||||
echo "<td class='bg-warning text-black'>Missing</td>";
|
||||
echo "<td class='bg-warning text-warning'> </td>";
|
||||
if ($filterTitle) {
|
||||
echo "<h2><div style=\"text-align: center;\"><span class='badge text-bg-danger font-weight-bold'>$filterTitle</span></div></h2>";
|
||||
}
|
||||
}
|
||||
|
||||
// GLPI
|
||||
if ($row['GLPI'] == 'Y') {
|
||||
$date1 = date_create($row['GLPIlu']);
|
||||
$diff = date_diff($date1, date_create(date("Y-m-d")));
|
||||
if ($diff->format("%R%a") > 7) {
|
||||
echo "<td class='text-white' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(220,53,69,1) 100%);'>OK</td>";
|
||||
echo "<td class='bg-danger text-white'>" . $row['GLPIlu'] . " (" . $diff->format("%R%a") . " days)</td>";
|
||||
} else {
|
||||
if ($row['GLPIlu'] <> "" || $row['FI'] <> "") {
|
||||
echo "<td class='bg-success text-white'>OK</td>";
|
||||
$nFI++;
|
||||
echo "<td class='bg-success text-white'>" . $row['GLPIlu'] . "</td>";
|
||||
} else {
|
||||
echo "<td class='text-white' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(255,193,7,1) 100%);'>OK</td>";
|
||||
echo "<td class='bg-warning text-black'>Missing</td>";
|
||||
// Combine all WHERE clauses
|
||||
if (!empty($whereClauses)) {
|
||||
$sql .= " WHERE " . implode(' AND ', $whereClauses);
|
||||
}
|
||||
|
||||
$sql .= " ORDER BY server";
|
||||
|
||||
// Prepare and execute the query
|
||||
$stmt = $conn->prepare($sql);
|
||||
// Note: If you had parameters, you would bind them here, e.g., $stmt->bind_param($types, ...$params);
|
||||
$stmt->execute();
|
||||
$result = $stmt->get_result();
|
||||
|
||||
|
||||
// --- PART 2: HELPER FUNCTIONS FOR RENDERING ---
|
||||
|
||||
/**
|
||||
* Renders a standard status cell based on a value and its last update date.
|
||||
* @param string|null $status The status value (e.g., 'Y', 'N').
|
||||
* @param string|null $lastUpdate The date of the last update.
|
||||
* @param int $daysThreshold The number of days to be considered "out of date".
|
||||
* @param string $okText Text to display for OK status (e.g., "OK", "OK (NBU)").
|
||||
* @return string The generated HTML for two <td> cells.
|
||||
*/
|
||||
function renderStatusCellWithDate(?string $status, ?string $lastUpdate, int $daysThreshold, string $okText = 'OK'): string {
|
||||
// Sanitize output to prevent XSS
|
||||
$status = htmlspecialchars($status ?? '', ENT_QUOTES, 'UTF-8');
|
||||
$lastUpdate = htmlspecialchars($lastUpdate ?? '', ENT_QUOTES, 'UTF-8');
|
||||
$okText = htmlspecialchars($okText, ENT_QUOTES, 'UTF-8');
|
||||
|
||||
if ($status === 'Y') {
|
||||
if (empty($lastUpdate)) {
|
||||
// Status is OK, but date is missing
|
||||
return "<td class='text-white' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(255,193,7,1) 100%);'>$okText</td>"
|
||||
. "<td class='bg-warning text-black'>Missing</td>";
|
||||
}
|
||||
}
|
||||
$nGLPI++;
|
||||
} else {
|
||||
if (isset($row['GLPI'])) {
|
||||
echo "<td class='bg-secondary'><small>" . $row['GLPI'] . "</small></td>";
|
||||
echo "<td class='bg-secondary text-secondary'> </td>";
|
||||
$nGLPI++;
|
||||
} else {
|
||||
echo "<td class='bg-warning text-black'>Missing</td>";
|
||||
echo "<td class='bg-warning text-warning'> </td>";
|
||||
}
|
||||
}
|
||||
|
||||
// SCCM
|
||||
if ($row['SCCM'] == 'Y') {
|
||||
$date1 = date_create($row['SCCMlu']);
|
||||
$diff = date_diff($date1, date_create(date("Y-m-d")));
|
||||
if ($diff->format("%R%a") > 7) {
|
||||
echo "<td class='text-white' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(220,53,69,1) 100%);'>OK</td>";
|
||||
echo "<td class='bg-danger text-white'>" . $row['SCCMlu'] . " (" . $diff->format("%R%a") . " days)</td>";
|
||||
} else {
|
||||
echo "<td class='bg-success text-white'>OK</td>";
|
||||
echo "<td class='bg-success text-white'>" . $row['SCCMlu'] . "</td>";
|
||||
$nSCCM++;
|
||||
}
|
||||
} else {
|
||||
if (isset($row['SCCM'])) {
|
||||
echo "<td class='bg-secondary'><small>" . $row['SCCM'] . "</small></td>";
|
||||
echo "<td class='bg-secondary text-secondary'> </td>";
|
||||
$nSCCM++;
|
||||
} else {
|
||||
echo "<td class='bg-warning text-black'>Missing</td>";
|
||||
echo "<td class='bg-warning text-warning'> </td>";
|
||||
}
|
||||
}
|
||||
try {
|
||||
$diff = date_diff(date_create($lastUpdate), date_create());
|
||||
$days = (int) $diff->format("%R%a");
|
||||
|
||||
// NESSUS
|
||||
if (strpos($row['EPO'], '.') !== false ) {
|
||||
echo "<td class='bg-success text-white'>".$row['EPO']."</td>";
|
||||
} else {
|
||||
if (isset($row['EPO']) && $row['EPO'] != 'Y' && $row['EPO'] != 'N') {
|
||||
echo "<td class='bg-secondary'><small>" . $row['EPO'] . "</small></td>";
|
||||
} else {
|
||||
echo "<td class='bg-warning text-black'>Missing</td>";
|
||||
$nNESSUS++;
|
||||
}
|
||||
}
|
||||
|
||||
// BACKUP
|
||||
if ($row['NBU'] == 'Y') {
|
||||
$date1 = date_create($row['NBUlu']);
|
||||
$diff = date_diff($date1, date_create(date("Y-m-d")));
|
||||
if ($diff->format("%R%a") > 30) {
|
||||
echo "<td class='text-white' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(220,53,69,1) 100%);'>OK (NBU)</td>";
|
||||
echo "<td class='bg-danger text-white'>" . $row['NBUlu'] . " (" . $diff->format("%R%a") . " days)</td>";
|
||||
} else {
|
||||
echo "<td class='bg-success text-white'>OK (NBU)</td>";
|
||||
echo "<td class='bg-success text-white'>" . $row['NBUlu'] . "</td>";
|
||||
$nNBU++;
|
||||
}
|
||||
} else {
|
||||
if ($row['DPM'] == 'Y') {
|
||||
$date1 = date_create($row['DPMlu']);
|
||||
$diff = date_diff($date1, date_create(date("Y-m-d")));
|
||||
if ($diff->format("%R%a") > 30) {
|
||||
echo "<td class='text-white' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(220,53,69,1) 100%);'>OK (DPM)</td>";
|
||||
echo "<td class='bg-danger text-white'>" . $row['DPMlu'] . " (" . $diff->format("%R%a") . " days)</td>";
|
||||
} else {
|
||||
echo "<td class='bg-success text-white'>OK (DPM)</td>";
|
||||
echo "<td class='bg-success text-white'>" . $row['DPMlu'] . "</td>";
|
||||
$nDPM++;
|
||||
}
|
||||
} else {
|
||||
if (isset($row['NBU'])) {
|
||||
echo "<td class='bg-secondary'><small>" . $row['NBU'] . "</small></td>";
|
||||
echo "<td class='bg-secondary text-secondary'> </td>";
|
||||
} else {
|
||||
if (isset($row['DPM'])) {
|
||||
echo "<td class='bg-secondary'><small>" . $row['DPM'] . "</small></td>";
|
||||
echo "<td class='bg-secondary text-secondary'> </td>";
|
||||
if ($days > $daysThreshold) {
|
||||
// Out of date
|
||||
return "<td class='text-white' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(220,53,69,1) 100%);'>$okText</td>"
|
||||
. "<td class='bg-danger text-white'>$lastUpdate ($days days)</td>";
|
||||
} else {
|
||||
// Compliant
|
||||
return "<td class='bg-success text-white'>$okText</td>"
|
||||
. "<td class='bg-success text-white'>$lastUpdate</td>";
|
||||
}
|
||||
echo "<td class='bg-warning text-black'>Missing</td>";
|
||||
echo "<td class='bg-warning text-warning'> </td>";
|
||||
} catch (Exception) {
|
||||
// Handle invalid date format gracefully
|
||||
return "<td class='bg-danger text-white'>Invalid Date</td><td class='bg-danger text-white'>$lastUpdate</td>";
|
||||
}
|
||||
}
|
||||
|
||||
if ($status !== '') {
|
||||
// Not applicable, non-supported, etc.
|
||||
return "<td class='bg-secondary'><small>$status</small></td><td class='bg-secondary text-secondary'> </td>";
|
||||
}
|
||||
|
||||
// Missing
|
||||
return "<td class='bg-warning text-black'>Missing</td><td class='bg-warning text-warning'> </td>";
|
||||
}
|
||||
|
||||
// SCOM
|
||||
if ($row['SCOM'] == 'Y') {
|
||||
echo "<td class='bg-success text-white'>OK</td>";
|
||||
} else {
|
||||
if (isset($row['SCOM'])) {
|
||||
echo "<td class='bg-secondary'><small>" . $row['SCOM'] . "</small></td>";
|
||||
// --- PART 3: CLEAN DATA DISPLAY LOOP ---
|
||||
|
||||
// Initialize counters
|
||||
$counters = [
|
||||
'total' => 0, 'ok' => 0, 'nOS' => 0, 'nAD' => 0, 'nSCCM' => 0, 'nGLPI' => 0,
|
||||
'nFI' => 0, 'nNESSUS' => 0, 'nNBU' => 0, 'nDPM' => 0, 'nS1' => 0
|
||||
];
|
||||
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$counters['total']++;
|
||||
// Sanitize server name for URL and display
|
||||
$serverName = htmlspecialchars($row['Server'], ENT_QUOTES, 'UTF-8');
|
||||
$serverUrl = urlencode($row['Server']);
|
||||
|
||||
// Determine overall row status
|
||||
$isCompliant = isset($row['AD'], $row['GLPI'], $row['SCCM'], $row['EPO']) && (isset($row['NBU']) || isset($row['DPM'])) && isset($row['SCOM']);
|
||||
if ($isCompliant) {
|
||||
$counters['ok']++;
|
||||
$serverCell = "<td class='bg-success text-white'><b><a href='/crossover/Detail.php?server=$serverUrl' target='_blank' class='link-light'>$serverName</a></b></td>";
|
||||
} else {
|
||||
$serverCell = "<td><b><a href='/crossover/Detail.php?server=$serverUrl' target='_blank'>$serverName</a></b></td>";
|
||||
}
|
||||
|
||||
// OS Cell
|
||||
$osCell = "<td class='bg-warning'> </td>";
|
||||
if (!empty($row['OS'])) {
|
||||
$os = htmlspecialchars($row['OS']);
|
||||
if (preg_match('(XP|2003|2000|2008|Windows 7|2012)', $row['OS'])) {
|
||||
$osCell = "<td class='bg-warning text-black'>$os</td>";
|
||||
} else {
|
||||
$counters['nOS']++;
|
||||
$osCell = "<td>$os</td>";
|
||||
}
|
||||
}
|
||||
|
||||
echo "<tr>";
|
||||
echo $serverCell;
|
||||
echo $osCell;
|
||||
echo "<td>" . htmlspecialchars($row['crit'] ?? '') . "</td>";
|
||||
echo "<td>" . htmlspecialchars($row['dpt'] ?? '') . "</td>";
|
||||
|
||||
// Use helper function for status columns
|
||||
echo renderStatusCellWithDate($row['AD'], $row['ADlu'], 45);
|
||||
echo renderStatusCellWithDate($row['GLPI'], $row['GLPIlu'], 7);
|
||||
echo renderStatusCellWithDate($row['SCCM'], $row['SCCMlu'], 7);
|
||||
|
||||
// NESSUS (EPO) Cell - Custom logic
|
||||
if (str_contains($row['EPO'] ?? '', '.')) {
|
||||
echo "<td class='bg-success text-white'>" . htmlspecialchars($row['EPO']) . "</td>";
|
||||
} elseif (isset($row['EPO']) && !in_array($row['EPO'], ['Y', 'N'])) {
|
||||
echo "<td class='bg-secondary'><small>" . htmlspecialchars($row['EPO']) . "</small></td>";
|
||||
} else {
|
||||
echo "<td class='bg-warning text-black'>Missing</td>";
|
||||
$counters['nNESSUS']++;
|
||||
}
|
||||
|
||||
// BACKUP Cell - Custom logic for NBU/DPM
|
||||
if ($row['NBU'] === 'Y') {
|
||||
echo renderStatusCellWithDate($row['NBU'], $row['NBUlu'], 30, 'OK (NBU)');
|
||||
} elseif ($row['DPM'] === 'Y') {
|
||||
echo renderStatusCellWithDate($row['DPM'], $row['DPMlu'], 30, 'OK (DPM)');
|
||||
} else {
|
||||
// Handle non-Y cases for NBU or DPM, or missing
|
||||
$backupStatus = $row['NBU'] ?? $row['DPM'] ?? null;
|
||||
echo renderStatusCellWithDate($backupStatus, null, 30);
|
||||
}
|
||||
|
||||
// SCOM Cell - Simple logic
|
||||
if ($row['SCOM'] === 'Y') {
|
||||
echo "<td class='bg-success text-white'>OK</td>";
|
||||
} elseif (isset($row['SCOM'])) {
|
||||
echo "<td class='bg-secondary'><small>" . htmlspecialchars($row['SCOM']) . "</small></td>";
|
||||
} else {
|
||||
echo "<td class='bg-warning text-black'>Missing</td>";
|
||||
}
|
||||
}
|
||||
|
||||
// zabbix
|
||||
if ($row['zabbix'] == 'Y' || strpos($row['zabbix'], '.') !== false ) {
|
||||
echo "<td class='bg-success text-white'>".str_replace('Y','OK',$row['zabbix'])."</td>";
|
||||
} else {
|
||||
if (isset($row['zabbix'])) {
|
||||
echo "<td class='bg-secondary'><small>" . $row['zabbix'] . "</small></td>";
|
||||
// Zabbix Cell - Simple logic
|
||||
$zabbixStatus = $row['zabbix'] ?? '';
|
||||
if ($zabbixStatus === 'Y' || str_contains($zabbixStatus, '.')) {
|
||||
echo "<td class='bg-success text-white'>" . htmlspecialchars(str_replace('Y', 'OK', $zabbixStatus)) . "</td>";
|
||||
} elseif (isset($row['zabbix'])) {
|
||||
echo "<td class='bg-secondary'><small>" . htmlspecialchars($zabbixStatus) . "</small></td>";
|
||||
} else {
|
||||
echo "<td class='bg-warning text-black'>Missing</td>";
|
||||
}
|
||||
}
|
||||
|
||||
// S1
|
||||
if ($row['S1'] == 'Y' || strpos($row['S1'], '.') !== false) {
|
||||
$date1 = date_create($row['S1lu']);
|
||||
$diff = date_diff($date1, date_create(date("Y-m-d")));
|
||||
if ($diff->format("%R%a") > 7) {
|
||||
echo "<td class='text-white' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(220,53,69,1) 100%);'>".str_replace('Y','OK',$row['S1'])."</td>";
|
||||
echo "<td class='bg-danger text-white'>" . $row['S1lu'] . " (" . $diff->format("%R%a") . " days)</td>";
|
||||
} else {
|
||||
echo "<td class='bg-success text-white'>".str_replace('Y','OK',$row['S1'])."</td>";
|
||||
echo "<td class='bg-success text-white'>" . $row['S1lu'] . "</td>";
|
||||
$nS1++;
|
||||
}
|
||||
} else {
|
||||
if (isset($row['S1'])) {
|
||||
if($row['S1'] == "N"){$row['S1'] = "Non Supported OS";}
|
||||
echo "<td class='bg-secondary'><small>" . $row['S1'] . "</small></td>";
|
||||
echo "<td class='bg-secondary text-secondary'> </td>";
|
||||
$nS1++;
|
||||
} else {
|
||||
echo "<td class='bg-warning text-black'>Missing</td>";
|
||||
echo "<td class='bg-warning text-black'> </td>";
|
||||
}
|
||||
// S1 Cell
|
||||
$s1Status = $row['S1'] ?? '';
|
||||
$s1Text = ($s1Status === 'Y' || str_contains($s1Status, '.')) ? str_replace('Y', 'OK', $s1Status) : 'OK';
|
||||
echo renderStatusCellWithDate($s1Status, $row['S1lu'], 7, $s1Text);
|
||||
|
||||
echo "</tr>";
|
||||
}
|
||||
echo "</tr>";
|
||||
}
|
||||
// You can now use the $counters array to pass data to your JS for the KPIs
|
||||
// For example:
|
||||
echo "<script>let kpiData = " . json_encode($counters) . ";</script>";
|
||||
|
||||
$stmt->close();
|
||||
$conn->close();
|
||||
?>
|
||||
</tbody>
|
||||
|
||||
@@ -450,19 +408,48 @@
|
||||
|
||||
<script src="/crossover/Crossover-KPI.js"></script>
|
||||
<script>
|
||||
var $table = $('#t1')
|
||||
var $button = $('#button')
|
||||
let $table = $('#t1');
|
||||
const $button = $('#button');
|
||||
|
||||
$table.on('search.bs.table', function () {
|
||||
var $button = $('#button')
|
||||
$button.click();
|
||||
$table.on('search.bs.table', function () {
|
||||
let $button = $('#button');
|
||||
$button.click();
|
||||
})
|
||||
|
||||
$(window).on('load', function () {
|
||||
$('.preloader').addClass('preloader-deactivate');
|
||||
});
|
||||
|
||||
document.addEventListener("DOMContentLoaded", function () { setTimeout(function () { document.getElementById('button').click(); }, 1000); });
|
||||
document.addEventListener("DOMContentLoaded", function () { setTimeout(function () { $('#button').click(); }, 1000); });
|
||||
</script>
|
||||
|
||||
<SCRIPT>
|
||||
|
||||
$(function() {
|
||||
// Exécution initiale pour définir la hauteur
|
||||
adjustTableHeight();
|
||||
|
||||
// Événement de redimensionnement
|
||||
$(window).on('resize', function() {
|
||||
adjustTableHeight();
|
||||
});
|
||||
|
||||
function adjustTableHeight() {
|
||||
const table = $('#t1');
|
||||
const windowHeight = $(window).height();
|
||||
const tableTop = table.offset().top;
|
||||
const footerHeight = -50; // Hauteur estimée pour d'éventuels éléments en bas
|
||||
let availableHeight = windowHeight - tableTop - footerHeight;
|
||||
|
||||
// Définir une hauteur minimale
|
||||
availableHeight = Math.max(availableHeight, 400);
|
||||
|
||||
table.bootstrapTable('refreshOptions', {
|
||||
height: availableHeight
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
</HTML>
|
||||
@@ -1,448 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
|
||||
<!-- Page Title -->
|
||||
<title>Web Infra Reports</title>
|
||||
<link rel="shortcut icon" type="image/png" href="/include/favicon-32x32.png">
|
||||
|
||||
<!-- JQuery -->
|
||||
<script src="/js/jquery-3.6.1.min.js"></script>
|
||||
<!-- Bootstrap -->
|
||||
<link rel="stylesheet" href="/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="/css/bootstrap-icons/bootstrap-icons.css">
|
||||
<link rel="stylesheet" href="/css/preloader.css">
|
||||
<script src="/js/bootstrap.bundle.min.js"></script>
|
||||
<!-- Bootstrap-tables -->
|
||||
<link rel="stylesheet" href="/css/bootstrap-table.min.css">
|
||||
<script src="/js/bootstrap-table.min.js"></script>
|
||||
<script src="/js/bootstrap-table-fr-FR.min.js"></script>
|
||||
<script src="/js/tableExport.min.js"></script>
|
||||
<script src="/js/bootstrap-table-export.min.js"></script>
|
||||
<script src="/js/libs/js-xlsx/xlsx.core.min.js"></script>
|
||||
|
||||
</head>
|
||||
|
||||
<body class="bg-light text-dark">
|
||||
<?php include $_SERVER['DOCUMENT_ROOT'] . "/include/preloader.inc.html"; ?> <!-- Preloader -->
|
||||
<?php include $_SERVER['DOCUMENT_ROOT'] . "/include/db_connect.php"; ?> <!-- Database connexion -->
|
||||
<?php //include $_SERVER['DOCUMENT_ROOT']."/include/functions.inc.php" ; ?> <!-- Functions -->
|
||||
<div class="container-fluid">
|
||||
<div class="row flex-nowrap">
|
||||
<!-- Left NAVBAR -->
|
||||
<div class="col-auto col-md-2 col-xl-2 px-sm-2 px-0 bg-dark" style="-ms-flex: 0 0 230px;flex: 0 0 230px;">
|
||||
<?php include $_SERVER['DOCUMENT_ROOT'] . "/navbar.html"; ?> <!-- Left Navbar -->
|
||||
</div>
|
||||
<!-- Display -->
|
||||
<div class="col py-3">
|
||||
<!-- Page Title -->
|
||||
<h1><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">Global Crossover</span></h1>
|
||||
|
||||
<!-- Main content -->
|
||||
<div class="row" style="zoom: 80%">
|
||||
<!-- Get DATAs -->
|
||||
<?php
|
||||
DB_ENTRY02();
|
||||
$result = $conn->query("select * from GlobalCrossover where server not like 'WS%' order by server ");
|
||||
if (isset($_GET['filter'])) {
|
||||
switch ($_GET['filter']) {
|
||||
case "AD":
|
||||
$result = $conn->query("select * from GlobalCrossover where AD is null or (ADlu is not null and DATEDIFF(now(),ADlu) > 45) order by server");
|
||||
echo "<h2><center><span class='badge text-bg-danger font-weight-bold'>Filter : AD non compliant</span></center></h2>";
|
||||
break;
|
||||
case "OS":
|
||||
$result = $conn->query("select * from GlobalCrossover where OS like '%2003%' or OS like '%2008%' order by server");
|
||||
echo "<h2><center><span class='badge text-bg-danger font-weight-bold'>Filter : OS non compliant</span></center></h2>";
|
||||
break;
|
||||
case "GLPI":
|
||||
$result = $conn->query("select * from GlobalCrossover where GLPI is null or GLPIlu is null or DATEDIFF(now(),GLPIlu) > 7 order by server");
|
||||
echo "<h2><center><span class='badge text-bg-danger font-weight-bold'>Filter : GLPI/FI non compliant</span></center></h2>";
|
||||
break;
|
||||
case "SCCM":
|
||||
$result = $conn->query("select * from GlobalCrossover where SCCM is null or (SCCMlu is not null and DATEDIFF(now(),SCCMlu) > 7) order by server");
|
||||
echo "<h2><center><span class='badge text-bg-danger font-weight-bold'>Filter : SCCM non compliant</span></center></h2>";
|
||||
break;
|
||||
case "EPO":
|
||||
$result = $conn->query("select * from GlobalCrossover where EPO is null or (EPOlu is not null and DATEDIFF(now(),EPOlu) > 7) order by server");
|
||||
echo "<h2><center><span class='badge text-bg-danger font-weight-bold'>Filter : EPO non compliant</span></center></h2>";
|
||||
break;
|
||||
case "NBU":
|
||||
$result = $conn->query("select * from GlobalCrossover where NBU is null or (NBUlu is not null and DATEDIFF(now(),NBUlu) > 30) order by server");
|
||||
echo "<h2><center><span class='badge text-bg-danger font-weight-bold'>Filter : Backup non compliant</span></center></h2>";
|
||||
break;
|
||||
case "SCOM":
|
||||
$result = $conn->query("select * from GlobalCrossover where SCOM is null order by server");
|
||||
echo "<h2><center><span class='badge text-bg-danger font-weight-bold'>Filter : SCOM non compliant</span></center></h2>";
|
||||
break;
|
||||
case "zabbix":
|
||||
$result = $conn->query("select * from GlobalCrossover where zabbix is null order by server");
|
||||
echo "<h2><center><span class='badge text-bg-danger font-weight-bold'>Filter : Zabbix non compliant</span></center></h2>";
|
||||
break;
|
||||
case "S1":
|
||||
$result = $conn->query("select * from GlobalCrossover where S1 is null or (S1lu is not null and DATEDIFF(now(),S1lu) > 7) order by server");
|
||||
echo "<h2><center><span class='badge text-bg-danger font-weight-bold'>Filter : SentinelOne non compliant</span></center></h2>";
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<table class='table table-bordered table-hover table-sm' id='t1' data-toggle="table" data-search="true"
|
||||
data-show-columns="true" data-pagination="true" data-export-types="['xlsx','csv','json']"
|
||||
data-loading-template="loadingTemplate" data-page-list="[20, 50, 100, All]" data-page-size="Tout"
|
||||
data-height="620" data-show-export="true" data-sortable="true">
|
||||
<thead>
|
||||
<th data-field="Name" data-sortable="true">Name</th>
|
||||
<th data-field="OS" data-sortable="true">Operating System</th>
|
||||
<th data-field="Criticity" data-sortable="true">Criticity</th>
|
||||
<th data-field="Departement" data-sortable="true" data-visible="false">Departement</th>
|
||||
<th data-field="AD" data-sortable="true">AD</th>
|
||||
<th data-field="ADlu" data-sortable="true" data-visible="false">AD Last Logon</th>
|
||||
<th data-field="GLPI" data-sortable="true">GLPI</th>
|
||||
<th data-field="GLPIlu" data-sortable="true" data-visible="false" data-footer-formatter="FI">Last FI
|
||||
Inventory
|
||||
</th>
|
||||
<th data-field="SCCM" data-sortable="true">SCCM<br></th>
|
||||
<th data-field="SCCMlu" data-sortable="true" data-visible="false">SCCM Last Heartbeat</th>
|
||||
<th data-field="Backup" data-sortable="true">Backup</th>
|
||||
<th data-field="NBUlu" data-sortable="true" data-visible="false">Last Backup</th>
|
||||
<th data-field="SCOM" data-sortable="true">SCOM</th>
|
||||
<th data-field="Zabbix" data-sortable="true">Zabbix</th>
|
||||
<th data-field="S1" data-sortable="true">SentinelOne</th>
|
||||
<th data-field="S1lu" data-sortable="true" data-visible="false">S1 Last Update</th>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<!-- Display DATAs -->
|
||||
<?php
|
||||
|
||||
$ok = 0;
|
||||
$total = 0;
|
||||
$nOS = 0;
|
||||
$nAD = 0;
|
||||
$nSCCM = 0;
|
||||
$nGLPI = 0;
|
||||
$nFI = 0;
|
||||
$nNBU = 0;
|
||||
$nDPM = 0;
|
||||
$nS1 = 0;
|
||||
while ($row = mysqli_fetch_array($result)) {
|
||||
$total++;
|
||||
echo "<tr>";
|
||||
if (isset($row['AD']) && isset($row['GLPI']) && isset($row['SCCM']) && isset($row['EPO']) && (isset($row['NBU']) || isset($row['DPM'])) && isset($row['SCOM'])) {
|
||||
echo "<td class='bg-success text-white'><b><a href='\crossover\Detail.php?server=" . $row['Server'] . "' target='_blank' class='link-light'>" . $row['Server'] . "</a></b></td>";
|
||||
//echo "<td class='bg-success text-white'><b>".$row['Server']."</b></td>";
|
||||
$ok++;
|
||||
} else {
|
||||
echo "<td><b><a href='\crossover\Detail.php?server=" . $row['Server'] . "' target='_blank'>" . $row['Server'] . "</a></b></td>";
|
||||
//echo "<td><b>".$row['Server']."</b></td>";
|
||||
}
|
||||
if ($row['OS']) {
|
||||
if (preg_match('(XP|2003|Windows NT|2000|2008|Windows 7|2012)', $row['OS']) !== 1) {
|
||||
$nOS++;
|
||||
echo "<td>" . $row['OS'] . "</td>";
|
||||
} else {
|
||||
echo "<td class='bg-warning'>" . $row['OS'] . "</td>";
|
||||
}
|
||||
} else {
|
||||
echo "<td class='bg-warning'> </td>";
|
||||
}
|
||||
echo "<td>" . $row['crit'] . "</td>";
|
||||
echo "<td>" . $row['dpt'] . "</td>";
|
||||
|
||||
// AD
|
||||
if ($row['AD'] == 'Y') {
|
||||
$date1 = date_create($row['ADlu']);
|
||||
$diff = date_diff($date1, date_create(date("Y-m-d")));
|
||||
if ($diff->format("%R%a") > 45) {
|
||||
echo "<td class='text-white' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(220,53,69,1) 100%);'>OK</td>";
|
||||
echo "<td class='bg-danger text-white'>" . $row['ADlu'] . " (" . $diff->format("%R%a") . " days)</td>";
|
||||
} else {
|
||||
$nAD++;
|
||||
echo "<td class='bg-success text-white'>OK</td>";
|
||||
echo "<td class='bg-success text-white'>" . $row['ADlu'] . "</td>";
|
||||
}
|
||||
} else {
|
||||
|
||||
if (isset($row['AD'])) {
|
||||
$nAD++;
|
||||
echo "<td class='bg-secondary'><small>" . $row['AD'] . "</small></td>";
|
||||
echo "<td class='bg-secondary text-secondary'> </td>";
|
||||
$nSCCM++;
|
||||
} else {
|
||||
echo "<td class='bg-warning text-warning'>Missing</td>";
|
||||
echo "<td class='bg-warning text-warning'> </td>";
|
||||
}
|
||||
}
|
||||
|
||||
// GLPI
|
||||
if ($row['GLPI'] == 'Y') {
|
||||
$date1 = date_create($row['GLPIlu']);
|
||||
$diff = date_diff($date1, date_create(date("Y-m-d")));
|
||||
if ($diff->format("%R%a") > 7) {
|
||||
echo "<td class='text-white' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(220,53,69,1) 100%);'>OK</td>";
|
||||
echo "<td class='bg-danger text-white'>" . $row['GLPIlu'] . " (" . $diff->format("%R%a") . " days)</td>";
|
||||
} else {
|
||||
if ($row['GLPIlu'] <> "" || $row['FI'] <> "") {
|
||||
echo "<td class='bg-success text-white'>OK</td>";
|
||||
$nFI++;
|
||||
echo "<td class='bg-success text-white'>" . $row['GLPIlu'] . "</td>";
|
||||
} else {
|
||||
echo "<td class='text-white' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(255,193,7,1) 100%);'>OK</td>";
|
||||
echo "<td class='bg-warning text-warning'>Missing</td>";
|
||||
}
|
||||
}
|
||||
$nGLPI++;
|
||||
} else {
|
||||
if (isset($row['GLPI'])) {
|
||||
echo "<td class='bg-secondary'><small>" . $row['GLPI'] . "</small></td>";
|
||||
echo "<td class='bg-secondary text-secondary'> </td>";
|
||||
$nGLPI++;
|
||||
} else {
|
||||
echo "<td class='bg-warning text-warning'>Missing</td>";
|
||||
echo "<td class='bg-warning text-warning'> </td>";
|
||||
}
|
||||
}
|
||||
|
||||
// SCCM
|
||||
if ($row['SCCM'] == 'Y') {
|
||||
$date1 = date_create($row['SCCMlu']);
|
||||
$diff = date_diff($date1, date_create(date("Y-m-d")));
|
||||
if ($diff->format("%R%a") > 7) {
|
||||
echo "<td class='text-white' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(220,53,69,1) 100%);'>OK</td>";
|
||||
echo "<td class='bg-danger text-white'>" . $row['SCCMlu'] . " (" . $diff->format("%R%a") . " days)</td>";
|
||||
} else {
|
||||
echo "<td class='bg-success text-white'>OK</td>";
|
||||
echo "<td class='bg-success text-white'>" . $row['SCCMlu'] . "</td>";
|
||||
$nSCCM++;
|
||||
}
|
||||
} else {
|
||||
if (isset($row['SCCM'])) {
|
||||
echo "<td class='bg-secondary'><small>" . $row['SCCM'] . "</small></td>";
|
||||
echo "<td class='bg-secondary text-secondary'> </td>";
|
||||
$nSCCM++;
|
||||
} else {
|
||||
echo "<td class='bg-warning text-warning'>Missing</td>";
|
||||
echo "<td class='bg-warning text-warning'> </td>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// BACKUP
|
||||
if ($row['NBU'] == 'Y') {
|
||||
$date1 = date_create($row['NBUlu']);
|
||||
$diff = date_diff($date1, date_create(date("Y-m-d")));
|
||||
if ($diff->format("%R%a") > 30) {
|
||||
echo "<td class='text-white' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(220,53,69,1) 100%);'>OK (NBU)</td>";
|
||||
echo "<td class='bg-danger text-white'>" . $row['NBUlu'] . " (" . $diff->format("%R%a") . " days)</td>";
|
||||
} else {
|
||||
echo "<td class='bg-success text-white'>OK (NBU)</td>";
|
||||
echo "<td class='bg-success text-white'>" . $row['NBUlu'] . "</td>";
|
||||
$nNBU++;
|
||||
}
|
||||
} else {
|
||||
if ($row['DPM'] == 'Y') {
|
||||
$date1 = date_create($row['DPMlu']);
|
||||
$diff = date_diff($date1, date_create(date("Y-m-d")));
|
||||
if ($diff->format("%R%a") > 30) {
|
||||
echo "<td class='text-white' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(220,53,69,1) 100%);'>OK (DPM)</td>";
|
||||
echo "<td class='bg-danger text-white'>" . $row['DPMlu'] . " (" . $diff->format("%R%a") . " days)</td>";
|
||||
} else {
|
||||
echo "<td class='bg-success text-white'>OK (DPM)</td>";
|
||||
echo "<td class='bg-success text-white'>" . $row['DPMlu'] . "</td>";
|
||||
$nDPM++;
|
||||
}
|
||||
} else {
|
||||
if (isset($row['NBU'])) {
|
||||
echo "<td class='bg-secondary'><small>" . $row['NBU'] . "</small></td>";
|
||||
echo "<td class='bg-secondary text-secondary'> </td>";
|
||||
} else {
|
||||
if (isset($row['DPM'])) {
|
||||
echo "<td class='bg-secondary'><small>" . $row['DPM'] . "</small></td>";
|
||||
echo "<td class='bg-secondary text-secondary'> </td>";
|
||||
}
|
||||
echo "<td class='bg-warning text-warning'>Missing</td>";
|
||||
echo "<td class='bg-warning text-warning'> </td>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// SCOM
|
||||
if ($row['SCOM'] == 'Y') {
|
||||
echo "<td class='bg-success text-white'>OK</td>";
|
||||
} else {
|
||||
if (isset($row['SCOM'])) {
|
||||
echo "<td class='bg-secondary'><small>" . $row['SCOM'] . "</small></td>";
|
||||
} else {
|
||||
echo "<td class='bg-warning text-warning'>Missing</td>";
|
||||
}
|
||||
}
|
||||
|
||||
// zabbix
|
||||
if ($row['zabbix'] == 'Y' || strpos($row['zabbix'], '.') !== false) {
|
||||
echo "<td class='bg-success text-white'>" . str_replace('Y', 'OK', $row['zabbix']) . "</td>";
|
||||
} else {
|
||||
if (isset($row['zabbix'])) {
|
||||
echo "<td class='bg-secondary'><small>" . $row['zabbix'] . "</small></td>";
|
||||
} else {
|
||||
echo "<td class='bg-warning text-warning'>Missing</td>";
|
||||
}
|
||||
}
|
||||
|
||||
// S1
|
||||
if ($row['S1'] == 'Y') {
|
||||
$date1 = date_create($row['S1lu']);
|
||||
$diff = date_diff($date1, date_create(date("Y-m-d")));
|
||||
if ($diff->format("%R%a") > 7) {
|
||||
echo "<td class='text-white' style='background: linear-gradient(90deg, rgba(25,135,84,1) 50%, rgba(220,53,69,1) 100%);'>OK</td>";
|
||||
echo "<td class='bg-danger text-white'>" . $row['S1lu'] . " (" . $diff->format("%R%a") . " days)</td>";
|
||||
} else {
|
||||
echo "<td class='bg-success text-white'>OK</td>";
|
||||
echo "<td class='bg-success text-white'>" . $row['S1lu'] . "</td>";
|
||||
$nS1++;
|
||||
}
|
||||
} else {
|
||||
if (isset($row['S1'])) {
|
||||
echo "<td class='bg-secondary'><small>" . $row['S1'] . "</small></td>";
|
||||
echo "<td class='bg-secondary text-secondary'> </td>";
|
||||
$nS1++;
|
||||
} else {
|
||||
echo "<td class='bg-warning text-warning'>Missing</td>";
|
||||
echo "<td class='bg-warning text-warning'> </td>";
|
||||
}
|
||||
}
|
||||
echo "</tr>";
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
<button id="button" type="button" class="btn btn-primary btn-sm invisible"><i
|
||||
class="bi bi-arrow-clockwise"></i><b> Generate KPI</b></button>
|
||||
<div class="row flex-nowrap text-center" style="zoom: 80%">
|
||||
<div class="col"> <!-- CARTE Devices -->
|
||||
<div class="card border-secondary mb-3">
|
||||
<div class="card-header text-dark"><b>All Devices</b></div>
|
||||
<a href="/crossover/GlobalCrossover.php">
|
||||
<div class="card-body">
|
||||
<h2><span class="badge text-bg-primary font-weight-bold" id="KPIDEVICE"></span></h2>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col"> <!-- CARTE OS -->
|
||||
<div class="card border-secondary mb-3">
|
||||
<div class="card-header text-dark"><b>Supported OS</b></div>
|
||||
<a href="/crossover/GlobalCrossover.php?filter=OS">
|
||||
<div class="card-body">
|
||||
<h2><span class="badge text-bg-secondary font-weight-bold" id="KPIOS"></span></h2>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col"> <!-- CARTE AD -->
|
||||
<div class="card border-secondary mb-3">
|
||||
<div class="card-header text-dark"><b>AD</b></div>
|
||||
<a href="/crossover/GlobalCrossover.php?filter=AD">
|
||||
<div class="card-body">
|
||||
<h2><span class="badge text-bg-secondary font-weight-bold" id="KPIAD"></span></h2>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col"> <!-- CARTE GLPI/FI -->
|
||||
<div class="card border-secondary mb-3">
|
||||
<div class="card-header text-dark"><b>GLPI/FI</b></div>
|
||||
<a href="/crossover/GlobalCrossover.php?filter=GLPI">
|
||||
<div class="card-body">
|
||||
<h2><span class="badge text-bg-secondary font-weight-bold" id="KPIGLPI"></span></h2>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col"> <!-- CARTE SCCM -->
|
||||
<div class="card border-secondary mb-3">
|
||||
<div class="card-header text-dark"><b>SCCM</b></div>
|
||||
<a href="/crossover/GlobalCrossover.php?filter=SCCM">
|
||||
<div class="card-body">
|
||||
<h2><span class="badge text-bg-secondary font-weight-bold" id="KPISCCM"></span></h2>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col"> <!-- CARTE Backup (NBU + DPM) -->
|
||||
<div class="card border-secondary mb-3">
|
||||
<div class="card-header text-dark"><b>Backup</b></div>
|
||||
<a href="/crossover/GlobalCrossover.php?filter=NBU">
|
||||
<div class="card-body">
|
||||
<h2><span class="badge text-bg-secondary font-weight-bold" id="KPINBU"></span></h2>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col"> <!-- CARTE SCOM -->
|
||||
<div class="card border-secondary mb-3">
|
||||
<div class="card-header text-dark"><b>SCOM</b></div>
|
||||
<a href="/crossover/GlobalCrossover.php?filter=SCOM">
|
||||
<div class="card-body">
|
||||
<h2><span class="badge text-bg-secondary font-weight-bold" id="KPISCOM"></span></h2>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col"> <!-- CARTE Zabbix -->
|
||||
<div class="card border-secondary mb-3">
|
||||
<div class="card-header text-dark"><b>Zabbix</b></div>
|
||||
<a href="/crossover/GlobalCrossover.php?filter=zabbix">
|
||||
<div class="card-body">
|
||||
<h2><span class="badge text-bg-secondary font-weight-bold" id="KPIzabbix"></span></h2>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col"> <!-- CARTE SentinelOne -->
|
||||
<div class="card border-secondary mb-3">
|
||||
<div class="card-header text-dark"><b>SentinelOne</b></div>
|
||||
<a href="/crossover/GlobalCrossover.php?filter=S1">
|
||||
<div class="card-body">
|
||||
<h2><span class="badge text-bg-secondary font-weight-bold" id="KPIS1"></span></h2>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- End of main content -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="/js/switch.js"></script>
|
||||
|
||||
</body>
|
||||
|
||||
<script src="/crossover/Crossover-KPI.js"></script>
|
||||
<script>
|
||||
var $table = $('#t1')
|
||||
var $button = $('#button')
|
||||
|
||||
$table.on('search.bs.table', function () {
|
||||
var $button = $('#button')
|
||||
$button.click();
|
||||
})
|
||||
|
||||
$(window).on('load', function () {
|
||||
$('.preloader').addClass('preloader-deactivate');
|
||||
});
|
||||
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
setTimeout(function () {
|
||||
document.getElementById('button').click();
|
||||
}, 1000);
|
||||
});
|
||||
</script>
|
||||
|
||||
</HTML>
|
||||
Reference in New Issue
Block a user