Forum Moderators: coopster
if (!preg_match("/^([a-zA-Z0-9]+)$/", $user)) {
$notice = "<div id=\"failure\">Only alphabets and numbers allowed for usernames.</div>";
so, is it vulnerable to XSS attacks even if m filtering the data and allowing the insertion of trusted data?
Cross Site Scripting (XSS): this involves the bad guy injecting HTML and JavaScript into a page through a form, which enables him to read cookies or make fake pages. Can easily be prevented by using
htmlspecialchars()when writing user input to HTML.
SQL injection: query a database at will by forgering the query string. Can easily be prevented by proper escaping of user input (
mysql_real_escape_string()).