-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplate-cabletest.php
More file actions
45 lines (37 loc) · 1.21 KB
/
Copy pathtemplate-cabletest.php
File metadata and controls
45 lines (37 loc) · 1.21 KB
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
<?php
/*
Template Name: CableTest
Template Post Type: page
*/
/**
* @author Sergey Ilyin <developer@ilyins.ru>
*/
include_once 'config.php';
spl_autoload_register(function ($class) {
switch ($class) {
case 'Woocommerce':
break;
default:
include __DIR__."/classes/$class.class.php";
break;
}
});
get_header();
$inputRequestData = filter_input_array(INPUT_POST) ?? filter_input_array(INPUT_GET);
$device = (preg_match('/Android|iPhone/', filter_input(INPUT_SERVER, 'HTTP_USER_AGENT'))) ? 'Mobile' : 'PC';
echo <<<HTML
<div class='entry'>
<div class='woo-sc-box normal rounded full'>
<form method=post>
Host: <input type=text id=host name=host value=$inputRequestData[host]>
Port: <input type=text id=port name=port value=$inputRequestData[port]>
<input type=submit value=Test>
</form>
</div>
</div>
HTML;
if ($inputRequestData['host'] && $inputRequestData['port']) {
$switch = BGB::getSwitchType($inputRequestData['host']);
$switch::cableTest($inputRequestData['host'], $inputRequestData['port']);
echo HTML::getGraySwitchInfo($inputRequestData['host'], $inputRequestData['port'], $device, $switch);
}