Verify Security Refactoring

Let’s practice what we learned in the previous lesson.

In the previous lesson, we learned how to escape HTML tags with the htmlspecialchars() function and how to avoid the duplication of content.

Now it’s time for us to test these two functionalities.

First, we’ll open the task form by clicking the “Add task” button and enter the following: <script>alert('Hello world')</script>. After that, we’ll go to the task list by clicking the “Task list” button. We’ll then see that the script is not executed.

Lastly, we’ll open the project form and try to add the “Learn Node.js” title twice. We should see that it is no longer possible to enter the same title twice.

Get hands-on with 1400+ tech skills courses.