Преглед на файлове

Expand then limit query string NULL mods to insert statements only.

Nate Jones преди 11 години
родител
ревизия
0691829679
променени са 1 файла, в които са добавени 10 реда и са изтрити 2 реда
  1. 10 2
      resources/functions.php

+ 10 - 2
resources/functions.php

@@ -62,8 +62,16 @@
 
 
 	if (!function_exists('check_sql')) {
 	if (!function_exists('check_sql')) {
 		function check_sql($string) {
 		function check_sql($string) {
-			$string = str_replace("''", "null", $string);
-			return trim($string); //remove white space
+			// if insert statement
+			if (strpos(strtolower(trim($string)), "insert") == 0) {
+				$string = str_replace(" ''", " null", $string);
+				$string = str_replace(",''", ",null", $string);
+				$string = str_replace("'',", "null,", $string);
+				$string = str_replace("(''", "(null", $string);
+				$string = str_replace("'')", "null)", $string);
+				$string = str_replace("'' )", "null )", $string);
+			}
+			return trim($string); //remove white space  ADD TRIM BACK IN!
 		}
 		}
 	}
 	}