Undoubtedly0 Posted July 25, 2009 Share Posted July 25, 2009 Can anyone tell me what 'function wideban' does? I copied a script that had code that looked like this, but I couldn't figure out what it meant: function wideban($address) { //... } Thanks for your help. Quote Link to comment https://forums.phpfreaks.com/topic/167437-function-wideban-question/ Share on other sites More sharing options...
.josh Posted July 25, 2009 Share Posted July 25, 2009 how are we supposed to tell you what it does when you remove all the code and put // ... in there? Or if that's really what's in there, then it does nothing. Quote Link to comment https://forums.phpfreaks.com/topic/167437-function-wideban-question/#findComment-882902 Share on other sites More sharing options...
Undoubtedly0 Posted July 26, 2009 Author Share Posted July 26, 2009 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; } Quote Link to comment https://forums.phpfreaks.com/topic/167437-function-wideban-question/#findComment-882938 Share on other sites More sharing options...
jonsjava Posted July 26, 2009 Share Posted July 26, 2009 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" Quote Link to comment https://forums.phpfreaks.com/topic/167437-function-wideban-question/#findComment-882962 Share on other sites More sharing options...
.josh Posted July 26, 2009 Share Posted July 26, 2009 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... Quote Link to comment https://forums.phpfreaks.com/topic/167437-function-wideban-question/#findComment-882976 Share on other sites More sharing options...
Philip Posted July 26, 2009 Share Posted July 26, 2009 I don't really see how that function would really be useful for anything. [....] it's very bloated... my thoughts. Quote Link to comment https://forums.phpfreaks.com/topic/167437-function-wideban-question/#findComment-882977 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.