note 56400 deleted from function.htmlspecialchars by cmb

From: Date: Sun, 27 Oct 2019 09:13:44 +0000
Subject: note 56400 deleted from function.htmlspecialchars by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-212840@lists.php.net to get a copy of this message
Note Submitter: Luiz Miguel Axcar (lmaxcar at yahoo dot com dot br) ---- Hello, If you are getting trouble to SGDB write/read HTML data, try to use this: <?php //from html_entity_decode() manual page function unhtmlentities ($string) { $trans_tbl =get_html_translation_table (HTML_ENTITIES ); $trans_tbl =array_flip ($trans_tbl ); return strtr ($string ,$trans_tbl ); } //read from db $content = stripslashes (htmlspecialchars ($field['content'])); //write to db $content = unhtmlentities (addslashes (trim ($_POST['content']))); //make sure result of function get_magic_quotes_gpc () == 0, you can get strange slashes in your content adding slashes twice //better to do this using addslashes $content = (! get_magic_quotes_gpc ()) ? addslashes ($content) : $content; ?>

« previous php.notes (#212840) next »