Advertisement
Guest User

connect_webpage

a guest
Mar 27th, 2019
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.02 KB | None | 0 0
  1. <?
  2. // Captive Portal Pages
  3. // By: Ryan Hunt <admin@nayr.net>
  4. // License: CC-BY-SA
  5. // Description: Captive Portal Login and Signup Pages for Free Public WiFi and Secure Public WiFi
  6. // Requires: pfSense 2.x, Working Radius Server w/mySQL Backend & PHP (I am running externally),
  7. // Guest user account with Password attribute instead of Cleartext Password.. this wont allow it access to 802.11x
  8. // WiFi AP Capable of VLAN Tagging SSID's
  9. // Goals: To allow easy access to an encrypted public wifi, running on a seperate VLAN and using Radius Authentication
  10.  
  11. // Configuration Variables
  12. $guest_username = "guest";
  13. $guest_password = "VOnwCg8VdlSsqaP7quMW";
  14. $main_url = "https://wifi.nayr.net:8001/";
  15. $register_url = "https://admin.nayr.net/wifi-register.php";
  16. $register_token = "BQhokuYh0xlCRAzQKtvD";
  17. ini_set('display_errors', 0); // Disable Debug Messages
  18.  
  19. // Fetch IP & MAC Address of Client
  20. $clientIP=$_SERVER['REMOTE_ADDR'];
  21. $clientMAC = `/usr/sbin/arp -an | grep {$clientIP} | cut -d" " -f4`;
  22. $clientMAC = str_replace("\n","",$clientMAC);
  23.  
  24. if(isset($_GET['page'])) { // Fetch Page Name
  25. $page = $_GET['page'];
  26. } else {
  27. $page = "login"; // Set Default Page if none set
  28. }
  29.  
  30. $content = "/var/db/cpelements/captiveportal-".$page.".php"; // Filename of Page Contents
  31. if (file_exists($content)) { // Check for page
  32. $last_modified = date("M d Y",filemtime($content));
  33. } else {
  34. $page='login';
  35. $content = "captiveportal-login.php" ;
  36. }
  37.  
  38. // Begin HTML
  39. ?>
  40. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  41. <html xmlns="http://www.w3.org/1999/xhtml">
  42. <head>
  43. <title>wifi.nayr.net | <?=$page?></title>
  44. <meta name="description" content="Free Public WiFi Portal page" />
  45. <link rel="stylesheet" type="text/css" href="captiveportal-style.css" title="style" media="screen" />
  46. <script type="text/javascript">
  47. /* <![CDATA[ */
  48. $(document).ready(function(){
  49. $(".block").fadeIn(1000);
  50. $(".idea").fadeIn(1000);
  51. $('.idea').supersleight();
  52. $('#username').example('<?=$guest_username?>');
  53. $('#password').example('<?=$guest_password?>');
  54. });
  55. /* ]]> */
  56. </script>
  57. <script language="JavaScript" type="text/JavaScript">
  58. <!--
  59. function checkthebox()
  60. {
  61. if (document.form.rm.checked == true)
  62. {
  63. document.form.submit();
  64. }
  65. else
  66. {
  67. alert('You Forgot to agree to the Terms of Service.\nPlease read them carefully and try again.');
  68. }
  69. }
  70. -->
  71. </script>
  72. <body>
  73. <div id="wrap">
  74. <div align="center" class="top">
  75. <a href="/">[login]</a> - <a href="/&page=about">[about]</a> - <a href="/&page=signup">[signup]</a> -
  76. <a href="/&page=tos">[tos]</a> - <a href="mailto:admin@nayr.net">[contact]</a><br/>
  77. <a href="/"><img src="captiveportal-wifi.png"></a>
  78. </div>
  79. <?php include($content); /* Load Page Contents */ ?>
  80. </div>
  81. </body>
  82. <!-- This page was Last Modified: <?=$last_modified?> -->
  83. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement