Php Objective Questions with Answers for written test exams 49

Question 49
Which of the following data filtering methods can be described as a whitelist

approach?

A. Make sure that a username does not contain backticks or angled brackets.

B. Only allow alphanumerics and underscores in a username.

C. Pass all incoming data through strip_tags().

D. Use htmlentities() to escape potentially malicious characters.
Answers 49


Answer B is correct. Answer A is incorrect because this assumes that any username

without backticks or angled brackets is valid. Answer C is incorrect because this

only removes HTML and PHP tags, assuming everything else to be valid. Answer

D is incorrect because htmlentities() only encodes HTML entities and is not

intended to filter data at all.

  







Disclimer: PCDS.CO.IN not responsible for any content, information, data or any feature of website. If you are using this website then its your own responsibility to understand the content of the website

--------- Tutorials ---