STaRDoGG Posted January 1, 2010 Share Posted January 1, 2010 Hey all, I know this is on the easier side, but I'm kinda drunk and my brain is fried from too much coding lately, lol. Here is the code I'm running into a problem with: // Display a list of currently online guests. if ($total_guests) { $output.="<div class=\"item-list\"><h7>Anonymous</h7><ul><fine>"; $guestitems = array(); // Create array of guests we want to filter out $GSONExclude = array_map('trim', explode("\n", variable_get('stats_filter', 'googlebot'))); while ($guests-- && $account = db_fetch_object($guests_hostname)) { $guestitems[] = $account->hostname; $resolved = gethostbyaddr($account->hostname); } foreach ($GSONExclude as $value) { $pos = strpos($resolved, $value); if ($pos !== true) { $output.="<li><a title=\"Go to address\" href=\"http://www.maxmind.com/app/locate_ip?ips=$account->hostname\" target=\"_blank\">$account->hostname</a><br>" . $resolved; break; } } $output.="</fine></ul></div>"; } } To sum up, what I'm trying to do is, this code generates a list of anonymous users, (in drupal) but I want to filter OUT the search engine spiders. $resolved contains the resolved DNS of an IP address. so if it contains a string like "crawl" or "spider" (which is being taken from the $GSONExclude array) I want to filter it out, and not add it to the list. Anything else, I want added to the list. Anyone with a fresh brain able to point out whats wrong? I'd appreciate it. Thanks! Quote Link to comment Share on other sites More sharing options...
Deoctor Posted January 1, 2010 Share Posted January 1, 2010 is this ur complete code.. coz u have one extra } in the code at the last.. Quote Link to comment Share on other sites More sharing options...
STaRDoGG Posted January 2, 2010 Author Share Posted January 2, 2010 Oops, that last brace is just from this at the top of the code: if (variable_get('enable_stats_guests', 1)) { I forgot to paste that last night. Quote Link to comment Share on other sites More sharing options...
STaRDoGG Posted January 5, 2010 Author Share Posted January 5, 2010 Anyone? Quote Link to comment 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.