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! Link to comment https://forums.phpfreaks.com/topic/186835-help-me-wrap-this-up-lol/ 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.. Link to comment https://forums.phpfreaks.com/topic/186835-help-me-wrap-this-up-lol/#findComment-986715 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. Link to comment https://forums.phpfreaks.com/topic/186835-help-me-wrap-this-up-lol/#findComment-986944 Share on other sites More sharing options...
STaRDoGG Posted January 5, 2010 Author Share Posted January 5, 2010 Anyone? Link to comment https://forums.phpfreaks.com/topic/186835-help-me-wrap-this-up-lol/#findComment-988495 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.