If you want to get user data from user and store data into database, you always use addslashes() functions for every input. Users may add javascript code or iframe code in databases, so try to use strip_tags() function as well.
addslashes() :- Returns a string with backslashes in front of predefined characters
strip_tags() :- Strips HTML and PHP tags from a string. The strip_tags() function strips a string from HTML, XML, and PHP tags.Strip the string from HTML tags, but allow tags to be used:
<?php
echo strip_tags("Hello <b><i>world!</i></b>","<b>");
?>
<p>This function strips a string from HTML, XML, and PHP tags. In this example, we allow <b> tags to be used (all other tags will be removed).</p>
When ever you show data to user or output information, always user strip_tags() function and allow only div, p,br,strong,or font tags. Strip all other tags, otherwise, some user will insert malicious code in database and may iframe data or output javascript code
Don?t store sensitive information in cookies.
Trending Tutorials