Captive Portal: Make use of PirateBox environment variable for intial redirect

This commit is contained in:
Matthias Strubel committed 2019-07-14 14:28:27 +02:00
1 parent 2e23a2eb91
commit 948cb8178b
2 files changed
+5 -2

No files matched your search

@@ -15,7 +15,7 @@
// captive portal
//
function get_config(){
$hostname="piratebox.lan";
$hostname=$_ENV['PIRATEBOX_HOSTNAME'];
return array (
'SQLITE_FILE' => "sqlite:/tmp/captive.sqlite" ,
'minimum_answers' => 5 ,
@@ -7,6 +7,9 @@
// $_SERVER['REQUEST_URI'] - URL , needed for Client OS
// $_SERVER['HTTP_USER_AGENT'] - needed for Client OS verification
// ( $_SERVER['SERVER_NAME'] - possibly )
//
// For Redirect:
// $_ENV['PIRATEBOX_HOSTNAME']
require_once ("captive.func.php");
@@ -15,7 +18,7 @@ require_once ("captive.func.php");
$config = get_config();
if ( isset ($_GET['enter'] ) ) {
header('Location: http://piratebox.lan/', true, 302);
header('Location: http://'.$config['hostname'], true, 302);
count_ip($_SERVER['REMOTE_ADDR'],"no",99);
exit;