Skip to content

Commit

Permalink
Added security code
Browse files Browse the repository at this point in the history
  • Loading branch information
geeeeeeeek committed Mar 26, 2017
1 parent dd6dcde commit e117aeb
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 12 deletions.
11 changes: 11 additions & 0 deletions ajax/getCode.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
<?php
require_once '../taobao-sdk-PHP/sendCode.php';

// 安全验证 (防止恶意调用)
if(isset($_SESSION['send_count'])){
$_SESSION['send_count']+=1;
}else{
$_SESSION['send_count']=1;
}
if($_SESSION['send_count']>4){
exit("超过发送次数");
}

$arr=$_POST;
$phone=$_POST['phone'];

Expand Down
Binary file modified images/logo-50-50.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion place.html
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ <h2>修改密码</h2>
<script src="scripts/login.js"></script>
<script src="scripts/cart.lib.js"></script>
<script src="scripts/cart.js"></script>
<script src="scripts/header.js"></script>
<script src="scripts/header.js?v=1"></script>
<script src="scripts/footer.js"></script>
<script type="text/javascript">
$(function(){
Expand Down
2 changes: 1 addition & 1 deletion scripts/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function searchPlace(){
var shopName=arrObj[i].shopName;
var shopId=arrObj[i].shopId;
if(shopName.indexOf(keyword)>=0){
$(".search-result").append("<a href='/shop/"+shopId+".html'>"+shopName+"</a>");
$(".search-result").append("<a href='/shop.html'>"+shopName+"</a>");
$(".search-result").show();
}
}
Expand Down
15 changes: 7 additions & 8 deletions scripts/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@
$('#register-pwd-error').text('密码不能为空');
return;
}
// var md5Code=$.md5(code);
// if(md5Code!=code2){
// $('#register-code-error').text('验证码不正确');
// return;
// }
var md5Code=$.md5(code);
if(md5Code!=code2){
$('#register-code-error').text('验证码不正确');
return;
}
create(phone,pwd,code);
});

Expand Down Expand Up @@ -158,13 +158,13 @@
})(jQuery);


var leftSeconds=15;
var leftSeconds=60;
function setCodeTime(){
$('.phone-code-btn').attr('disabled',"true");
$('.phone-code-btn').text(leftSeconds+"s");
leftSeconds--;
if(leftSeconds<0){
leftSeconds=15;
leftSeconds=60;
$('.phone-code-btn').text("重新获取");
$('.phone-code-btn').removeAttr("disabled");
}else{
Expand Down Expand Up @@ -260,7 +260,6 @@ function getCode(pn){
$.post(postUrl,
{phone:pn},
function(data, status, xhr) {
alert(data);
if(status=="success"){
$res= $.parseJSON(data);
if($res.code=="0"){
Expand Down
5 changes: 3 additions & 2 deletions shop.html
Original file line number Diff line number Diff line change
Expand Up @@ -914,8 +914,9 @@
<a class="weixin-dingfan fw" href="#">微信订饭</a>
<a class="logo" href="/"></a>
<div class="search">
<img class="search-icon" src="/images/icon_search.png" width="22" height="22">
<input class="search-input" type="text" placeholder="请输入楼名">
<img class="search-icon" src="/images/icon_search.png" width="20" height="20">
<input id="search-input" class="search-input" type="text" placeholder="请输入楼名" onkeypress="onKeySearch()">
<span id="search-del" class="search-del">&times;</span>
</div>
<div class="clear"></div>
</div>
Expand Down

0 comments on commit e117aeb

Please sign in to comment.