Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Kevin Schroeder's Blog:
Subnet validation with Zend Framework
Jan 11, 2011 @ 14:20:03

Kevin Schroeder has a new post to his blog today looking at a method for validating subnets with the Zend Framework using the Zend_Validate component.

I saw on a StackOverflow posting, someone was asking to see how you could use a Zend Framework validator to tell if an IP address was between two addresses. The individual was trying to use Zend_Validate_Between to do the checking. [...] So, assuming that the individual was actually asking about subnet validation, and seeing that I couldn't find a subnet validator for Zend Framework, I wrote a quick one.

The code for the validator is included - an extension of the Zend_Validator class that using the ip2long function to determine the netmask from a given subnet and an "isValid" method to call for the check. There's also a unit test included that you can drop into your test suites.

tagged: zendframework zenvalidate subnet netmask tutorial

Link:

Kevin Schroeder's Blog:
You want to do WHAT with PHP? Chapter 1
Aug 26, 2010 @ 16:03:27

Kevin Schroeder has a new post today with an excerpt from his book "You Want to do WHAT with PHP?" - the first chapter looking at networking and socket connections.

I'm also woefully behind on blogging. So, to alleviate that I am going to post an excerpt from my upcoming book "You want to do WHAT with PHP?" Today we are going to take a look at Chapter 1.

The sample chapter talks about figuring out the host to netmask relationship relationship by parsing the IP with the ip2long and comparing that to the list of netmasks from an array. Sample code is provided as well as output for reference.

tagged: book excerpt networking sockets netmask ip

Link:


Trending Topics: