View Single Post
Old 11-06-2011, 02:27 PM  
Tempest
Too lazy to set a custom title
 
Industry Role:
Join Date: May 2004
Location: West Coast, Canada.
Posts: 10,217
Code:
<?php

	$ad = 'default';

	$ref = (isset($_SERVER['HTTP_REFERER']) ? strtolower($_SERVER['HTTP_REFERER']) : '');

	if( $ref != '' ){

		$info = parse_url($ref);

		if( $info !== false && isset($info['host']) ){

			$domain = preg_replace('/^(www\.)+/', '', $info['host']);

			if( in_array($domain, array('domain1.com', 'domain2.com')) ){

				$ad = 'ad1';

			}elseif( in_array($domain, array('domain3.com', 'domain4.com')) ){

				$ad = 'ad2';
			}
		}
	}

	echo $ad;
?>
Tempest is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote