diff options
author | bcyrill <cyrill@bannwart.info> | 2013-01-16 01:05:09 +0100 |
---|---|---|
committer | bcyrill <cyrill@bannwart.info> | 2013-01-16 01:05:09 +0100 |
commit | fad944a9d3de5046be85f3d9fe362e57ea01d199 (patch) | |
tree | 12f83cc282fa4ae06342fd67fc0ea108b5f7d254 /usr/local/captiveportal | |
parent | 3b8324180194bd1d995219a90b39964fe5eeb43d (diff) | |
parent | 422e9d002f817106bfd2a4e37fb8c4689b61bb16 (diff) | |
download | pfsense-fad944a9d3de5046be85f3d9fe362e57ea01d199.zip pfsense-fad944a9d3de5046be85f3d9fe362e57ea01d199.tar.gz |
Update to master
Diffstat (limited to 'usr/local/captiveportal')
-rwxr-xr-x | usr/local/captiveportal/index.php | 28 |
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 +?> |