Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
YOHOBUYPC
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
2
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
xiaowei
9 years ago
Commit
9a520ffaa54b51b9b3dcfdd60ab8d2acf7f293e2
1 parent
6412ed31
限制恶意登录注册
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
5 deletions
yohobuy/www.yohobuy.com/application/modules/Passport/controllers/Login.php
yohobuy/www.yohobuy.com/application/modules/Passport/controllers/Register.php
yohobuy/www.yohobuy.com/application/modules/Passport/controllers/Login.php
View file @
9a520ff
...
...
@@ -101,8 +101,16 @@ class LoginController extends WebAction
$ip
=
Helpers
::
getClientIp
();
$ipKey
=
md5
(
'ip_signin_'
.
$ip
);
$accountKey
=
md5
(
'account_signin_'
.
$account
);
$accountTimes
=
Cache
::
increment
(
$accountKey
,
1
,
0
,
1800
);
$ipTimes
=
Cache
::
increment
(
$ipKey
,
1
,
0
,
3600
);
if
(
!
Cache
::
get
(
$ipKey
)){
Cache
::
set
(
$ipKey
,
0
);
}
if
(
!
Cache
::
get
(
$accountKey
)){
Cache
::
set
(
$accountKey
,
0
);
}
Cache
::
increment
(
$accountKey
,
1
,
0
,
1800
);
Cache
::
increment
(
$ipKey
,
1
,
0
,
3600
);
$accountTimes
=
Cache
::
get
(
$accountKey
);
$ipTimes
=
Cache
::
get
(
$ipKey
);
if
(
$accountTimes
>
10
)
{
$data
=
array
(
'code'
=>
400
,
'message'
=>
'您输入的密码及账户名不匹配,是否忘记密码?'
,
'data'
=>
''
);
break
;
...
...
yohobuy/www.yohobuy.com/application/modules/Passport/controllers/Register.php
View file @
9a520ff
...
...
@@ -47,8 +47,11 @@ class RegisterController extends WebAction
$area
=
intval
(
trim
(
$this
->
post
(
'area'
),
' '
));
$ip
=
Helpers
::
getClientIp
();
$data
=
array
(
'code'
=>
400
,
'message'
=>
''
,
'data'
=>
''
);
$ip_key
=
md5
(
'ip_checkmobile_'
.
$ip
);
$ip_times
=
Cache
::
increment
(
$ip_key
,
1
,
0
,
3600
);
$ipKey
=
md5
(
'ip_checkmobile_'
.
$ip
);
if
(
!
Cache
::
get
(
$ipKey
))
{
Cache
::
set
(
$ipKey
,
0
);
}
$ipTimes
=
Cache
::
increment
(
$ipKey
,
1
,
0
,
3600
);
do
{
/* 判断是不是AJAX请求 */
if
(
!
$this
->
isAjax
())
{
...
...
@@ -59,7 +62,7 @@ class RegisterController extends WebAction
$data
[
'message'
]
=
'手机号码格式不正确'
;
break
;
}
if
(
$ip
_t
imes
>=
500
)
{
if
(
$ip
T
imes
>=
500
)
{
$data
[
'message'
]
=
'由于你IP受限无法注册'
;
break
;
}
...
...
Please
register
or
login
to post a comment