开发者

magic_quotes help

Recently I have been faced with the problematics that magic_quotes provides. I did notice that there were 3 different type(s) however which does what?

  • magic_quotes_gpc
  • magic_quotes_runtime
  • magic_quotes_sybase

I know it's always good practice to do a check for enabled magic quotes but which ones should be check if not just GPC?

if (get_magic_quotes_gpc() || get_magic_quotes_runtime()) {
    $string = stripslashes($string);    
}

I want to be able to have some开发者_运维技巧thing similar to this that runs in any code that I do so that way if ever an issue with the server I am working with it will fix any magic quote issues.

How would you guys/girls perform the check that's successful or is this completely correct?


magic_quotes_gpc() applies to data coming from (G)ET, (P)OST, and (C)OOKIEs

magic_quotes_runtime() applies to data coming in from ANY source (file_get_contents(), fread(), etc...)

magic_quotes_sybase switches between escaping with a single quote (') and a backslash (\), as not all databases use backslashes for escaping (like sybase).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜