From 7a34a4441ab27297d8b268734000169a77ea1aad Mon Sep 17 00:00:00 2001 From: Jason Woofenden Date: Mon, 25 Dec 2006 02:15:57 -0500 Subject: [PATCH] added enc_sql() --- encode.php | 8 ++++++++ 1 file changed, 8 insertions(+) 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); -- 1.7.10.4