Page 1 of 1

detecting "index.php" versus "index.php?var=xxx"

Posted: Fri Sep 03, 2010 10:35 am
by glennnall
i'm running code on what i only want to be the HOME page, but the current site it built using GET variables with index.php

needless to say, the home page is accessed either as domain.com/ or domain.com/index.php - i'm hoping someone can show me how to check for this condition, that it is only index.php without anything further

I'm only slightly familiar with $_SERVER['uri'], etc... So i don't know just what to ask.

thanks for anyone's help.

Glenn

Re: detecting "index.php" versus "index.php?var=xxx"

Posted: Fri Sep 03, 2010 11:04 am
by Gargoyle

Code: Select all

if(!count($_GET))
{
echo 'no variables';
}

Re: detecting "index.php" versus "index.php?var=xxx"

Posted: Fri Sep 03, 2010 11:13 am
by glennnall
awesome, worked. thanks much

Re: detecting "index.php" versus "index.php?var=xxx"

Posted: Fri Sep 03, 2010 11:21 am
by Weirdan

Code: Select all

if (empty($_SERVER['QUERY_STRING'])) {
   echo 'index.php accessed';
} else {
   echo 'index.php?<something> accessed';
}