Tuesday, 15 April 2014

html - PHP Filter vs PHP htmlspecialchars vs sqli prepare -



html - PHP Filter vs PHP htmlspecialchars vs sqli prepare -

i've been curious advantages/disadvantages of mentioned methods of sql injection prevention.

the php filter checks see whether input of right format , returns true or false, can take send server or not.

php htmlspecialchars() function converts special charactors string equivalents.

i'm not exclusively sure on how sqli prepare works have limited knowledge of sql of now, right in assuming isn't necessary if utilize either php filter functions and/or htmlspecialchars?

just note: if have wrong, please maintain flaming constructive, i'm still learning php , sql.

the 3 things mention different, , 1 has sql injection.

filters, say, validating input; instance, making sure doesn't type phone number email address field. they're not security, info require. htmlspecialchars escapes text for utilize in html, makes sure people can't trick site outputting <script> tags, instance. it's of import escape info context you're using in, should never store html-escaped text in database, , escape when outputting html. prepared, parameterised, statements effective safeguard against sql injection. instead of escaping each string prevent beingness run sql, thought separate query data, sending query database placeholders dynamic info go. since db knows values pass "fill in" placeholders data, attacker cannot trick running sql mixed in input.

php html sql

No comments:

Post a Comment