summaryrefslogtreecommitdiffstats
path: root/usr/local/captiveportal
diff options
context:
space:
mode:
authorbcyrill <cyrill@bannwart.info>2013-01-16 01:05:09 +0100
committerbcyrill <cyrill@bannwart.info>2013-01-16 01:05:09 +0100
commitfad944a9d3de5046be85f3d9fe362e57ea01d199 (patch)
tree12f83cc282fa4ae06342fd67fc0ea108b5f7d254 /usr/local/captiveportal
parent3b8324180194bd1d995219a90b39964fe5eeb43d (diff)
parent422e9d002f817106bfd2a4e37fb8c4689b61bb16 (diff)
downloadpfsense-fad944a9d3de5046be85f3d9fe362e57ea01d199.zip
pfsense-fad944a9d3de5046be85f3d9fe362e57ea01d199.tar.gz
Update to master
Diffstat (limited to 'usr/local/captiveportal')
-rwxr-xr-xusr/local/captiveportal/index.php28
1 files changed, 5 insertions, 23 deletions
diff --git a/usr/local/captiveportal/index.php b/usr/local/captiveportal/index.php
index 681e9a6..28931a4 100755
--- a/usr/local/captiveportal/index.php
+++ b/usr/local/captiveportal/index.php
@@ -61,35 +61,17 @@ if (!$clientip) {
return;
}
-$listenporthttps = $cpcfg['listenporthttps'] ? $cpcfg['listenporthttps'] : ($cpcfg['zoneid'] + 1);
-$listenporthttp = $cpcfg['listenporthttp'] ? $cpcfg['listenporthttp'] : $cpcfg['zoneid'];
-
-if (isset($cpcfg['httpslogin']))
- $ourhostname = $cpcfg['httpsname'] . ":" . $listenporthttps;
-else {
- $ifip = portal_ip_from_client_ip($clientip);
- if (!$ifip) {
- $ourhostname = "{$config['system']['hostname']}.{$config['system']['domain']}:{$listenporthttp}";
- } else {
- if (is_ipaddrv6($ifip))
- $ourhostname = "[{$ifip}]:{$listenporthttp}";
- else
- $ourhostname = "{$ifip}:{$listenporthttp}";
- }
-}
-
+$ourhostname = portal_hostname_from_client_ip($clientip);
if ($orig_host != $ourhostname) {
/* the client thinks it's connected to the desired web server, but instead
it's connected to us. Issue a redirect... */
-
- if (isset($cpcfg['httpslogin']))
- header("Location: https://{$ourhostname}/index.php?zone={$cpzone}&redirurl=" . urlencode("http://{$orig_host}/{$orig_request}"));
- else
- header("Location: http://{$ourhostname}/index.php?zone={$cpzone}&redirurl=" . urlencode("http://{$orig_host}/{$orig_request}"));
+ $protocol = (isset($cpcfg['httpslogin'])) ? 'https://' : 'http://';
+ header("Location: {$protocol}{$ourhostname}/index.php?zone={$cpzone}&redirurl=" . urlencode("http://{$orig_host}/{$orig_request}"));
ob_flush();
return;
}
+
if (!empty($cpcfg['redirurl']))
$redirurl = $cpcfg['redirurl'];
else if (preg_match("/redirurl=(.*)/", $orig_request, $matches))
@@ -238,4 +220,4 @@ EOD;
ob_flush();
-?> \ No newline at end of file
+?>
OpenPOWER on IntegriCloud