~ubuntu-branches/ubuntu/natty/ntop/natty

« back to all changes in this revision

Viewing changes to www/PHP/doSearch.php

  • Committer: Bazaar Package Importer
  • Author(s): Ola Lundqvist
  • Date: 2005-01-30 21:59:13 UTC
  • mfrom: (2.1.1 warty)
  • Revision ID: james.westby@ubuntu.com-20050130215913-xc3ke963bw49b3k4
Tags: 2:3.0-5
* Updated README.Debian file so users will understand what to do at
  install, closes: #291794, #287802.
* Updated ntop init script to give better output.
* Also changed log directory from /var/lib/ntop to /var/log/ntop,
  closes: #252352.
* Quoted the interface list to allow whitespace, closes: #267248.
* Added a couple of logcheck ignores, closes: #269321, #269319.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<HTML>
 
2
<HEAD>
 
3
<LINK REL=stylesheet HREF=http://<? echo $host.":".$port; ?>/style.css type="text/css">
 
4
</HEAD>
 
5
<BODY BGCOLOR=#FFFFFF>
 
6
 
 
7
<?php
 
8
    $fp = fsockopen ($host, $port);
 
9
 
 
10
if (!$fp) {
 
11
    echo "$errstr ($errno)<br>\n";
 
12
} else {
 
13
    $outStr = "";
 
14
    fputs ($fp, "GET /dumpData.html?language=php HTTP/1.0\r\n\r\n");
 
15
    while (!feof($fp)) {
 
16
        $out = fgets($fp,128);
 
17
        if($out == "\n")
 
18
            $begin = 1;
 
19
        else if($begin == 1)
 
20
            $outStr .= $out;
 
21
    }
 
22
    fclose ($fp);
 
23
    eval($outStr);
 
24
}
 
25
 
 
26
// echo count($$ntopHash);
 
27
 
 
28
echo "<center>\n<table border>\n";
 
29
echo "<tr><th BGCOLOR=white>Host</th><th BGCOLOR=white>Values</th></tr>\n";
 
30
 
 
31
$match1 = "^".$val_1;
 
32
$match2 = $val_1;
 
33
$match3 = $val_1."$";
 
34
 
 
35
//echo "$crit_1 - $oper_1 ->".$val_1."<-\n<br>";
 
36
 
 
37
while(list($key, $val) = each($$ntopHash)) {
 
38
 
 
39
//echo "eregi($val[$crit_1]) = ".eregi($match1, $val[$crit_1])."<br>\n";
 
40
 
 
41
    if((($oper_1 == "lt") && ($val[$crit_1] != "") && ($val[$crit_1] < $val_1)) 
 
42
       || (($oper_1 == "gt") && ($val[$crit_1] != "") && ($val[$crit_1] > $val_1))
 
43
       || (($oper_1 == "eq") && ($val[$crit_1] != "") && ($val[$crit_1] == $val_1))
 
44
       || (($oper_1 == "startsWith") && ($val[$crit_1] != "") && (eregi($match1, $val[$crit_1]))) 
 
45
       || (($oper_1 == "contains") && ($val[$crit_1] != "") && (eregi($match2, $val[$crit_1]))) 
 
46
       || (($oper_1 == "doesntContain") && ($val[$crit_1] != "") && (!eregi($match2, $val[$crit_1]))) 
 
47
       || (($oper_1 == "endsWith") && ($val[$crit_1] != "") && (eregi($match3, $val[$crit_1]))) 
 
48
       ) {
 
49
 
 
50
        $url = "http://$host:$port/".ereg_replace(":", "_", $key).".html";
 
51
        echo "<tr><th align=center BGCOLOR=white><A HREF=$url>$key</A></th>";
 
52
        echo "<td><table border>\n";
 
53
        while (list ($key_1, $val_1) = each ($val))
 
54
            if($val_1 != "0") 
 
55
                echo "<tr><th align=left>$key_1</th><td align=right>$val_1</td></tr>";
 
56
        echo "</table></td></tr>\n";
 
57
    }
 
58
}
 
59
 
 
60
echo "</table>\n";
 
61
 
 
62
// echo "<pre>$outStr<pre>";
 
63
?>
 
64
 
 
65
 
 
66
</center>
 
67
</body>
 
68
</html>