如何解决使用.htaccess密码重定向到页面
| 是否可以将\'person \'重定向到受密码.htaccess保护的网站上的文件夹。 可能通过使用php或其他方式而不是使用“ http:// user:pwd@web.site \”方式? 还是最好只编写自己的这些保护区的文件夹/文件视图脚本。解决方法
大多数浏览器都会发出有关嵌入式用户名/密码的警告,因为这种链接在传统上一直被垃圾邮件发送者滥用,以将其阴茎药丸URL隐藏在“正常外观”链接之后。
如果要进行自动登录,请使用某种加密的令牌重定向,受保护的站点可以基于该令牌解密并授予/拒绝访问。
简而言之:
$raw_token = array(\'username\' => \'joe\',\'password\' => \'123\',\'coming_from\' => \'yoursite.com\');
$crypted_token = base64_encode(do_some_encryption(json_encode($raw_token),\'the passphrase\'));
header(\"Location: http://othersite.com?token=$crypted_token\")
然后在接收端:
$crypted_token = $_GET[\'token\'];
$raw_token = json_decode(do_some_decryption(base64_decode($crypted_token),\'the passphrase\'));
$username = $raw_token[\'username\'];
$password = $raw_token[\'password\'];
do_login($username,$password);
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。