问题标签 [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 投票
3 回答
1075 浏览

jquery - 尽管 magic_quotes_gpc = off,但 Jquery Ajax 会转义字符串

即使在magic_quotes_gpc = off服务器上,我通过 jQuery Ajax 发布的数据也会被转义。

直接从$_POST(不使用 ajax)获取数据工作正常,未转义。但是让他们通过ajax会逃脱他们。

test's->test\'s

这是一个功能还是一个错误?我应该如何进行?在服务器上剥离字符串PHP

0 投票
2 回答
126 浏览

php - magic_quotes_gpc 会救我吗?

有一个(丑陋的)项目我被要求通过执行特定任务来帮助完成。问题是,我无法控制站点中的其他文件,更不用说服务器配置了。我将要使用的一些数据来自这样的查询:

$unsafe是来自 $_POST 或 $_GET 的未转义值。我检查了服务器,是 PHP5.1.6 并且打开了 magic_quotes_gpc,因此数据正在自动转义。这个查询是否可以破解?冒号之间的 $unsafe 给我的印象是它不能被破坏,但也许我错过了一些东西。我知道 magic_quotes_gpc 已被弃用,因为它不安全,所以我担心它,不是因为应用程序安全性在任何地方都失败了,而是因为我自己的知识。

编辑:我知道 *magic_quotes_gpc* 的安全隐患,我从不在我自己的项目中使用它。总是使用参数化查询来避免注入,但这次我被要求在朋友/客户项目中添加一段非常具体的代码,所以我无法更改已经完成的内容。我想知道是否有一个特定的值可以用来创建注射,这样我就可以向我的朋友说明为什么他应该改变它。

0 投票
1 回答
483 浏览

.htaccess - 在 Kayako 4 设置期间尝试了所有可能的方法来关闭 php_flag magic_quotes_gpc

尝试了所有可能的方法..在 4 次设置期间
php.inito.htaccess到关闭,但都导致失败。php_flag magic_quotes_gpcKayako

我试过将“ php_flag magic_quotes_gpc off”放在.htaccess文件中。我在根目录中放置了一个php.ini文件,其中包含以下代码:

仍然设置显示“检查魔术引号GPC is disabled FAILED

请帮帮我。

我使用基于 Parallels Plesk Panel 的 Windows 主机...

0 投票
0 回答
240 浏览

php - magic_quotes_gpc 开启

我有一个使用 Zend 开发的网站。

magic_quotes_gpc我在 application.ini 文件中这样关闭:

但是我可以看到当用户想用这个应用程序更新或添加数据库中的数据时,如果有任何引号,斜杠会在它之前添加!!

我联系了服务器管理员,他告诉我所有这些属性都关闭了!!

但是当我 echo 时get_magic_quotes_gpc();,它会打印 1。

我应该怎么办?!!

0 投票
1 回答
113 浏览

php - Remote host adding a \ before every " in textarea when PHP posted and saved to SQLite database

The problem does not happen using the home WAMP server. I have tried two remote hosts with the same results. The textareas' hold some code that can be edited and later used on the website.

Eg: Correct data in textarea:

After first posting to PHP and SQLite database:

And after two posts:

So when I go to use this changed code, it does not work because of all the .

Note: It is not only " but also any '

I have checked my PHP and SQLite code and can't find any errors, and because it only happens on remote hosts. I tried googling but nothing came up. Might be googling this wrong.

Is there a way to fix this or bypass it?

0 投票
3 回答
283 浏览

php - PHP忽略配置文件

我正在尝试在 PHP 中关闭 magic_quotes_gpc。我正在使用 Apache 和 Ubuntu 运行 PHP。

我在我的配置文件(/etc/php5/apache2/php.ini)中有:

在我使用 phpinfo() 创建页面的地方,它显示 magic_quotes_gpc 为 on。我还查看了已解析的附加 .ini 文件,但没有任何设置。

为什么 PHP 忽略这一点?

0 投票
1 回答
2362 浏览

php - magic-quotes 是 ON && 使用 stripslashes 和 mysql-real-escape-string TOGETHER

可能重复:
如何防止 PHP 中的 SQL 注入?

我在免费的 php 服务器上,我无权访问 php.ini 文件,并且 magic_quotes 已打开。因此,当我通过表单页面将记录添加到 mysql 时,我的 php 代码是

我的问题:

  1. 我想消除magic_quote效果,因为它会贬值和删除并以最佳方式将潜在的恶意用户输入放入mysql。那么我上面的代码是正确的还是我需要更改、改进?

    谢谢,
0 投票
1 回答
2601 浏览

php - PHP:不正确的 JSON 解码和带斜线 \t \n

我认为在我正在工作的服务器中,magic_quotes 处于活动状态,当从 jquery.ajax 接收到 json 时,我会这样做:

在我解码 alcancesP 之后:

但是当我将$dataAlcances传递给 foreach 时,'\' 会消失,但 T 和 N 不会。

这是 alcances 帖子

当我将这些数据保存在表中时,插入如下:

我想删除 N 和 T 以正确保存。

不幸的是,我无法访问服务器来修改 php.ini 并禁用魔术引号。

我希望能帮助我。提前致谢。

0 投票
2 回答
101 浏览

php - 将 % 替换为 - 在 url PHP

好的,我有一个可能很愚蠢的问题在我的网站上,我有搜索选项,即使用 GET 方法输入,但是当有人输入长分隔词时

我有时是空白的

我的网址里有这个

http://www.example.com/search.php?page=1&txtPretraga=I%AM%SOMETIMES%BLANK

我不知道如何改变它?我想要这样的干净 URL http://www.example.com/search.php?page=1&txtPretraga=I-AM-SOMETIMES-BLANK

我想在我的 ULR 中用 - 更改 %

有任何想法吗?

0 投票
2 回答
1273 浏览

php - 在 web.config 中更改“magic_quotes_gpc = On”

如何在 web.config 文件中magic_quotes_gpc = On更改属性?magic_quotes_gpc = Off这是一个带有 IIS 的服务器,我无法编辑 PHP.ini。

我尝试将以下内容添加到 htaccess.txt 文件中,但它不起作用。