summaryrefslogtreecommitdiffstats
path: root/system/database/drivers/mysql
diff options
context:
space:
mode:
Diffstat (limited to 'system/database/drivers/mysql')
-rw-r--r--system/database/drivers/mysql/mysql_driver.php14
1 files changed, 13 insertions, 1 deletions
diff --git a/system/database/drivers/mysql/mysql_driver.php b/system/database/drivers/mysql/mysql_driver.php
index b6c4eb7ea..d4f322d5f 100644
--- a/system/database/drivers/mysql/mysql_driver.php
+++ b/system/database/drivers/mysql/mysql_driver.php
@@ -222,7 +222,19 @@ class CI_DB_mysql_driver extends CI_DB {
*/
function escape_str($str)
{
- return mysql_real_escape_string($str);
+ if (get_magic_quotes_gpc())
+ {
+ return $str;
+ }
+
+ if (function_exists('mysql_escape_string'))
+ {
+ return mysql_real_escape_string($str);
+ }
+ else
+ {
+ return addslashes($str);
+ }
}
// --------------------------------------------------------------------