Welcome to WebmasterWorld Guest from 54.227.52.24

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Current Url in Variable?

     

dkin

10:35 am on Apr 26, 2007 (gmt 0)

10+ Year Member



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. #*$!.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.

jatar_k

12:01 pm on Apr 26, 2007 (gmt 0)

WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member



you can use one of the $_SERVER [php.net] vars and then use parse_url() [php.net]
 

Featured Threads

Hot Threads This Week

Hot Threads This Month