// 文章密码
var mima = <?php echo ARTICLE_KEY; ?>;
$('.word').click(function(){
var passwd = prompt('请输入密码','');
if(passwd != mima){
$(this).attr('href','').attr('target','_self');
alert('密码输入错误!');
}else{
// 保存cookie
setCookie('password',mima);
}
});
function setCookie(name,value)
{
var Days = 30;
var exp = new Date();
exp.setTime(exp.getTime() + Days*24*60*60*1000);
document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
document.cookie = name + "="+ escape (value) + ";";
}
function getCookie(name)
{
var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
if(arr=document.cookie.match(reg))
return unescape(arr[2]);
else
return null;
}
var check = <?php echo $_GET['check']; ?>;
if(check){
var mima = getCookie('password');
if(!mima){
alert('非法进入!');
location.href="__ROOT__";
}
}