这段代码是否真的可以防止SQL注入?(Will this code actually work against SQL-injection? [duplicate])
可能重复:
PHP:最终的清洁/安全功能我在这里找到了这段代码: http : //snipplr.com/view/12853/clean-variables-from-sql-injections/
作者声称:
这个小函数有助于解决SQL注入的常见安全问题,它可以清理任何全局变量,如$ POST,$ GET,$ _SERVER等,并转义不安全的字符。
这段代码安全吗?
function _clean($str){ return is_array($str) ? array_map('_clean', $str) : str_replace("\\", "\\\\" , htmlspecialchars((get_magic_quotes_gpc() ? stripslashes($str) : $str) , ENT_QUOTES)); } //usage call it somewhere in beginning of your script _clean($_POST); _clean($_GET); _clean($_REQUEST);// and so on..
请告诉我这是否安全,因为它看起来像陪审团操纵我。
Possible Duplicate:
PHP: the ultimate clean/secure functionI found this code snippet here: http://snipplr.com/view/12853/clean-variables-from-sql-injections/
The author claims:
This little function helps to fight common security issue with SQL injections, it can sanitize any global variable like $POST, $GET, $_SERVER etc and escape unsafe characters.
Is this code safe?
function _clean($str){ return is_array($str) ? array_map('_clean', $str) : str_replace("\\", "\\\\" , htmlspecialchars((get_magic_quotes_gpc() ? stripslashes($str) : $str) , ENT_QUOTES)); } //usage call it somewhere in beginning of your script _clean($_POST); _clean($_GET); _clean($_REQUEST);// and so on..
Please enlighten me whether this is safe, 'cause it looks jury-rigged to me.
原文:https://stackoverflow.com/questions/6164522
最满意答案
看起来您使用JRE而不是JDK运行Structr。 Structr需要JDK来动态编译类。
有关为Structr设置JDK的更多详细信息,请参阅文档 。
It looks like you are running Structr using JRE instead of JDK. Structr needs JDK to dynamically compile classes.
Please refer to the documentation for further details on setting up JDK for Structr.
相关问答
更多-
neo4j能达到最好的效果?[2022-06-03]
比如说社区网站,用户之间的关系有朋友关系,亲友关系,同事关系等,把每个人看作是一个结点,用户与用户之间的关系看作是一条边,这样整个社区就像一张大的图一样。 用图论的方法查找用户之间的关系网是很方便的,查询速度也极快,它可以查出通过朋友可能认识的人(二度人脉),甚至三度人脉及多度人脉,还可以查出两个用户间最短路径。 如果是这样的需求用neo4j作数据库效果非常好 -
是,对的。 Structr启动它自己的嵌入式Neo4j数据库,所以如果你先启动Neo4j,Structr会尝试绑定到Neo4j所做的相同端口,并因为端口已经在使用而失败。 Structr没有Cypher shell的连接器,因此您将无法连接到内部Neo4j实例。 使用最新的Structr Snapshot(2.1)来自https://structr.org/repositories/snapshots/org/structr/structr-ui/2.1.0-SNAPSHOT/structr-ui-2.1. ...
-
在哪里使用Neo4j(Where to use Neo4j)[2023-02-03]
Neo4j通常用作主数据库,有关node.js驱动程序,请参阅https://github.com/thingdom/node-neo4j 。 另外,根据您的使用情况,您可以在不同情况下将其与MySQL结合使用,以用于需要在MySQL中花费很长时间的复杂查询,如推荐和其他路径查询,请参阅http://docs.neo4j.org/chunked/snapshot/data -modeling-examples.html中的一些有趣的开始示例。 /彼得 Neo4j is often used as the p ... -
使用带红宝石的neo4j(Using neo4j with ruby)[2022-02-14]
您的应用程序需要一个数据库才能与之通信。 您需要为他们托管一个,或者他们需要在本地拥有一个。 Neo4j不支持多租户,因此除非您可以在应用程序级别强制分离客户端数据,否则每个客户端都需要一个单独的数据库实例,如果您选择为它们托管它们。 Your application will need a database to communicate with. You'll either need to host one for them or they will need to have one locally. ... -
与Neo4j的只读事务(Readonly transactions with Neo4j)[2022-06-18]
自SDN 4.2(编写本文时为4.2.RC1)以来,您可以使用只读事务。 从SDN 4.2开始,您还可以定义只读事务。 您可以通过使用@Transactional(readOnly = true)标记类或方法来启动只读事务。 http://docs.spring.io/spring-data/data-neo4j/docs/4.2.x/reference/html/#_read_only_transactions Since SDN 4.2 (4.2.RC1 at the time of writing) ... -
嗯,你是对的。 对于嵌入式Rails设置,这不是正确的地方。 如何为这种情况做亚马逊呢? 否则,请尝试https://github.com/maxdemarzi/neography ,它在Heroku上运行良好? Well, you are right. For embedded Rails setup, this is not the right place. How about doing Amazon instead for that scenario? Otherwise, try https:// ...
-
为什么Neo4j比SQL快(Why Neo4j is faster than SQL)[2023-01-05]
Neo4j通常不比SQL数据库快。 基于图的问题在很多情况下更快。 例如,如果你想找到两个实体之间的最短路径,Neo4j很可能会胜过MySQL等,因为数据的结构以及你可以使用的算法是因为这个结构。 Neo4j将其数据存储为这些节点之间的节点和关系。 它们直接相连。 简单的最短路径算法是宽度优先搜索。 你从一个节点开始,展开它的连接节点,然后为它的每个孩子做同样的事情,直到找到终端节点。 这样你只会触及少量的数据。 在SQL查询中,您无法轻松完成此操作,因此您必须在代码中构建某些内容,遍历结果集并为每个结果生 ... -
Structr - neo4j(Structr - neo4j)[2022-09-28]
看起来您使用JRE而不是JDK运行Structr。 Structr需要JDK来动态编译类。 有关为Structr设置JDK的更多详细信息,请参阅文档 。 It looks like you are running Structr using JRE instead of JDK. Structr needs JDK to dynamically compile classes. Please refer to the documentation for further details on setting ... -
Neo4j模糊搜索(Neo4j fuzzy search)[2023-10-31]
如果您有一个名为的存储库: public interface ProductRepository extends CrudRepository{ List findByNameLike(String name); List findByDescriptionLike(String description); } 然后你可以做这样的事情(从4.2.0开始): List products = produc ... -
Neo4j php addLabels(Neo4j php addLabels)[2022-10-22]
试试这个: $userLabel = $client->makeLabel('Users'); $user->save()->addLabels(array($userLabel)); User::addLabels需要一个Label对象数组。 https://github.com/jadell/neo4jphp/wiki/Labels#wiki-adding-labels-to-a-node 除此之外:如果添加一个裸字符串作为标签是您希望看到的功能,请提交功能请求: https : //github.c ...