ADBRITE ads links
You are here: CodeIdol.com > Php > PHP 5 in Practice > Data Validation And Standardization
PHP 5 in Practice
| 11. Data Validation and Standardization
With any type of general user input, such as that retrieved through form submissions, the programmer must always expect the worse, even if you do not consider malicious intent. Hence, you are always fa...
|
|
| 11.1. Phone Numbers
The phone numbers that this example deals with are those in the standard notation used in the United States: A phone number consists of a three-digit area code, followed by a three-digit exchange code, and then a four-digit num...
|
|
| 11.2. ZIP Codes
The format of ZIP Codes in the United States is straightforword and easy to standardize and validate against: five digits followed optionally by a dash and four more digits. Though the format is easily dealt with, the problem of va...
|
|
| 11.3. Social Security Numbers (SSNs)
In the United States, everyone is issued a Social Security Number (SSN), which ends up being used as your unique identifier in many circumstances; therefore, it is often requested of people on forms. It alway...
|
|
| 11.4. Numbers
When dealing with numbers, such as monetary amounts, no generic validation really can be done. Instead you need to check the number entered against the range of numbers that is valid for that specific input. We can, however, create a...
|
|
| 11.5. Credit Card Numbers
If dealing with any sort of commerce website, you will need to take credit card numbers. Credit card companies have built a verification system into the card numbers, which makes the verification process possible. After s...
|
|
| 11.6. Dates
Because PHP provides a number of excellent date tools, very little work is needed to standardize or validate dates. In particular, the strtotime() function converts most string representations of dates into UNIX timestamps. If it fai...
|
|
| 11.7. Email Accounts
Email accounts follow a set pattern of what is allowed. An email address must start with a character, number, underscore, or dash. It can then have any number of those characters plus periods. An "at" sign (@) follow...
|
|
| 11.8. URLs
If you have a web form where you are asking users for their home site, it might be worthwhile to do a quick validation of this URL just to determine whether it appears to be valid. There are really two levels of checking the validity of...
|
|
You are here: CodeIdol.com > Php > PHP 5 in Practice > Data Validation And Standardization
|
|
Related tags
Popular Categories
Unix books and guides
AJAX popular information
C# language guides
Windows books and cookbooks
.......
|
|