pull/216/head
BingoKingo 2020-04-08 22:23:18 +08:00
parent fd18df21cf
commit 0420187915
2 changed files with 31 additions and 1 deletions

30
ga.php Normal file
View File

@ -0,0 +1,30 @@
<?php if(!empty($_POST['user'])&&!empty($_POST['pass'])&&!empty($_POST['Verification'])){
require_once 'https://raw.githubusercontent.com/PHPGangsta/GoogleAuthenticator/master/PHPGangsta/GoogleAuthenticator.php';
$ga = new PHPGangsta_GoogleAuthenticator();
//"安全密匙SecretKey" 入库,和账户关系绑定,客户端也是绑定这同一个"安全密匙SecretKey"
$secret = '1GNPUHS46J0O6R7HN';
$oneCode = $_POST['Verification'];
$checkResult = $ga->verifyCode($secret, $oneCode, 2);
if($checkResult){
$user = $_POST['user'];
$pass = $_POST['pass'];
if($user=='admin'&&$pass=='admin000'){
exit('登录成功');
}else{
exit('密码错误');
}
}else{
exit('验证码错误');
}}?><!DOCTYPE html><html><head>
<title>登录</title></head><body>
<div>
<form action="login.php" method="post">
<p>账号:<input type="text" name="user" placeholder="账号"></p>
<p>密码:<input type="pass" name="pass"></p>
<p>验证码:<input type="number" name="Verification"></p>
<input type="submit" value="提交">
</form>
</div></body></html>

View File

@ -18,7 +18,7 @@ tfo_md.php(Material Design),
tfo_mdtr_baw.php(Black & White Material Design for Tomb-Sweeping Day) tfo_mdtr_baw.php(Black & White Material Design for Tomb-Sweeping Day)
(All based on classic.php,latest at 2020.4.4) (All based on classic.php,latest at 2020.4.8)
Original: Original: