X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=encode.php;h=3a11689f465d9101a06b88a6c82033f062cf6e0d;hb=7a34a4441ab27297d8b268734000169a77ea1aad;hp=c3c71a7bb8a4613e7d27f697b564868d67b0e38e;hpb=15fa6e23941fd5497ca19266adaede5c19e3836a;p=wfpl.git 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);