the variable $_SERVER['QUERY_STRING'] will contain any and all data after the filename in a URL.
i.e. http://www.site.com/page.php?a=1&b=2
would result in $_SERVER['QUERY_STRING'] containing a=1&b=2.
therefore to determine if anything is contained in the url query string, just do
if (empty($_SERVER['QUERY_STRING'])) {
//nothing in it
} else {
//something in it
}
btw...if you know that "cat=x" will be in it, you dont need any fancy code to get it. all variables in the query string are also automatically available via $GET. so if cat=1 is present, you will have a variable available to your script called $GET['cat'] and it will contain 1