PHP's Filter Module

Preview:

DESCRIPTION

An overview of PHP's Filt

Citation preview

PHP’s Filter Extension

August 16, 2011 NWO-PUG 1

E-mail: chris@ctankersley.comTwitter: @dragonmantankIdenti.ca: dragonmantank

Who Are You and Why Are You In My House?

Chris Tankersley Doing PHP for 8 Years Lots of projects no one uses, and a

few that some do TL;DR

https://github.com/dragonmantank

April 26, 2011 NWO-PUG 2

Some Background

Enabled by default since 5.2.0 Provides both Validation and

Sanitization Very easy to use to work with data Exposed via the filter_var() function

April 26, 2011 NWO-PUG 3

Validation

Makes sure that data meets specifications An e-mail address looks like an e-mail address

Allows basic validation Boolean E-mail Float Int IP Regex URL

April 26, 2011 NWO-PUG 4

Validating Data

April 26, 2011 NWO-PUG 5

What Filters are Available?

April 26, 2011 NWO-PUG 6

Sanitization

Removes data that does not meet specifications

Many more options with this

April 26, 2011 NWO-PUG 7

Sanitizing Data

April 26, 2011 NWO-PUG 8

What Sanitizers are Available?

April 26, 2011 NWO-PUG 9

What Sanitizers are Available?

April 26, 2011 NWO-PUG 10

Manual Filters

April 26, 2011 NWO-PUG 11

filter_has_var

Used as further validation for data input

April 26, 2011 NWO-PUG 12

April 26, 2011 NWO-PUG 13

Questions?

April 26, 2011 NWO-PUG 14

LinksWhere to Find Stuff I Talked About

April 26, 2011 NWO-PUG 15

Links

Filter Documentation http://www.php.net/manual/en/

book.filter.php

April 26, 2011 NWO-PUG 16

Recommended