Jump to content

Help me wrap this up? lol


STaRDoGG

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.