National_Instruments
200-500 · Question #243
You run the following PHP script: <?php $name = mysql_real_escape_string($_POST["name"]); $password = mysql_real_escape_string($_POST["password"]); ?> What is the use of the…
The correct answer is A. It can be used as a countermeasure against a SQL injection attack. C. It escapes all special characters from strings $_POST["name"] and $_POST["password"]. See the full explanation below for the reasoning.
Question
You run the following PHP script:
<?php $name = mysql_real_escape_string($_POST["name"]); $password = mysql_real_escape_string($_POST["password"]); ?> What is the use of the mysql_real_escape_string() function in the above script. Each correct answer represents a complete solution. Choose all that applyOptions
- AIt can be used as a countermeasure against a SQL injection attack.
- BIt escapes all special characters from strings $_POST["name"] and $_POST["password"]
- CIt escapes all special characters from strings $_POST["name"] and $_POST["password"].
- DIt can be used to mitigate a cross site scripting attack.
How the community answered
(19 responses)- A68% (13)
- B11% (2)
- D21% (4)
Community Discussion
No community discussion yet for this question.