Validating date in php 100 dating hot dating
The configured payload is not used by the Validator component, but its processing is completely up to you.
With more and more personal information being stored on the Web—credit card data, social security numbers, maiden names, favorite pets—today's PHP developer cannot afford to be ignorant when it comes to security.
Defence in Depth is essential when dealing with passed form variables.
We validate this date of birth to check it has been entered, and to check its format, its validity, and whether it's within a range; the range of valid dates in the example begins with the user being alive-we assume alive users are born after 1890-and ends with the user being at least 18 years of age.
However, if one or more dates are extracted in the script from a database, My SQL date and time functions are a useful alternative.
However, validation and error-checking/reporting is still your call.
Last, we check if the user was born exactly 18 years ago, in the current month, and on a day less than or equal to the current day; yet again, if this is true, there is no error.
The parameters to the function are discussed in Chapter 2.
You may need this as somebody may decide to spoof your form and send all manner of nonsense to your server.
So, you cannot depend on receiving valid 'date' info.