From 17f11a005c6557da8fec10dd5240d3ad7da28690 Mon Sep 17 00:00:00 2001 From: alopexc0de Date: Fri, 16 Nov 2012 04:19:10 -0500 Subject: [PATCH] My custom cleaning script - broke when moved from /img/test to /img --- img/functions/Sanatize.php | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 img/functions/Sanatize.php diff --git a/img/functions/Sanatize.php b/img/functions/Sanatize.php new file mode 100644 index 0000000..1aefdb6 --- /dev/null +++ b/img/functions/Sanatize.php @@ -0,0 +1,29 @@ +"); // Append error into common error string for parsing later + // To protect MySQL injection (more detail about MySQL injection) + $output = strip_tags($input); + $output = stripslashes($output); + $output = mysql_real_escape_string($output); + $output = strtolower($output); + return $output; +} + +function cln_file_name($string) { + $cln_filename_find=array("/\.[^\.]+$/", "/[^\d\w\s-]/", "/\s\s+/", "/[-]+/", "/[_]+/"); + $cln_filename_repl=array("", ""," ", "-", "_"); + $string=preg_replace($cln_filename_find, $cln_filename_repl, $string); + return trim($string); +} + +function get_ext($name) { + $name = substr(strrchr($key, "."), 1); + return $name; +} +?>