DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Devuelve El Referer Limpio

10.03.2007
| 2820 views |
  • submit to reddit
        // Limpia y devuelve el REFERER

	function getReferer(){
		// limpia el referer 
		$ref = $_SERVER['HTTP_REFERER'];
		$web = str_replace(array('http://','www.'),'',$ref);
		$web = substr($web,0,strpos ($web, '/'));
		if(!empty($web)):
			// retorna el referer limpio
			return $web;
		else:
			// sin referer
			return 'jane.es';
		endif;
	}