最初的帖子得到了很多人的兴奋,但根本没有建设性的评论。第二次尝试。
我确实意识到它是javascript,很容易被黑客入侵
整个想法是在页面加载时更改url,并在表单输入正确的情况下恢复原始url。遇到了问题,脚本的一部分本应返回原始href值,但在一开始就不允许更改它。
这是脚本
$(document).ready(function(){
$(".link_imagelibrary").each(function(){
this.href = this.href.replace('http://whatevs.com/files/pass', '#');
});
$(".imglogin").click(function () {
console.log('working')
var password = "111";
if ($("#imgpass").val() != password) {
alert("Wrong Password!");
$('#imgpass').val('');
} else {
$(".link_imagelibrary").addClass(".imgdownload");
$("div.center a").removeClass("link_imagelibrary");
$(".imgdownload").each(function(){
this.href = this.href.replace('#', 'http://whatevs.com/files/pass');
}
});
}); 我的错误在哪里?谢谢!
发布于 2014-04-10 03:54:37
尝试替换id elemment的".link_imagelibrary“和".imgdownload”类
发布于 2014-04-10 04:17:08
我想你可能想试试这个js lib:https://github.com/mshang/base64-js (或者你可以在web上找到类似的)替换或添加编码的链接,当用户点击验证登录,如果用户登录,解码链接并重定向到该链接或做你想做的事情。
例如:
var xyz = base64;
xyz.encode("http://whatevs.com/files/pass");然后在用户登录后:
xyz,decode("aHR0cDovL3doYXRldnMuY29tL2ZpbGVzL3Bhc3M=");
//returns http://whatevs.com/files/passhttps://stackoverflow.com/questions/22972553
复制相似问题