-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathportal.php
executable file
·83 lines (78 loc) · 3.02 KB
/
portal.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
<?
// Captive Portal Pages
// By: Ryan Hunt <[email protected]>
// License: CC-BY-SA
// Description: Captive Portal Login and Signup Pages for Free Public WiFi and Secure Public WiFi
// Requires: pfSense 2.x, Working Radius Server w/mySQL Backend & PHP (I am running externally),
// Guest user account with Password attribute instead of Cleartext Password.. this wont allow it access to 802.11x
// WiFi AP Capable of VLAN Tagging SSID's
// Goals: To allow easy access to an encrypted public wifi, running on a seperate VLAN and using Radius Authentication
// Configuration Variables
$guest_username = "guest";
$guest_password = "VOnwCg8VdlSsqaP7quMW";
$main_url = "https://wifi.nayr.net:8001/";
$register_url = "https://admin.nayr.net/wifi-register.php";
$register_token = "BQhokuYh0xlCRAzQKtvD";
ini_set('display_errors', 0); // Disable Debug Messages
// Fetch IP & MAC Address of Client
$clientIP=$_SERVER['REMOTE_ADDR'];
$clientMAC = `/usr/sbin/arp -an | grep {$clientIP} | cut -d" " -f4`;
$clientMAC = str_replace("\n","",$clientMAC);
if(isset($_GET['page'])) { // Fetch Page Name
$page = $_GET['page'];
} else {
$page = "login"; // Set Default Page if none set
}
$content = "/var/db/cpelements/captiveportal-".$page.".php"; // Filename of Page Contents
if (file_exists($content)) { // Check for page
$last_modified = date("M d Y",filemtime($content));
} else {
$page='login';
$content = "captiveportal-login.php" ;
}
// Begin HTML
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>wifi.nayr.net | <?=$page?></title>
<meta name="description" content="Free Public WiFi Portal page" />
<link rel="stylesheet" type="text/css" href="captiveportal-style.css" title="style" media="screen" />
<script type="text/javascript">
/* <![CDATA[ */
$(document).ready(function(){
$(".block").fadeIn(1000);
$(".idea").fadeIn(1000);
$('.idea').supersleight();
$('#username').example('<?=$guest_username?>');
$('#password').example('<?=$guest_password?>');
});
/* ]]> */
</script>
<script language="JavaScript" type="text/JavaScript">
<!--
function checkthebox()
{
if (document.form.rm.checked == true)
{
document.form.submit();
}
else
{
alert('You Forgot to agree to the Terms of Service.\nPlease read them carefully and try again.');
}
}
-->
</script>
<body>
<div id="wrap">
<div align="center" class="top">
<a href="/">[login]</a> - <a href="/&page=about">[about]</a> - <a href="/&page=signup">[signup]</a> -
<a href="/&page=tos">[tos]</a> - <a href="mailto:[email protected]">[contact]</a><br/>
<a href="/"><img src="captiveportal-wifi.png"></a>
</div>
<?php include($content); /* Load Page Contents */ ?>
</div>
</body>
<!-- This page was Last Modified: <?=$last_modified?> -->
</html>