Dlaczego mój kod jest podatny na atak xss?
Mam taki kod php
<?php
$input_from_user = "w' onclick = 'alert(document.cookie);'";
$i_am_barcelona_fan = htmlentities($input_from_user);
?>
<input type = 'text' name = 'messi_fan' value ='<?php echo $i_am_barcelona_fan;?>' />
ja używamhtmlentities
aby chronić się przed atakiem XSS, ale nadal jestem podatny na powyższy ciąg. Dlaczego mój kod jest podatny na atak XSS? Jak mogę zabezpieczyć się przed tym kodem?