After i echo: mysqli_real_escape_string($dbc, '"conn"e"cting"')

It put: "conn"e"cting" on my remote and native server

that is the way it said to be, but issue is, it's saving ["conn"e"cting"] to database during my local database, while saving ["conn"e"cting"] using the back slashes to my remote database. Must I configure my remote database? How? I am using nearlyfreespeech's service.


Your remote php.ini has magic quotes enabled.

You should check by running...

var_dump(get_magic_quotes_gpc()); // True means it is enabled

It'll escape all of the GET, Publish &lifier COOKIE super globals instantly - however getting away again will give you a slash that'll be placed.

Disable miracle quotes in your server, or make use of a miracle quotes disabler functions if crippling them in impossible.


For that hell from it, here's one I simply composed

if (get_magic_quotes_gpc()) {

   function stripSlashesRecursive($array) {
       $stripped = array();
       foreach($array as $key => $member) {
          if (is_array($member)) {
             $stripped[stripslashes($key)] = stripSlashesRecursive($member);
          } else {
              $stripped[stripslashes($key)] = stripslashes($member);

       return $stripped;

    $globals = array('_GET', '_POST', '_COOKIE', '_REQUEST');

    foreach($globals as $global) {
       $$global = stripSlashesRecursive($$global);


It works!

If you are running PHP 5.3, this will have the desired effect:

if ((get_magic_quotes_gpc() === 1) && (version_compare(PHP_VERSION, '5.3.0', '>=') === true))
    $_GET = json_decode(stripslashes(json_encode($_GET, JSON_HEX_APOS | JSON_HEX_QUOT)), true);
    $_POST = json_decode(stripslashes(json_encode($_POST, JSON_HEX_APOS | JSON_HEX_QUOT)), true);
    $_COOKIE = json_decode(stripslashes(json_encode($_COOKIE, JSON_HEX_APOS | JSON_HEX_QUOT)), true);
    $_REQUEST = json_decode(stripslashes(json_encode($_REQUEST, JSON_HEX_APOS | JSON_HEX_QUOT)), true);

I believe an simpler option would be to create the php.ini directive for runtime miracle quotes to inside your script, like so:

ini_set('magic_quotes_runtime', '0');

Miracle_quotes_gpc is really a separate directive which only is applicable to obtainOrPublish/Cookie procedures, Axil. The ini_set() function may be used to change php.ini configurations temporarily(the duration of the script). It'll make sure you get exactly the same behavior across all servers. the parameters would be the title from the directive you need to set and also the new value, both as strings.

Best of luck!