A
A
Andrey Terentiev2014-10-05 11:49:31
PHP
Andrey Terentiev, 2014-10-05 11:49:31

Why is this design not allowed?

Good time of the day. On Habré I read that such a construction is unacceptable. Why and how to do it right? I understand it's just not safe. XSS?

<?php
$name = $_GET['name'];
echo "Hello, <b>$name</b>!";
?>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2014-10-05
@jkwe45

well, yes, it would be necessary to run it through strip_tags/htmlentities at least during the output. You need to filter not only user input, but also the output of user data. Users, you know, can't be trusted.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question