-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsuccess.php
137 lines (119 loc) · 3.43 KB
/
success.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<html>
<head>
<title>Your Business Device Registration</title>
<link rel="icon" href="/images/logo.png">
<link rel="stylesheet" href="styles.css">
<style>
body{
font-size: 1.5em;
}
p{
font-size:1em;
}
b{
color:orange;
font-size:1.5em;
}
#phone{
font-size:1.2em;
}
@media only screen and (max-width: 1000px) {
body {
font-size:1.7em;
padding: 70px 0;
text-align: center;
}
input{
margin-bottom:10px;
padding: 6%;
width: 100%;
box-sizing:border-box;
}
}
@media only screen and (max-width: 535px) {
body {
font-size:1.7em;
padding: 70px 0;
text-align: center;
}
div{
width:95%;
}
#fclogo{
width:80%;
}
#title{
font-size:1.5em;
}
input{
margin-bottom:10px;
padding: 6%;
width: 100%;
box-sizing:border-box;
}
#info{
font-size:150%;
}
}
</style>
</head>
<body>
<?php
$submit_mac = $_REQUEST['input_value']; //pulls the textbox value from previous page and sets it to var submit_mac
$mac_array = array(".","-"," ",":"); //makes an array of . - and space, that can be used to remove to make a proper mac with only :
$string = $submit_mac; //sets the string var, to the mac from the text box
$cleaned_mac = implode(":", str_split(str_replace($mac_array, "", $string), 2));//coverts the mac to have : every 2 characters
/**
* PHP API usage example
*
* contributed by: Art of WiFi
* description: example basic PHP script to perform a basic auth of a guest device
*/
/**
* using the composer autoloader
*/
require_once('vendor/autoload.php');
/**
* include the config file (place your credentials etc. there if not already present)
* see the config.template.php file for an example
*/
require_once('config.php');
require_once('src/Client.php');
/**
* the MAC address of the device to authorize
*/
$mac = $cleaned_mac;//makes the cleaned proper mac address set to var mac
/**
* the duration to authorize the device for in minutes
*/
$duration = 525600;
/**
* The site to authorize the device with
*/
$site_id = 'default';
/**
* initialize the UniFi API connection class and log in to the controller
*/
$unifi_connection = new UniFi_API\Client($controlleruser, $controllerpassword, $controllerurl, $site_id, $controllerversion);
$set_debug_mode = $unifi_connection->set_debug($debug);
$loginresults = $unifi_connection->login();
/**
* then we authorize the device for the requested duration
*/
$auth_result = $unifi_connection->authorize_guest($mac, $duration);
/**
* provide feedback in json format
*/
?>
<div>
<img src="images\white.png" id="fclogo">
<p>Your MAC Address</p>
<?php
echo "<div id=\"info\">$mac</div>";
?>
<p>has sucessfully been registered!</p>
<p>You now should be able to access the Wi-Fi network <br><br><b>"Gaming and Streaming"</b></p>
<p id='issues'>If you have any issues connecting or any other questions, please call ITS at <br><br><b id="phone">(317) 867-5309</b><br><br> or submit a ticket at <br><br><a href="https://service.yourbuisness.edu">service.yourbuisness.edu</a>
</div>
</body>
</html>