Code Duplication    Length = 7-7 lines in 2 locations

sources/database/Db-mysql.class.php 1 location

@@ 236-242 (lines=7) @@
233
			$clean = trim(strtolower(preg_replace($allowed_comments_from, $allowed_comments_to, $clean)));
234
235
			// Comments?  We don't use comments in our queries, we leave 'em outside!
236
			if (strpos($clean, '/*') > 2 || strpos($clean, '--') !== false || strpos($clean, ';') !== false)
237
				$fail = true;
238
			// Trying to change passwords, slow us down, or something?
239
			elseif (strpos($clean, 'sleep') !== false && preg_match('~(^|[^a-z])sleep($|[^[_a-z])~s', $clean) != 0)
240
				$fail = true;
241
			elseif (strpos($clean, 'benchmark') !== false && preg_match('~(^|[^a-z])benchmark($|[^[a-z])~s', $clean) != 0)
242
				$fail = true;
243
244
			if (!empty($fail) && function_exists('log_error'))
245
				$this->error_backtrace('Hacking attempt...', 'Hacking attempt...' . "\n" . $db_string, E_USER_ERROR, __FILE__, __LINE__);

sources/database/Db-postgresql.class.php 1 location

@@ 287-293 (lines=7) @@
284
			$clean = trim(strtolower(preg_replace($allowed_comments_from, $allowed_comments_to, $clean)));
285
286
			// Comments?  We don't use comments in our queries, we leave 'em outside!
287
			if (strpos($clean, '/*') > 2 || strpos($clean, '--') !== false || strpos($clean, ';') !== false)
288
				$fail = true;
289
			// Trying to change passwords, slow us down, or something?
290
			elseif (strpos($clean, 'sleep') !== false && preg_match('~(^|[^a-z])sleep($|[^[_a-z])~s', $clean) != 0)
291
				$fail = true;
292
			elseif (strpos($clean, 'benchmark') !== false && preg_match('~(^|[^a-z])benchmark($|[^[a-z])~s', $clean) != 0)
293
				$fail = true;
294
295
			if (!empty($fail) && class_exists('Errors'))
296
				$this->error_backtrace('Hacking attempt...', 'Hacking attempt...' . "\n" . $db_string, E_USER_ERROR, __FILE__, __LINE__);