summaryrefslogtreecommitdiffstats
path: root/system/database
diff options
context:
space:
mode:
authoradmin <devnull@localhost>2006-09-27 22:42:42 +0200
committeradmin <devnull@localhost>2006-09-27 22:42:42 +0200
commit17a890df20b56c8d82812f365f27bc590be009f3 (patch)
tree15ec4f0afb68f774e0933fb27c27346ae262d060 /system/database
parentdcafe89f348697d273e21a2d451a99ba8c6ec68f (diff)
Diffstat (limited to 'system/database')
-rw-r--r--system/database/drivers/mysql/mysql_driver.php14
-rw-r--r--system/database/drivers/mysqli/mysqli_driver.php14
2 files changed, 26 insertions, 2 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);
+ }
}
// --------------------------------------------------------------------
diff --git a/system/database/drivers/mysqli/mysqli_driver.php b/system/database/drivers/mysqli/mysqli_driver.php
index d6e967498..63df0fe6f 100644
--- a/system/database/drivers/mysqli/mysqli_driver.php
+++ b/system/database/drivers/mysqli/mysqli_driver.php
@@ -225,7 +225,19 @@ class CI_DB_mysqli_driver extends CI_DB {
*/
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);
+ }
}
// --------------------------------------------------------------------