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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.