X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=http.php;fp=http.php;h=042e1b909b02a0088bfbcdd1de95e2056dfca443;hb=ed5b82e026ec9a6f0fd844ba42fff3f268d949d3;hp=e325fc1747e41a4f7214f640a2edfad144ef49e1;hpb=b0b28a4587992b92f47abb0429df0e1eaf7f151f;p=wfpl.git diff --git a/http.php b/http.php index e325fc1..042e1b9 100644 --- a/http.php +++ b/http.php @@ -45,6 +45,22 @@ function this_url_sans_path() { return $url; } +# just the hostname, no port number +function this_host() { + if($_SERVER['HTTP_HOST']) { + $host = $_SERVER['HTTP_HOST']; + $p = strpos($host, ':'); + if($p) { + $host = substr($host, 0, $p); + } + return $host; + } else { + return $_SERVER['SERVER_NAME']; + } +} + + + # return our best guess at the url used to access this page function this_url() { $url = this_url_sans_path();