Security PHP functions for secure PHP programming

PHP validation functions

is_numeric()

is_array()

strlen()

ctype_alnum()

ctype_alpha()

ctype_cntrl()

ctype_digit()

ctype_xdigit()

ctype_lower()

ctype_upper()

ctype_print()

ctype_punct()

ctype_space()

 

PHP filter functions

filter_input()

filter_var()

 

PHP validation filters

FILTER_VALIDATE_INT

FILTER_VALIDATE_BOOLEAN

FILTER_VALIDATE_FLOAT

FILTER_VALIDATE_REGEXP

FILTER_VALIDATE_URL

FILTER_VALIDATE_EMAIL

FILTER_VALIDATE_IP

 

PHP sanitizing filters

FILTER_SANITIZE_STRIPPED

FILTER_SANITIZE_ENCODED

FILTER_SANITIZE_SPECIAL_CHARS

FILTER_SANITIZE_EMAIL

FILTER_SANITIZE_URL

FILTER_SANITIZE_NUMBER_INT

FILTER_SANITIZE_NUMBER_FLOAT

FILTER_SANITIZE_MAGIC_QUOTES

FILTER_CALLBACK

 

PHP escaping and encoding functions

htmlspecialchars(); //echo htmlspecialchars($_GET[‘name’], ‘utf-8’, ENT_QUOTES);

htmlentities(); //echo htmlentities($_GET[‘name’], ‘utf-8’, ENT_QUOTES);

urlencode(); //$url = ‘http://www.domain.com/?param=’.urlencode($_GET[‘param’]);

addslashes()

addcslashes()

mysql_real_escape_string()  deprecated as of PHP 5.5.0 

 mysqli_real_escape_string() or use PDO::prepare

preg_quote()

escapeshellarg()

escapeshellcmd()

Anuncis

Etiquetes: ,

Deixa un comentari

Fill in your details below or click an icon to log in:

WordPress.com Logo

Esteu comentant fent servir el compte WordPress.com. Log Out / Canvia )

Twitter picture

Esteu comentant fent servir el compte Twitter. Log Out / Canvia )

Facebook photo

Esteu comentant fent servir el compte Facebook. Log Out / Canvia )

Google+ photo

Esteu comentant fent servir el compte Google+. Log Out / Canvia )

Connecting to %s


%d bloggers like this: