This repository has been archived by the owner on May 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 90
/
Copy pathshow-all-agents.php
73 lines (72 loc) · 2.76 KB
/
show-all-agents.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
// include files
require_once("includes/check-authorize.php");
require_once("includes/functions.php");
$count = 0;
$empire_agents = "";
$arr_result = get_all_agents($sess_ip, $sess_port, $sess_token);
if(!empty($arr_result))
{
if(array_key_exists("agents", $arr_result))
{
if(sizeof($arr_result["agents"])>0)
{
$empire_agents .= "<div class='panel-group'>";
for($i=0; $i<sizeof($arr_result["agents"]); $i++)
{
$empire_agents .= "<div class='panel panel-success'>
<div class='panel-heading'><h4 class='panel-title'><a data-toggle='collapse' href='#collapse$i'>Agent Name: ".htmlentities($arr_result["agents"][$i]["name"])."</a></h4></div>
<div id='collapse$i' class='panel-collapse collapse'>
<div class='panel-body'>";
$empire_agents .= '<table class="table table-hover table-striped table-bordered"><thead><tr><th>Agent Option</th><th>Agent Value</th></tr></thead><tbody>';
foreach($arr_result["agents"][$i] as $key => $value)
{
$key = htmlentities($key);
$value = htmlentities($value);
$empire_agents .= "<tr><td>$key</td><td>$value</td></tr>";
}
$empire_agents .= '</tbody></table>';
$empire_agents .= "</div></div></div><br>";
$count = $i + 1;
}
$empire_agents .= "</div>";
}
else
{
$empire_agents = "<div class='alert alert-danger'><span class='glyphicon glyphicon-remove'></span> No agent found.</div>";
}
}
elseif(array_key_exists("error", $arr_result))
{
$empire_agents = "<div class='alert alert-danger'><span class='glyphicon glyphicon-remove'></span>".$arr_result["error"]."</div>";
}
else
{
$empire_agents = "<div class='alert alert-danger'><span class='glyphicon glyphicon-remove'></span> Unexpected response.</div>";
}
}
else
{
$empire_agents = "<div class='alert alert-danger'><span class='glyphicon glyphicon-remove'></span> Unexpected response.</div>";
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Empire: All Agents</title>
<?php @require_once("includes/head-section.php"); ?>
</head>
<body>
<div class="container">
<?php @require_once("includes/navbar.php"); ?>
<br>
<div class="panel-group">
<div class="panel panel-primary">
<div class="panel-heading">Show All Agents (<?php echo $count; ?>)</div>
<div class="panel-body"><?php echo $empire_agents; ?></div>
</div>
</div>
</div>
<?php @require_once("includes/footer.php"); ?>
</body>
</html>