Open-AudIT

What's on your network?
It is currently Wed Jan 17, 2018 9:07 am

All times are UTC + 10 hours




Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
PostPosted: Fri Jul 30, 2010 4:02 am 
Offline
Helper

Joined: Thu Apr 15, 2010 12:28 am
Posts: 83
Hi

This patch does 3 things to software_register_details.php:

  1. it shows more details, the 2 fields software publisher and software_url.
  2. it fixes a calculation bug, where the sum of licenses can be wrong if you have both positive and -1 licenses registered. (you might do that to keep a record of your purchased license numbers).
  3. it replaces the IP address column in the bottom with the version, because i find that more useful.

Code:
dkopen-audit:/var/www/open-audit# svn diff software_register_details.php
Index: software_register_details.php
===================================================================
--- software_register_details.php   (revision 1245)
+++ software_register_details.php   (working copy)
@@ -10,7 +10,7 @@
 
 if (isset($_GET['id'])){$id = $_GET['id'];}else{header("Location: software_register.php");}
 
-$sql = "SELECT software_reg_id, software_title, count(software.software_name) AS number_used, software_comments FROM ";
+$sql = "SELECT software_reg_id, software_title, count(software.software_name) AS number_used, software_comments, software_publisher, software_url, software_comment FROM ";
 $sql .= "software_register, software, system WHERE ";
 $sql .= "software_title = software_name AND ";
 $sql .= "software_uuid = system_uuid AND ";
@@ -23,7 +23,9 @@
     
     echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">\n";
     echo "<tr><td class=\"contenthead\" colspan=\"2\">Software License Register Details for: </td></tr>\n";
-    echo "<tr><td>" . $myrow["software_title"] . "</td></tr>\n";
+    echo "<tr><td width=\"2%\">Title:</td><td width=\"98%\" align=\"left\">" . $myrow["software_title"] . "</td></tr>\n";
+    echo "<tr><td width=\"2%\">Publisher:</td><td width=\"98%\" align=\"left\"><a href=\"" . $myrow["software_url"] . "\" class=\"content\">" . $myrow["software_publisher"] . "</a></td></tr>\n";
+    echo "<tr><td width=\"2%\">Comment:</td><td width=\"98%\" align=\"left\">" . $myrow["software_comment"] . "</td></tr>\n";
     echo "<tr><td class=\"contenthead\"><br />Usage Details.</td></tr>\n";
     echo "<tr bgcolor=\"" . $bgcolor . "\">\n";
     echo "<td width=\"25%\"><b>Package Name&nbsp;&nbsp;</b></td>\n";
@@ -33,7 +35,10 @@
     echo "</tr>";
     do {
     
-      $sql2  = "SELECT sum(license_purchase_number) as number_purchased FROM ";
+      $sql2  = "SELECT IF(min(license_purchase_number)=-1,";
+      $sql2 .=           "min(license_purchase_number),";
+      $sql2 .=           "sum(license_purchase_number))";
+      $sql2 .= "as number_purchased FROM ";
       $sql2 .= "software_licenses, software_register WHERE ";
       $sql2 .= "license_software_id = software_reg_id AND ";
       $sql2 .= "software_title = '" . $myrow['software_title'] . "'";
@@ -56,11 +61,13 @@
       echo "<td>" . $myrow["software_title"] . "&nbsp;&nbsp;</td>\n";
       echo "<td align=\"center\">" . $number_purchased . "</td>\n";
       echo "<td align=\"center\">" . $number_used . "</td>\n";
-    if ($number_purchased == -1) {
-      echo "<td align=\"center\"></td>";
-    } else {
-      echo "<td align=\"center\">" . $font . $number_audit . "</font></td>";
-    }
+
+      if ($number_purchased == -1) {
+        echo "<td align=\"center\"></td>";
+      } else {
+        echo "<td align=\"center\">" . $font . $number_audit . "</font></td>";
+      }
+
 //      echo "<td align=\"center\">" . $font . $number_audit . "</font></td>\n";
       echo "</tr>\n";
       echo "</table>\n";
@@ -112,7 +119,7 @@
 } else {}
 
       $bgcolor = "#F1F1F1";
-$sql = "select sys.system_uuid, sys.system_os_name, sys.system_description, sys.net_ip_address, sys.system_name, sw.software_name  from ";
+$sql = "select sys.system_uuid, sys.system_os_name, sys.system_description, sys.system_name, sw.software_name, sw.software_version from ";
 $sql .= "software sw, system sys where ";
 $sql .= "sw.software_name = '" . addslashes($name) . "' AND ";
 $sql .= "sw.software_uuid = sys.system_uuid AND ";
@@ -123,10 +130,10 @@
       if ($myrow = mysql_fetch_array($result)){
         echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" class=\"content\">\n";
         echo "<tr><td class=\"contenthead\" colspan=\"3\"><br />Systems with \"" . $name . "\" installed.</td></tr>\n";
-        echo "<tr><td>&nbsp;&nbsp;<b>IP Address</b></td><td>&nbsp;&nbsp;<b>Name</b></td><td>&nbsp;&nbsp;<b>Description</b></td></tr>\n";
+   echo "<tr><td>&nbsp;&nbsp;<b>Version</b></td><td>&nbsp;&nbsp;<b>Name</b></td><td>&nbsp;&nbsp;<b>Description</b></td></tr>\n";
         do {
           echo "<tr bgcolor=\"" . $bgcolor . "\">\n";
-          echo "  <td width=\"33%\">&nbsp;&nbsp;" . $myrow["net_ip_address"] . "&nbsp;&nbsp;</td>\n";
+     echo "  <td width=\"33%\">&nbsp;&nbsp;" . $myrow["software_version"] . "&nbsp;&nbsp;</td>\n";
           echo "  <td width=\"33%\">&nbsp;&nbsp;<a href=\"system.php?pc=" . $myrow["system_uuid"] . "&amp;view=summary\" class=\"content\">" . $myrow["system_name"] . "</a>&nbsp;&nbsp;</td>\n";
           echo "  <td width=\"33%\">&nbsp;&nbsp;" . $myrow["system_description"] . "</td>\n";
           echo "</tr>\n";

Made against revision 1245


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC + 10 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group