-
Notifications
You must be signed in to change notification settings - Fork 2
/
ip.php
88 lines (75 loc) · 2.67 KB
/
ip.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?php
require_once(dirname(__FILE__) . "/include/time_start.php");
require_once(dirname(__FILE__) . "/include/layout.php");
require_once(dirname(__FILE__) . "/include/db.php");
require_once("HTML/QuickForm.php");
function ip2ap($input = NULL)
{
if ( ($input == NULL) or !isset($input['ip']) or empty($input['ip'] ))
{
return false;
}
$interfaces = DB_DataObject::factory('interface');
$interfaces->whereAdd("ip LIKE '".$input['ip']."%'");
$interfaces->groupBy('ip');
$interfaces->find();
$netmask = DB_DataObject::factory('netmask');
$netmask->find();
while($netmask->fetch())
{
$netmasks[$netmask->id_netmask] = $netmask->description;
}
$node = DB_DataObject::factory('node');
$node->find();
while ($node->fetch())
{
$nodes[$node->id_node] = $node->description;
}
echo "<h1>Ergebnis der Suche nach ".$input['ip']."</h1>\n".
"<table><tr><th>IP-Adresse</th><th>Netzmaske</th><th>Accesspoint</th></tr>\n";
$i=0;
while ($interfaces->fetch())
{
echo "<tr class=\"".($i%2?"odd":"even")."\">\n"
."\t<td>".$interfaces->ip."</td>\n"
."\t<td>".$netmasks[$interfaces->id_netmask]."</td>\n"
."\t<td><a href=\"stats/".$nodes[$interfaces->id_node]."\">".$nodes[$interfaces->id_node]."</a></td>\n"
."</tr>\n";
$i++;
}
echo '</table>';
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta>
<link rel='stylesheet' href='css/gserverl.css' type='text/css'></link>
<title>Netplan v2</title>
</head>
<body onLoad="document.getElementById('ip').focus();return true">
<?php printMenu(); ?>
<div class="normalbox">
<?php
// Formular erstellen
$form = new HTML_QuickForm("suche", "post", null, null, null, true);
//$form = new HTML_QuickForm("suche", "post");
// man kann nur Formularelemente updaten, die auch existieren, also erstmal alle Objekte hinzufügen
$form->addElement("header", null, "Zeige Accesspoints im IP-Bereich");
$form->addElement("text", "ip", "IP-Adresse", array("size"=>20, "id"=>"ip"));
$form->addElement("submit", "action", "Suche starten");
$form->addElement("static", null, null, "Wildcard-Suche wird so unterstützt, dass man den hinteren Teil der IP-Adresse weglassen kann.");
$form->display();
if($form->isSubmitted())
{
// Callback-Funktion aufrufen
$form->process("ip2ap");
}
?>
</div>
<div class="normalbox">
<?php require(dirname(__FILE__) . "/include/time_end.php"); ?>
</div>
</body>
</html>