Skip to content

Commit

Permalink
tidy up getgraph and header
Browse files Browse the repository at this point in the history
  • Loading branch information
dtucny committed Mar 4, 2017
1 parent f3f8e90 commit d37ccfe
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 43 deletions.
54 changes: 22 additions & 32 deletions getgraph.php
Original file line number Diff line number Diff line change
@@ -1,37 +1,27 @@
<?php
require_once 'inc/db.php';
$dblink = db_connect();
// Packages with updates
$dbquery2 = "select hostname, sum(if (packtype='bug',1,0)) as bug, sum(if (packtype='sec',1,0)) as sec from packages group by hostname;";
$dbresult2 = mysqli_query($dblink, $dbquery2);
$data=array();
if ($dbresult2 && mysqli_num_rows($dbresult2)) {
while ($row2 = mysqli_fetch_object($dbresult2)) {
$arr_t=array();

$host_t=$row2->hostname;
$bug_t=$row2->bug;
$sec_t=$row2->sec;
$url_t="/view_page.php?action=viewallpkgs&servername=$host_t";
$arr_t['hostname']=$host_t;
$arr_t['bug']=$bug_t;
$arr_t['sec']=$sec_t;
$arr_t['url']=$url_t;

$data[] = $arr_t;
}
}

require_once './inc/db.php';
// header("Content-type: image/png");
//$output_file='/tmp/myimage.png';
$dblink = db_connect();

// Packages with updates
// $dbquery2 = "select packagename,count(*) as cunt from packages WHERE packtype='bug' group by packagename order by cunt DESC, packagename ASC;";
$dbquery2 = "select hostname, sum(if (packtype='bug',1,0)) as bug, sum(if (packtype='sec',1,0)) as sec from packages group by hostname;";
$dbresult2 = mysqli_query($dblink, $dbquery2);
// echo "<table>\n";
// echo "<tr><td>Package</td><td>Short Desc</td><td>Num of Affected servers</td></tr><br/>\n";
$data=array();
if ($dbresult2 && mysqli_num_rows($dbresult2)) {
while ($row2 = mysqli_fetch_object($dbresult2)) {
$arr_t=array();

$host_t=$row2->hostname;
$bug_t=$row2->bug;
$sec_t=$row2->sec;
$url_t="https://man.pmalaty.com/view_page.php?action=viewallpkgs&servername=$host_t";
$arr_t['hostname']=$host_t;
$arr_t['bug']=$bug_t;
$arr_t['sec']=$sec_t;
$arr_t['url']=$url_t;

//print_r($row2);
$data[] = $arr_t;
}
}


//print_r($data);
$json_dataset = json_encode($data);

echo $json_dataset;
Expand Down
15 changes: 4 additions & 11 deletions inc/stdhead.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
<a href='/'><img alt='PMSpider' src='/img/pmSpider.png' height='100px' width='280px'></a><span style='font-size:3em;'>SyPUM</span>
<?php if ($_SERVER['SERVER_NAME'] == 'man.peter.lan') echo "<span style='font-size:3em;color:red;'>DEV</span>"; ?>
</div>
<div style='float: left; line-height:100px;'>
<a href='/' style='text-decoration:none;'><h1 style='font-size:4em;' class='sig1inv'>SyPUM</h1></a>
</div>

<?php
// Project SyPUM - Systems Package Update Management
//
Expand Down Expand Up @@ -66,17 +70,6 @@

if ($section != '') {
echo "<div style='clear: both;'></div>\n";

/*
echo "<a class='button sig1' href='/'>My Dashboard</a>";
echo "<a class='button sig1' href='/dns'>DNS</a>";
echo "<a class='button sig1' href='/'>Shell</a>";
echo "<a class='button sig1' href='/'>Voice/Video</a>";
echo "<a class='button sig1' href='/'>IPv6</a>";
echo "<a class='button sig1' href='/'>Web Hosting</a>";
echo "<a class='button sig1' href='/tools'>Tools</a>";
*/

}
?>
</header>
Expand Down

0 comments on commit d37ccfe

Please sign in to comment.