We need to prevent part of a page showing if logged in - which will also have a_ within the URL.
ie. /fred/a_add
How do I check if "a_" is in the URL?
Can you check for a term within a URL?
Moderator: General Moderators
-
simonmlewis
- DevNet Master
- Posts: 4435
- Joined: Wed Oct 08, 2008 3:39 pm
- Location: United Kingdom
- Contact:
Can you check for a term within a URL?
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
All the best from the United Kingdom.
-
simonmlewis
- DevNet Master
- Posts: 4435
- Joined: Wed Oct 08, 2008 3:39 pm
- Location: United Kingdom
- Contact:
Re: Can you check for a term within a URL?
Haha, just worked it out myself, from using a means of removing something from the URL before:
Code: Select all
function curPageURL()
{
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
return $pageURL;
}
$url = curPageURL();
if (strpos($url,'a_') === false) {
$disablefooter = "y";
}Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
All the best from the United Kingdom.
Re: Can you check for a term within a URL?
By the way,
Otherwise you'll be adding :443 for HTTPS URLs.
Code: Select all
if ($_SERVER{"HTTPS"] == "on" && $_SERVER["SERVER_PORT"] != 443 || $_SERVER["HTTPS"] != "on" && $_SERVER["SERVER_PORT"] != 80) {