问题标签 [magic-quotes-gpc]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
318 浏览

php - PHP 5.3 magic_quotes_gpc 开启但不工作

我有问题magic_quotes_gpc。我正在将网络服务器从 XP 机器迁移到 Win2003 机器。PHP 代码在某些情况下很旧,而且开发得不是很好,所以我真的需要magic_quotes_gpc工作。

我很确定配置正确,我也尝试复制旧的 PHP 文件夹和 php.ini,但仍然有问题。拥有magic_quotes_gpc = On拥有它的确切行为magic_quotes_gpc = Off

尝试使用 PHP 5.3,但即使旧的 5.1 在旧服务器上正常工作。

唯一的区别是在新服务器中我使用 FastCGI。

我真的在你手中解决这个问题,我真的快疯了!

20140326 - 根据 Alvaro 建议添加代码示例

调用 page ./sample.php?id=1,只显示这一行(我有错误):

PHP Notice: Use of undefined constant id - assumed 'id' in C:\Inetpub\wwwroot\simple.php on line 4

评论第 4 行:

正如预期的那样,输出为 1。

0 投票
2 回答
588 浏览

php - PHP 添加了转义反斜杠。如何阻止这个

背景:我不是 php 程序员,我只知道让我的 iOS 应用程序的 Web 服务部分正常工作。

我发现我的 php 在我不想要的时候在我的文本中添加了反斜杠。例如,如果我设置一些这样的变量:

然后我通过 JSON 数组输出回我的设备:

我得到

我在我的 php 中运行了 get_magic_quotes_gpc ,它报告魔术引号已关闭。我这样做:

我尝试使用 stripslashes() (在原始变量或输出上)并且没有任何变化。

那么我该如何阻止它这样做呢?因为这意味着我不能告诉我的 php 删除特定目录中的文件。

提前致谢

0 投票
1 回答
258 浏览

php - 获取未转义的 POST,而不是 WordPress 中的魔法引用值

跟随问题:禁用“魔术引号”后,为什么 PHP/WordPress 继续自动转义我的 POST 数据?

在 WordPress 中,即使魔术引号关闭,所有超全局变量也会被转义。

所以,按照这个答案:禁用“魔术引号”后,为什么 PHP/WordPress 继续自动转义我的 POST 数据?

如果我创建一个插件和一个类来访问原始 POST、GET 等,这是一个好的解决方案吗?您在这种方法中看到任何缺点和问题吗?

下面是我的插件:

然后MyPluginRequest::getPost( 'submit' );,我每次需要发布的未转义值时使用。

是否$wpdb->escape期望已经引用的值或未转义的值?

0 投票
1 回答
2764 浏览

php - Error with Wordpress on Appserver

Appserver vrs:2.60, and PHP 6, and now i installion Wordpress in my computer, but when i conccept address: localhost/wordpress/wp-admin/setup-config.php so it error:

Fatal error: Call to undefined function get_magic_quotes_gpc() in C:\AppServ\www\wordpress\wp-includes\load.php on line 585.

And In line 585:

And i use Appserver 2.6.0, PHP 6, Wordpress 4.0.1, Mysql 6.0.4

0 投票
1 回答
72 浏览

php - 我的 magic_quotes_gpc 已打开,但我的脚本不会继续告诉我它已关闭

我的 magic_quotes_gpc 已打开,但我的脚本不会继续告诉我它已关闭。我什至创建了一个 php.ini 文件并专门输入

magic_quotes_gpc = 开

我上传了一个 phpinfo.php 文件,我确实看不到“魔术引号”在哪里。

http://domainswebhostingecommerce.com/phpinfo.php

您可以转到此 url 的根域并查看我收到的错误。有谁知道解决方案?

感谢 William Cornett,MBA,PMP,FFL

0 投票
1 回答
132 浏览

javascript - 需要转义json

我有情况从帖子中获取这个数组

我需要转义字符串:

我已经尝试过addslash php方法它只是在任何地方添加斜杠我只需要在字符串“test \”jakce”中间添加斜杠,还需要转义任何字符串,例如包含单引号双引号等。

谢谢。

0 投票
2 回答
374 浏览

php - 注意:未定义变量:C:\wamp\www 中的 magic_quotes_active

我对 php 和第一个项目非常陌生,但我遇到了这种错误:

注意:未定义的变量:第 16 行 C:\wamp\www\mysite\includes\functions.php 中的 magic_quotes_active

这是我的代码;

0 投票
1 回答
96 浏览

php - Creating a real_escape_string() method for systems with magic quotes enabled

The book I'm learning PHP from says that in order to prevent people using things like quotes to alter the query, you should use the real_escape_string function. The author then goes on to say that on some older systems, where magic quotes is enabled, using real_escape_string could end up double escaping some characters, so he creates this function:

Would it be okay to turn this into a method in an extended class of the mysqli class? (There isn't any real reason why I wanted to, other than that I wanted to pass in as few arguments as possible.)

If so, is this the right way to do it?

And is this a situation where a static method makes more sense? If so, how could it be rewritten as a static method, and if not, then why?


Since I just asked like a million questions, I'll put a summary of them here:

  1. Is it okay to create a method for this purpose. (Are there any drawbacks to this?)
  2. Is the above code the correct way to do so?
  3. Should it be a static method?
  4. How would you make it a static method?
0 投票
1 回答
36 浏览

php - 魔术行情 GPC joomla

我无法安装 Joomla,因为我无法打开 Magic Quotes GPC On。我试图在 .htaccess Magic Quotes GPC On 中写入,但它不起作用。我能做什么我没有时间。谢谢! 图片

0 投票
0 回答
65 浏览

php - 为什么我的表单在引号前插入反斜杠?

我用于编辑文本文档的 php 代码在使用 ' 或 " 的任何地方添加反斜杠,我不知道为什么。以前有人遇到过这个问题吗?你是如何解决的?

所以当我输入例如

它保存看起来像这样

输出

保存后