The OP could also use $_SERVER['HTTP_USER_AGENT'] (although unreliable) to check if its a mobile advice.