PHP Security
PHP Security - Important Points
21. | What is the purpose of the htmlspecialchars() function in PHP? |
---|
A. To encrypt passwords
B. To validate email addresses
C. To convert special characters to HTML entities
D. To generate random numbers
View Answer Discuss Work SpaceAnswer: option c
Explanation:
22. | What is the purpose of the strip_tags() function in PHP? |
---|
A. To encrypt data
B. To validate user input
C. To remove HTML tags from a string
D. To generate random strings
View Answer Discuss Work SpaceAnswer: option c
Explanation:
23. | Which of the following is a method to prevent cross-site scripting (XSS) attacks in PHP? |
---|
A. Using prepared statements and parameterized queries
B. Storing session IDs in plaintext
C. Using SSL encryption
D. Sanitizing user input
View Answer Discuss Work SpaceAnswer: option d
Explanation:
24. | What is the purpose of the md5() function in PHP? |
---|
A. To generate random numbers
B. To validate email addresses
C. To encrypt passwords
D. To convert special characters to HTML entities
View Answer Discuss Work SpaceAnswer: option c
Explanation:
25. | Which of the following is a method to prevent brute force attacks in PHP? |
---|
A. Allowing unlimited login attempts
B. Using CAPTCHA
C. Using plaintext passwords
D. Storing passwords in cookies
View Answer Discuss Work SpaceAnswer: option b
Explanation: