/
mac-lookup.php
59 lines (49 loc) · 1.71 KB
/
mac-lookup.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
<?php
# required functions
if (!isset($User)) {
require_once(dirname(__FILE__) . '/../../../functions/functions.php');
# classes
$Database = new Database_PDO;
$User = new User ($Database);
}
# user must be authenticated
$User->check_user_session();
# if direct request that redirect to tools page
if ($_SERVER['HTTP_X_REQUESTED_WITH'] != "XMLHttpRequest") {
header("Location: " . create_link("tools", "mac-lookup"));
}
?>
<script>
$(document).ready(function() {
if ($("[rel=tooltip]").length) {
$("[rel=tooltip]").tooltip();
}
//submit form
$('form#mac_lookup').submit(function() {
var macvendorData = $(this).serialize();
$.post('app/tools/mac-lookup/results.php', macvendorData, function(data) {
$('div.macvendorResult').html(data).fadeIn('fast');
}).fail(function(jqxhr, textStatus, errorThrown) {
showError(jqxhr.statusText + "<br>Status: " + textStatus + "<br>Error: " + errorThrown);
});
return false;
});
});
</script>
<div class="container-fluid" style='padding-top:5px'>
<!-- search form -->
<form id="mac_lookup" name="search" class='form-inline' role="form" style="margin-bottom:20px;" method="post">
<div class='input-group'>
<div class='form-group'>
<input class="search input-md form-control" name="mac" placeholder="<?php print _('MAC address'); ?>" value='<?php print @escape_input($_POST['mac']); ?>' type="text" autofocus="autofocus" style='width:250px;'>
<span class="input-group-btn">
<button type="submit" class="btn btn-md btn-default"><?php print _('search'); ?></button>
</span>
</div>
</div>
</form>
<hr>
<div class="macvendorResult">
<span class="text-muted"><?php print _('Please enter valid MAC address'); ?></span>
</div>
</div>