diff --git a/system/database/drivers/mysql/mysql_driver.php b/system/database/drivers/mysql/mysql_driver.php
index b6c4eb7..d4f322d 100644
--- a/system/database/drivers/mysql/mysql_driver.php
+++ b/system/database/drivers/mysql/mysql_driver.php
@@ -222,7 +222,19 @@
*/
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);
+ }
}
// --------------------------------------------------------------------
diff --git a/system/database/drivers/mysqli/mysqli_driver.php b/system/database/drivers/mysqli/mysqli_driver.php
index d6e9674..63df0fe 100644
--- a/system/database/drivers/mysqli/mysqli_driver.php
+++ b/system/database/drivers/mysqli/mysqli_driver.php
@@ -225,7 +225,19 @@
*/
function escape_str($str)
{
- return mysqli_real_escape_string($this->conn_id, $str);
+ if (get_magic_quotes_gpc())
+ {
+ return $str;
+ }
+
+ if (function_exists('mysql_escape_string'))
+ {
+ return mysqli_real_escape_string($this->conn_id, $str);
+ }
+ else
+ {
+ return addslashes($str);
+ }
}
// --------------------------------------------------------------------