Escape request and database values in forms and links.
Add form_value() in html.lib.php.
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
// Escape plain text for HTML (existing entities such as … are kept)
|
||||
function h($string) {
|
||||
return htmlspecialchars((string)$string, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8', FALSE);
|
||||
}
|
||||
|
||||
// Escape a raw value for an attribute or a textarea, so that it comes back unchanged
|
||||
function form_value($string) {
|
||||
return htmlspecialchars((string)$string, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user