我找到了三种方法来填充我的JFrame框架= new JFrame("...")createContentPanel返回一个JPanel,createToolBar返回一个ToolBar.
frame.add(this.createToolBar(), BorderLayout.PAGE_START); //this works and puts the ToolBar above and the ContentPanel under it<br>
frame.add(this.createContentPanel(), BorderLayout.CENTER);
frame.setContentPane(this.createContentPanel()); //this lets the JToolBar hover over the ContentPanel
frame.getContentPane().add(this.createToolBar());
frame.getContentPane().add(this.createContentPanel()); //this only puts the last one into the JFrame
frame.getContentPane().add(this.createToolBar());
Run Code Online (Sandbox Code Playgroud)
现在我想知道为什么我应该使用getContentPane()/ setContentPane()方法,如果我可以使用一个简单的frame.add(...)来填充我的框架.
最近有一名黑客试图使用睡眠注射减慢我的网站速度.虽然我们正在采取预防措施,mysql_real_escape_string()以涵盖大多数易受攻击的投入.我们通过查询字符串传递产品的id,它将命令作为:
$id = mysql_real_escape_string($_REQUEST['id']);
$qry = "Select * from products where id = ".$id;
Run Code Online (Sandbox Code Playgroud)
但是黑客试图提供输入
?id=3 and sleep(4)
Run Code Online (Sandbox Code Playgroud)
和查询成为
Select * from products where id = 3 and sleep(4);
Run Code Online (Sandbox Code Playgroud)
虽然有一些可能的解决方案,如
还有其他方法可以阻止这种情况吗?什么是预防睡眠注射的最佳方法?
1)我是laravel的新手,想要整合验证规则.我的要求是根据另外两个字段强制要求第三个字段.如果a和b都为真,则需要字段C. 我已经使用required_if来基于其他单个字段进行验证,但是如何使用required_if来检查两个字段?
2)为了实现上述功能,我也尝试了自定义验证规则.但它只有在我同时拉动所需规则的情况下才有效.
例如:
'number_users' => 'required|custom_rule' //working
'number_users' => 'custom_rule' //Not working
Run Code Online (Sandbox Code Playgroud)