Ok this is my problem. I have a script I am using as an include in many sites. It pulls info from a database and displays ads. Now every site that this is displayed on has an ad in the database and I dont want anyones ads showing on their own site. I wrote this. ##$current = $_SERVER["HTTP_HOST"]; $current = $_SERVER['PHP_SELF']; $lin = mysql_query("SELECT * FROM link order by id asc", $link) or die ("query 1: " . mysql_error()); echo '<li><h2>LinkWork</h2>' . '<ul>'; while ($li = mysql_fetch_array($lin)) { if ($current == $li['base']) { echo ''; } else { echo '<li><a href="'.$li['web_url'].'" alt="'.$li['alt_tag'].'">'.$li['display'].'</a></li>'; } } The column base, is the base of a url eg. digitalpoint.com So that is what I need to find, a php variable that gives me the current pages web address, but only up to the end of the com or org.
I assume from the comment that HTTP_HOST isn't enough? There's no server variable as such containing a full URL but you can put it together yourself. $currentURL = 'http'.(empty($_SERVER['HTTPS'])?'':'s').'://'.$_SERVER['HTTP_HOST']; PHP: If you want to go further than the hostname, you'd just need to add the REQUEST_URI