Skip to content

Commit

Permalink
Version 3.2.0
Browse files Browse the repository at this point in the history
添加登录密码错误提示
  • Loading branch information
firesunCN committed Jan 26, 2016
1 parent e44e343 commit ba12756
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
14 changes: 9 additions & 5 deletions login.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
//判断ip是否在封禁列表中
$forbiddenIPList=loadForbiddenIPList();
$ip=$_SERVER['REMOTE_ADDR'];
$is_pass_wrong=false;
if(!isset($forbiddenIPList[$ip]) || $forbiddenIPList[$ip]<=5)
{
if(isset($_POST['password']) && $_POST['password']!="")
Expand All @@ -45,10 +46,12 @@
else
$forbiddenIPList[$ip]=1;
saveForbiddenIPList($forbiddenIPList);
$is_pass_wrong=true;
}
}

}
}
else
$is_pass_wrong=true;

function loadForbiddenIPList()
{
Expand Down Expand Up @@ -97,7 +100,6 @@ function checkPassword($p)
$key=md5($salt.$key.$_SESSION['firesunCheck'].$salt);
$key=md5($salt.$key.$_SESSION['firesunCheck'].$salt);
return $key===$p;

}
return false;
}
Expand All @@ -110,8 +112,6 @@ function generate_password( $length = 32 ) {
$password .= $chars[ mt_rand(0, strlen($chars) - 1) ];
return $password;
}


?>

<html>
Expand All @@ -123,6 +123,10 @@ function generate_password( $length = 32 ) {

<script type="text/javascript" src="static/js/jquery.min.js" ></script>
<script type="text/javascript" src="static/js/login.js" ></script>
<?php
if($is_pass_wrong)
echo '<script type="text/javascript" src="static/js/pass_is_wrong.js" ></script>';
?>
</head>

<body>
Expand Down
1 change: 1 addition & 0 deletions static/js/pass_is_wrong.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alert("密码错误!");

0 comments on commit ba12756

Please sign in to comment.