add result count and logic for no results
This commit is contained in:
+19
-12
@@ -45,6 +45,7 @@ if (isset($_GET['group'])) {
|
||||
}
|
||||
curl_close($ch);
|
||||
$data = json_decode($response, true);
|
||||
$numResults = count($data);
|
||||
// build the group array
|
||||
$gpoMap = []; // will look like: [ 'GPO‑Name' => ['Administrator' => [...], 'vnc_admin' => [...]] ]
|
||||
|
||||
@@ -74,21 +75,27 @@ if (isset($_GET['group'])) {
|
||||
}
|
||||
}
|
||||
ksort($gpoMap, SORT_STRING | SORT_FLAG_CASE);
|
||||
echo '<table border="1" cellpadding="4" cellspacing="0">';
|
||||
echo '<tr><th>GPO</th><th>Administrators</th><th>vnc_admin</th></tr>';
|
||||
if($numResults > 0){
|
||||
echo 'Total results: '.$numResults.'<br>';
|
||||
echo '<table border="1" cellpadding="4" cellspacing="0">';
|
||||
echo '<tr><th>GPO</th><th>Administrators</th><th>vnc_admin</th></tr>';
|
||||
|
||||
foreach ($gpoMap as $gpoName => $cols) {
|
||||
// Remove duplicates and build comma‑separated lists
|
||||
$adminGroups = implode('<br>', array_unique($cols['administrators']));
|
||||
$vncGroups = implode('<br>', array_unique($cols['vnc_admin']));
|
||||
foreach ($gpoMap as $gpoName => $cols) {
|
||||
// Remove duplicates and build comma‑separated lists
|
||||
$adminGroups = implode('<br>', array_unique($cols['administrators']));
|
||||
$vncGroups = implode('<br>', array_unique($cols['vnc_admin']));
|
||||
|
||||
echo '<tr>';
|
||||
echo "<td>{$gpoName}</td>";
|
||||
echo "<td>{$adminGroups}</td>";
|
||||
echo "<td>{$vncGroups}</td>";
|
||||
echo '</tr>';
|
||||
echo '<tr>';
|
||||
echo "<td>{$gpoName}</td>";
|
||||
echo "<td>{$adminGroups}</td>";
|
||||
echo "<td>{$vncGroups}</td>";
|
||||
echo '</tr>';
|
||||
}
|
||||
echo '</table>';
|
||||
}
|
||||
else{
|
||||
echo 'No results found for query.<p>';
|
||||
}
|
||||
echo '</table>';
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user