I heared that someone made a lot of domain all point(mask forward?) to one, then used a php predefined variable to detect the domain name and output based on it, so which php variable it is? Thanks!
$_SERVER is an array where you will get all information user <? echo "<pre>"; print_r($_POST); echo "</pre>"; ?>
The domain shouldn't be in REQUEST_URI, it'd be HTTP_HOST. For the URL http://www.mydomain.com/mydir/page.php $_SERVER['HTTP_HOST'] contains www.mydomain.com $_SERVER['REQUEST_URI'] contains /mydir/page.html
Actually I was trying to same thing.. well.. need the same thing.. function getdomain() { $HTTP_HOST = $dom; if(eregi("somedomain",$dom)) $file = "header1.txt"; include($file); if(eregi("otherdomain",$dom)) $file = "header2.txt"; include($file); } Code (markup): this does not work.. what is wrong ?
Mainly it'd be because you have the $HTTP_HOST = $dom line the wrong way round. That tries to set $HTTP_HOST to the value of $dom, but there's no such variable as $dom. $dom = $_SERVER['HTTP_HOST']; You should really use $_SERVER['HTTP_HOST'] instead but you can get away without if you're using register globals on.
Damn.. looking to it non-stop makes you blind.. Thanks.. final code is function getdomain() { $dom = $_SERVER['HTTP_HOST']; if(eregi("somedomain",$dom)) { $file = "header1.txt"; include ($file); _aheader(); } if(eregi("otherdomain",$dom)) { $file = "header2.txt"; include ($file); _nheader(); } } Code (markup):
$_SERVER['HTTP_HOST'] variable will have the domain name. If you need you might remove the www part by str_replace.
Just use if(eregi("somedomain",$_SERVER['HTTP_HOST'])) for the love of God. Of course I can't blame you for something like this when you use eregi() for something that strpos() would be so much better suited for.
Thanks.. stick to this for now.. But in reality.. Would this actually work for spiders to think its some other domain, mask the parked domain ?
I think it's no matter. as parked domain can also have PR, that's by backlink. so it should be index differently in search engine. But they may search whois database if PR is also counted on it
Thanks.. I have noticed changes as I have only applied this script to index page. So it works damn well..