gpt4 book ai didi

php - 将代码插入MySQL数据库

转载 作者:行者123 更新时间:2023-11-29 21:39:53 25 4
gpt4 key购买 nike

所以我有一个输入,用户可以在其中输入他们的代码,更具体地说是 PayPal 代码。而且我在向数据库提交代码时总是遇到这个错误。

"Not Acceptable!
An appropriate representation of the requested resource could not be found on this server. This error was generated by Mod_Security."

所以我尝试通过 PHPmyAdmin 更新代码,如下所示:

UPDATE store
SET paypal = "codehere"

这不起作用,但是当我输入“”而不是“”时,它就起作用了。

所以我的问题是,如何调整插入代码才能正常工作。下面是当前代码:

// Here I store the input value
$paypal = $_GET['paypal'];

if (!empty($paypal)) {
$sql2 = "UPDATE store
SET paypal = :paypal";
$stmt1 = $connection->prepare($sql2);
$stmt1->bindParam(':paypal', $paypal, PDO::PARAM_STR);
$stmt1->execute();
}

提前致谢!如果我没有提供足够的信息,请告诉我。

最佳答案

您可以尝试在.htaccess文件中禁用mod_security

<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>

关于php - 将代码插入MySQL数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34623826/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com