From: Jason Woofenden Date: Mon, 25 Dec 2006 07:15:57 +0000 (-0500) Subject: added enc_sql() X-Git-Url: https://jasonwoof.com/gitweb/?p=wfpl.git;a=commitdiff_plain;h=7a34a4441ab27297d8b268734000169a77ea1aad added enc_sql() --- diff --git a/encode.php b/encode.php index c3c71a7..3a11689 100644 --- a/encode.php +++ b/encode.php @@ -22,6 +22,14 @@ # This file contains basic encodings +# encode for putting within double-quotes in SQL +function enc_sql($str) { + $str = str_replace("\\", "\\\\", $str); + $str = str_replace('"', "\\\"", $str); + return $str; +} + +# encode for output in html. does nothing with whitespace function enc_html($str) { $str = str_replace('&', '&', $str); $str = str_replace('<', '<', $str);