我通过以下方式使用“file_get_contents”:
(下面的脚本发布在,例如https://siteA.com/checkifvalid.php ...注意 URL 是 httpS)
<?php
//there is a login form on this URL and the entries put in the form are used to set the username & password variables below.
$username = "someusername";
$password = "somepassword";
$secretkey = "slkd89087235";
$yesorno = file_get_contents("httpS://siteB.com/checkdatabase.php?username=$username&password=$password&secretkey=$secretkey");
if ($yesorno == 'yes') {
//details are valid, so something
} else {
//details aren't valid, display they aren't valid
}
?>
“checkdatabase.php”脚本使用 _GET 获取用户名和密码,并从 URL 中获取变量,然后交叉引用这些登录详细信息以查看它们是否有效。如果是,则回显“是”,如果不是,则回显“否”。
checkdatabase.php 脚本设置为仅在用户名、密码和密钥参数都已传递的情况下运行,并且仅当已传递的密钥值与存储在该 php 脚本中的密钥匹配时才运行。
在给定的时间范围内,“ http://siteA.com/checkifvalid.php ”的输入次数也将受到限制,以防止一种“暴力”攻击猜测用户/密码组合。
我的问题是,当两个 URL 都使用 httpS 时,上述方法的安全性如何?
我应该加密发送的值吗?或者上面的东西已经安全了吗?