PDA

View Full Version : PHP help - IF Else for URL do something if URL does not match, do nothing if it does



Crazy BigGaz
25-07-2009, 01:14 PM
Hi,


I am needing an IF Else statement that will pull in a URL.
What I am looking for is

If URL = http://www.my-domain.com/offline.php
Do nothing
Else
Do IP Check and display offline page if needed <-- this code I have

So what I am needing is:
IF statement that get the URL and check
If it is offline.php do nothing
else
do my bit of code

PMM
25-07-2009, 01:46 PM
have a gander through the various code here - think what your after is in there somewhere in the middle...

http://uk2.php.net/file_exists

Helior
25-07-2009, 01:53 PM
<?php
if ($_SERVER["PHP_SELF"] != "/offline.php")
{
//TODO
}

?>

that is somewhat simpler :p

Crazy BigGaz
25-07-2009, 02:16 PM
Thanks I used the following code


if (strcmp($_SERVER['PHP_SELF'],"/offline.php") != 0)
{
//Do IP Check and display offline page if needed
}