iarp Posted January 22, 2009 Share Posted January 22, 2009 I'm trying to create a script that will redirect those from a certain name address. www.ipchicken.com it lists the Name address and what i'm wanting is to redirect those from example.com to google.ca if they try and view a certain part of my site. http://ca3.php.net/reserved.variables.server REMOTE_HOST i'm taking a stab here and saying its not enabled because i get errors when trying to use it. And the people im trying to redirect have thousands of ips so thats just not an option per ip. Any help? Quote Link to comment https://forums.phpfreaks.com/topic/142032-solved-redirecting-according-to-name-address/ Share on other sites More sharing options...
trq Posted January 22, 2009 Share Posted January 22, 2009 REMOTE_HOST i'm taking a stab here and saying its not enabled because i get errors when trying to use it. What are the errors and how are you using it? Quote Link to comment https://forums.phpfreaks.com/topic/142032-solved-redirecting-according-to-name-address/#findComment-743725 Share on other sites More sharing options...
iarp Posted January 22, 2009 Author Share Posted January 22, 2009 Notice: Undefined index: REMOTE_HOST in /homepages/31/d204952132/htdocs/iarp/main/main_inc/iarp-core-classes.php on line 63 62. function checkbanned() { 63. echo $_SERVER['REMOTE_HOST']; 64. } and checkbanned() is before anything else. Quote Link to comment https://forums.phpfreaks.com/topic/142032-solved-redirecting-according-to-name-address/#findComment-743728 Share on other sites More sharing options...
trq Posted January 22, 2009 Share Posted January 22, 2009 Does this help? <?php $host = gethostbyaddr($_SERVER['REMOTE_ADDR']); echo $host; ?> Quote Link to comment https://forums.phpfreaks.com/topic/142032-solved-redirecting-according-to-name-address/#findComment-743730 Share on other sites More sharing options...
iarp Posted January 22, 2009 Author Share Posted January 22, 2009 l-193-160.sheridanc.on.ca That it does thanks. Is there anyway to only take sheridanc.on.ca(or other domains) part without using explode? Quote Link to comment https://forums.phpfreaks.com/topic/142032-solved-redirecting-according-to-name-address/#findComment-743736 Share on other sites More sharing options...
DeanWhitehouse Posted January 22, 2009 Share Posted January 22, 2009 yes, explode(".",l-193-160.sheridanc.on.ca); i think Quote Link to comment https://forums.phpfreaks.com/topic/142032-solved-redirecting-according-to-name-address/#findComment-743746 Share on other sites More sharing options...
iarp Posted January 23, 2009 Author Share Posted January 23, 2009 ok well i was trying not to explode into an array BUT its doable. How can i remerge an array minus the first entry. Quote Link to comment https://forums.phpfreaks.com/topic/142032-solved-redirecting-according-to-name-address/#findComment-743836 Share on other sites More sharing options...
premiso Posted January 23, 2009 Share Posted January 23, 2009 array_shift Quote Link to comment https://forums.phpfreaks.com/topic/142032-solved-redirecting-according-to-name-address/#findComment-743847 Share on other sites More sharing options...
trq Posted January 23, 2009 Share Posted January 23, 2009 <?php $host = gethostbyaddr($_SERVER['REMOTE_ADDR']); echo substr($host, strpos('.', $host)); ?> Quote Link to comment https://forums.phpfreaks.com/topic/142032-solved-redirecting-according-to-name-address/#findComment-743856 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.