JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
added enc_sql()
authorJason Woofenden <jason183@herkamire.com>
Mon, 25 Dec 2006 07:15:57 +0000 (02:15 -0500)
committerJason Woofenden <jason183@herkamire.com>
Mon, 25 Dec 2006 07:15:57 +0000 (02:15 -0500)
encode.php

index c3c71a7..3a11689 100644 (file)
 
 # 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('&', '&amp;', $str);
        $str = str_replace('<', '&lt;', $str);