Re: Kill Magic Quotes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




 public static function restoreSlashes($string)
 {
  // Check if "Magic Quotes" is turned on.
  if (get_magic_quotes_gpc())
  {
    // Add escape slashes.
    return addslashes($string);
  }
  // Return a string that has escape slashes.
  return $string;
}

Wrong way around.

If gpc is enabled, then there are already slashes - no need to add them again.

If it's not, you need to addslashes.

if (get_magic_quotes_gpc()) {
  return $string;
}

return addslashes($string);


Though I'm curious why you need to re-add them at all.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux