Guest Posted December 16, 2003 Share Posted December 16, 2003 Hi, I've been reading through all the (dare I mention it..) Google and search engine threads and have followed the advice - but that's not my questions. I have an idex.php file in my webroot to either redirect a human to my store or a spider to my allprods page but i am getting the following error: Parse error: parse error, expecting `')'' in /home/emvihtpc/public_html/index.php on line 8 Here's my index.php file - I can't seem to spot the problem? <?php // Quick script to 'redirect' spiders/robots to 'search engine friendly' page. // By Dan Zambonini [[email protected]], Sep 2000. V 1.0 // Please send alterations/comments to [email protected] // Modified from someone else's script, can't remember which one...Sorry! // Major search engines match either $spider_footprint or $spider_ip. $spider_footprint = array( "bot", "rawler", "pider",? "ppie", "rchitext", "aaland", "igout4u", "cho", "ferret", "ulliver", "arvest", "tdig", "rchiver", "eeves", "inkwalker", "ycos", "ercator", "uscatferret", yweb", "omad", "eternews", "cooter", "lurp", "oila", "oyager", "ebbase", "eblayers", "get")";? ? $spider_ip = array( "204.123.", "204.74.103.", "203.108.10.", "195.4.183.", "195.242.46.", "198.3.97.", "204.62.245.", "193.189.227.", "209.1.12.", "204.162.96.", "204.162.98.", "194.121.108.", "128.182.72.", "207.77.91.", "206.79.171.", "207.77.90.", "208.213.76.", "194.124.202.", "193.114.89.", "193.131.74.", "131.84.1.", "208.219.77.", "206.64.113.", "195.186.1.", "195.3.97.", "194.191.121.", "139.175.250.", "209.73.233.", "194.191.121.", "198.49.220.", "204.62.245.", "198.3.99.", "198.2.101.", "204.192.112.", "206.181.238", "208.215.47.", "171.64.75.", "204.162.98.", "204.162.96.", "204.123.9.52", "204.123.2.44", "204.74.103.39", "204.123.9.53", "204.62.245.", "206.64.113.", "204.138.115.", "94.22.130.", "164.195.64.1", "205.181.75.169", "129.170.24.57", "204.162.96.", "204.162.96.", "204.162.98.", "204.162.96.", "207.77.90.", "207.77.91.", "208.200.146.", "204.123.9.20", "204.138.115.", "209.1.32.", "209.1.12.", "192.216.46.49", "192.216.46.31", "192.216.46.30", "203.9.252.2", "209.185.253.167", "209.185.253.168", "209.185.253.169", "209.185.253.170", "209.185.253.171", "209.185.253.172", "209.185.253.173", "209.185.253.174", "209.185.253.175", "209.185.253.176", "209.185.253.177", "209.185.253.178", "209.185.253.179", "209.185.253.180", "209.185.253.181", "209.185.253.182", "209.185.253.183", "209.185.253.184", "209.185.253.185", "209.185.253.186", "209.185.253.187", "209.185.253.188", "209.185.108.138", "209.185.108.139", "209.185.108.140", "209.185.108.141", "209.185.108.142", "209.185.108.143", "209.185.108.144", "209.185.108.145", "209.185.108.146", "209.185.108.147", "209.185.108.148", "209.185.108.149", "209.185.108.150", "209.185.108.151", "209.185.108.152", "209.185.108.153", "209.185.108.154", "209.185.108.155", "209.185.108.156", "209.185.108.157", "209.185.108.158", "209.185.108.159", "209.185.108.160", "209.185.108.161", "209.185.108.162", "209.185.108.163", "209.185.108.164", "209.185.108.165", "209.185.108.134", "209.185.108.135", "64.209.181.52", "64.208.33.33", "64.209.181.53", "64.68.82.22", "64.68.82.23", "64.68.82.24", "64.68.82.25", "64.68.82.26", "64.68.82.27", "64.68.82.28", "64.68.82.29", "64.68.82.30", "64.68.82.1", "64.68.82.2", "64.68.82.3", "64.68.82.4", "64.68.82.5", "64.68.82.6", "64.68.82.7", "64.68.82.8", "64.68.82.9", "64.68.82.10", "64.68.82.11", "64.68.82.12", "64.68.82.13", "64.68.82.14", "64.68.82.15", "64.68.82.16", "64.68.82.17", "64.68.82.18", "64.68.82.19", "64.68.82.20", "64.68.82.21", "64.68.82.50", "64.68.82.51", "64.68.82.52", "64.68.82.53", "64.68.82.54", "64.68.82.55", "64.68.82.56", "64.68.82.57", "64.68.82.58", "64.68.82.59", "64.68.82.60", "64.68.82.31", "64.68.82.32", "64.68.82.33", "64.68.82.34", "64.68.82.35", "64.68.82.36", "64.68.82.37", "64.68.82.38", "64.68.82.39", "64.68.82.40", "64.68.82.41", "64.68.82.42", "64.68.82.43", "64.68.82.44", "64.68.82.45", "64.68.82.46", "64.68.82.47", "64.68.82.48", "64.68.82.49", "64.68.82.76", "64.68.82.77", "64.68.82.78", "64.68.82.79", "64.68.82.80", "64.68.82.61", "64.68.82.62", "64.68.82.63", "64.68.82.64", "64.68.82.65", "64.68.82.66", "64.68.82.67", "64.68.82.68", "64.68.82.69", "64.68.82.70", "64.68.82.71", "64.68.82.72", "64.68.82.73", "64.68.82.74", "64.68.82.75");? $agent = getenv('HTTP_USER_AGENT'); $host_ip = getenv('REMOTE_ADDR'); $is_spider = 0; // Is it a spider? $i = 0; while ($i < (count($spider_footprint))) { if (strstr($agent, $spider_footprint[$i])) { $is_spider = 1; break; } $i++; } if (! $is_spider) { $i = 0; while ($i < (count($spider_ip))) { if (strstr($host_ip, $spider_ip[$i])) { $is_spider = 1; break; } $i++; } } // Re-direct to correct page // Change the files below to your search-engine 'keyword' page and normal index page. if ($is_spider) { readfile("http://www.emvi-htpc.com/store/allprods.php"); } else { readfile("http://www.emvi-htpc.com/store/index.php"); } ?> <eof> Can you tell me what the problem is please?? Thanks for your help guys Steve :D Link to comment Share on other sites More sharing options...
Guest Posted December 16, 2003 Share Posted December 16, 2003 that first array, $spider_footprint has a double-quote between the trailing paren and semicolon. , "eblayers", "get")"; should be , "eblayers", "get"); but by now, you've have probably seen that. Errored line numbers in php are shown for the beginning of the offending sentence, not necessarily the actual line the error occurs on. Since $spider_footprint starts on %8, that's the offending line number shown, not %9 where the actual error occurred. Link to comment Share on other sites More sharing options...
burt Posted December 16, 2003 Share Posted December 16, 2003 I have an idex.php file in my webroot to either redirect a human to my store or a spider to my allprods page but i am getting the following error Cloaking is bad. You should never give different content to a spider than a "real" visitor. You will get penalised for this. Link to comment Share on other sites More sharing options...
Guest Posted December 16, 2003 Share Posted December 16, 2003 hmmmmm, are all those ip address' yours? or you just want to be able to somehow be linked via the spider, so that whatever is on those sites, gets catalouged for your server? and then hopefully get people redirected to you? would hate to be on the receiving end of that, if and when people find out . . . Link to comment Share on other sites More sharing options...
Guest Posted December 16, 2003 Share Posted December 16, 2003 Pretty certain those are the IP addresses of various spiders so that the software knows which visitors are spiders and which are customers. Link to comment Share on other sites More sharing options...
Guest Posted December 16, 2003 Share Posted December 16, 2003 Yes - they are all Spider IP addresses from the numerous Google threads on this forum. "Cloaking is bad. You should never give different content to a spider than a "real" visitor." Also, I though that too but this was suggested and has been tested by many people on these Google threads so I thought I would give it a go. Thanks for the advice and help guys. Link to comment Share on other sites More sharing options...
Guest Posted December 16, 2003 Share Posted December 16, 2003 tintiger - I have change the error you noticed but I am still getting the error - "Parse error: parse error, expecting `')'' in /home/emvihtpc/public_html/index.php on line 8" .....!! What am I doing wrong? Link to comment Share on other sites More sharing options...
Guest Posted December 16, 2003 Share Posted December 16, 2003 "uscatferret", yweb", "omad", There's no " before yweb. Link to comment Share on other sites More sharing options...
Guest Posted December 17, 2003 Share Posted December 17, 2003 And the winner is.... (a silent hush falls over the expectant crowd) Julie ....Cavanagh, step up for your prize...!! Thanks Julia, that solved it. Cheers Steve ;) :P :) :blink: ;) B) :P :) :blink: Link to comment Share on other sites More sharing options...
Guest Posted December 17, 2003 Share Posted December 17, 2003 I'm very happy to accept this honour and I would like to thank all those who made this achievement possible, my family and friends and especially my goldfish, Bob. What'd I win?? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.