Issue
http://pastebin.com/Jti6DWU6 <-- This is a script in which there are 3 forms and i want to prevent special chars in the first field to prevent iFrame Injection... I suck at programming Can anyone help me with this?
Solution
You may use htmlspecialchars
, that's what that function is for.
Here's an example from the manual:
<?php
$new = htmlspecialchars("<a href='test'>Test</a>", ENT_QUOTES);
echo $new; // <a href='test'>Test</a>
?>
Just add the string to the 1st argument of the function. The 2nd will tell the function how to handle quotes. In the example above, it will convert both double and single quotes.
Answered By - user882670 Answer Checked By - Terry (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.