How to write secure Yii1 applications

Comparing #8 with #9

Revision #9 was created by acorncom acorncom on May 17, 2012, 4:44:34 PM.

fixed the striptags function, it's actually strip_tags

Content

[...]
This function is in fact a wrapper on `htmlspecialchars()` with your application's characters set
(to be exact, it's not a charset but a character encoding).
So if your texts are not (yet) in UTF-8, you should declare a charset in the global config
(e.g. `'charset' => 'ISO-8859-1'` in the first level of "protected/config/main.php").

You may want to apply `strip
_tags()`, to remove HTML/XML tags before escaping.
Beware, this function is not secure, so do not use it without `CHtml::encode()`.

#### Rich text (HTML)

If you want to allow HTML in the user input, then you have to display it raw.
[...]