X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=http.php;h=b1f2aece64279389f230b001c66637a15d8e6244;hb=912bdab05d6262ab07e7ea6664192f97239db3e1;hp=51eb4d39f5d6d797a0a3e2d46a0a65b6163ed8be;hpb=b714d3f571fc78989e69c7272c5812eb97479cf0;p=wfpl.git diff --git a/http.php b/http.php index 51eb4d3..b1f2aec 100644 --- a/http.php +++ b/http.php @@ -1,24 +1,14 @@ . +# This program is in the public domain within the United States. Additionally, +# we waive copyright and related rights in the work worldwide through the CC0 +# 1.0 Universal public domain dedication, which can be found at +# http://creativecommons.org/publicdomain/zero/1.0/ # return our best guess at the url used to access this page, without the path or query string function this_url_sans_path() { - if(strtolower($_SERVER['HTTPS']) == 'on' || strtolower($_SERVER['HTTPS']) == 'yes') { + if (isset($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS']) == 'on' || strtolower($_SERVER['HTTPS']) == 'yes')) { $url = 'https'; $expected_port = 443; } else { @@ -78,7 +68,7 @@ function redirect($url, $status = '302 Moved Temporarily', $message = '') { if(substr($url, 0, 1) == '/') { $url = this_url_sans_path() . $url; } else { - $url = ereg_replace('/[^/]*$', "/$url", this_url()); + $url = preg_replace('|/[^/]*$|', "/$url", this_url()); } }