Files
capport/Ruckus/vsz/index.php
Nasir Hafeez 56de43ca26 ruckus vsz
2025-02-22 10:11:42 +05:00

78 lines
2.0 KiB
PHP

<?php
session_start();
if (!isset($_POST['submit'])) {
$_SESSION['url'] = "http://" . $_GET['nbiIP'] . ":9080/portalintf";
$_SESSION['client_mac'] = $_GET['client_mac'];
$_SESSION['uip'] = $_GET['uip'];
} else {
$username = $_POST['username'];
$password = $_POST['password'];
$postData = [
"Vendor" => "ruckus",
"RequestUserName" => "admin",
"RequestPassword" => "Admin@123",
"APIVersion" => "1.0",
"RequestCategory" => "UserOnlineControl",
"RequestType" => "Login",
"UE-IP" => $_SESSION["uip"],
"UE-MAC" => $_SESSION["client_mac"],
"UE-Proxy" => "0",
"UE-Username" => $username,
"UE-Password" => $password
];
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => $_SESSION['url'],
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_SSL_VERIFYHOST => false,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => json_encode($postData),
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
if ($response !== false) {
$json = json_decode($response, true);
echo "<pre>" . json_encode($json, JSON_PRETTY_PRINT) . "</pre>";
}
else {
die("Error: check with your network administrator");
}
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>WiFi Portal</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
</head>
<body>
<p>Welcome!<br>
Please login to our Wifi service</p>
<form method="POST" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>>
<label>User Name: <input type="text" name="username"></label><br/>
<label>Password: <input type="text" name="password"></label><br/>
<input type="submit" name="submit" value="LOGIN" />
</form>
</body>
</html>