From e0b8375e28b34ffc9d7894ed828899c0501dd4ba Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Sun, 9 Feb 2014 00:34:49 +0100 Subject: [PATCH] Get current URL in php --- php/modules/misc.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/php/modules/misc.php b/php/modules/misc.php index eb161e1..a953c76 100755 --- a/php/modules/misc.php +++ b/php/modules/misc.php @@ -95,4 +95,17 @@ function update() { } +function pageURL() { + + $pageURL = 'http'; + if (isset($_SERVER["HTTPS"])&&$_SERVER["HTTPS"]==="on") $pageURL .= "s"; + $pageURL .= "://"; + + if ($_SERVER["SERVER_PORT"]!="80") $pageURL .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . $_SERVER['SCRIPT_NAME']; + else $pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER['SCRIPT_NAME']; + + return $pageURL; + +} + ?>