note 106835 added to function.sqlite-escape-string

From: Date: Sat, 10 Dec 2011 18:29:00 +0000
Subject: note 106835 added to function.sqlite-escape-string
Groups: php.notes 
Request: Send a blank email to php-notes+get-185013@lists.php.net to get a copy of this message
sqlite_escape_string() does not catch all HTML characters that may conflict with a browser display. Notice the difference with the custom routine below # php lib command $str = "Advoid! /slashes\, 'single' and these <too>"; $str = sqlite_escape_string($str); echo "<br>$str<br>"; # custom function $str = "Advoid! /slashes\, 'single' and these <too>"; $str = clean($str); echo "<br>$str<br>"; function clean($str) { $search = array('&' , '"' , "'" , '<' , '>' ); $replace = array('&amp;', '&quot;', '&#39;', '&lt;', '&gt;' ); $str = str_replace($search, $replace, $str); return $str; } Output: Advoid! /slashes\, "single" and these Advoid! /slashes\, 'single' and these <too> ---- Server IP: 69.147.83.197 Probable Submitter: 75.167.170.164 ---- Manual Page -- http://www.php.net/manual/en/function.sqlite-escape-string.php Edit -- https://master.php.net/note/edit/106835 Del: integrated -- https://master.php.net/note/delete/106835/integrated Del: useless -- https://master.php.net/note/delete/106835/useless Del: bad code -- https://master.php.net/note/delete/106835/bad+code Del: spam -- https://master.php.net/note/delete/106835/spam Del: non-english -- https://master.php.net/note/delete/106835/non-english Del: in docs -- https://master.php.net/note/delete/106835/in+docs Del: other reasons-- https://master.php.net/note/delete/106835 Reject -- https://master.php.net/note/reject/106835 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#185013) next »