PHP security functions

Definition and Usage

addslashes()

addslashes () function returns a character string is added before the predefined backslash character.

 

Predefined characters are:

 

  • apostrophe(')
  • Double quotes(")
  • The backslash (\)
  • NULL

By default, PHP for all GET, POST and COOKIE data automatically run addslashes (). So you should not have escaped string using addslashes (), because this would lead to double-escape. Function may be used when this happens get_magic_quotes_gpc () is detected.

 

stripslashes () function deleted by  addslashes ()  backslash function added.

Note: This function can be used to clean up from the database, or from the retrieved HTML form data.

htmlentities () to convert characters to HTML entities:

 

Predefined characters are converted are:

 

& : Converting &

 

" : Converted to "

 

' : Convert to become '

 

< : Convert <

 

> : Convert >

 

 

 

 

Callback function to create functions

 

 

 

Guess you like

Origin www.cnblogs.com/pass-A/p/11132749.html