Jump to content

function wideban question


Undoubtedly0

Recommended Posts

Sorry, clearly I'm an imbecile - here it is:

 

	function wideban($address) 
{
	$this_ban = "*";
	$dot = explode(".", $address);
	foreach ($dot as $yah_dot_yah) 
	{			
		$numbers = array('1', '2', '3', '4', '5', '6', '7', '8', '9', '0');
		foreach ($numbers as $this_num) 
		{
			$pos = strpos($yah_dot_yah, $this_num);
			if ($pos === false) 
			{
				$num = FALSE; } else { $num = TRUE; $never_set = TRUE;
			}
		}
		if (!$num) 
		{
			$this_ban .= ".$yah_dot_yah"; $num = FALSE; 
		}		
	}

	if (!$never_set) 
	{
		$this_ban = "*";
		foreach ($dot as $this_dot) 
		{
			if ($first) 
			{
				$this_ban .= ".$this_dot"; 
			}
		$first = TRUE;
		}
	}
	return $this_ban;
}

um...something that makes no sense

Lets say you use it like this:

print wideban("www.google.com");

it returns "*.google.com"

if you use it like this:

print wideban("http://google.com");

it returns "*.com"

 

it doesn't handle IP addresses too well, though. if you put "127.0.0.1" it returns "*.127.0.0.1"

yeah...I looked at it, and looked at, and looked at it...and looked at it...and decided fuck it, who cares.  I don't really see how that function would really be useful for anything.  Not gonna jump the gun and say it isn't...I mean, I don't know the context for which it's in...but at the very least, it's very bloated...

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.