Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
open-source
MetaGer
Commits
11a4c4cf
Commit
11a4c4cf
authored
Jun 22, 2020
by
Dominik Hebeler
Browse files
added debuggin functionality to humanverification
parent
58f94118
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
app/Http/Controllers/HumanVerification.php
View file @
11a4c4cf
...
...
@@ -208,4 +208,52 @@ class HumanVerification extends Controller
return
$possibleSpammer
;
}
public
function
botOverview
(
Request
$request
){
$id
=
""
;
$uid
=
""
;
$ip
=
$request
->
ip
();
if
(
\
App\Http\Controllers\HumanVerification
::
couldBeSpammer
(
$ip
))
{
$id
=
hash
(
"sha512"
,
"999.999.999.999"
);
$uid
=
hash
(
"sha512"
,
"999.999.999.999"
.
$ip
.
$_SERVER
[
"AGENT"
]
.
"uid"
);
}
else
{
$id
=
hash
(
"sha512"
,
$ip
);
$uid
=
hash
(
"sha512"
,
$ip
.
$_SERVER
[
"AGENT"
]
.
"uid"
);
}
$userList
=
Cache
::
get
(
HumanVerification
::
PREFIX
.
"."
.
$id
);
$user
=
$userList
[
$uid
];
return
view
(
'humanverification.botOverview'
)
->
with
(
'title'
,
"Bot Overview"
)
->
with
(
'ip'
,
$ip
)
->
with
(
'user'
,
$user
);
}
public
function
botOverviewChange
(
Request
$request
)
{
$id
=
""
;
$uid
=
""
;
$ip
=
$request
->
ip
();
if
(
\
App\Http\Controllers\HumanVerification
::
couldBeSpammer
(
$ip
))
{
$id
=
hash
(
"sha512"
,
"999.999.999.999"
);
$uid
=
hash
(
"sha512"
,
"999.999.999.999"
.
$ip
.
$_SERVER
[
"AGENT"
]
.
"uid"
);
}
else
{
$id
=
hash
(
"sha512"
,
$ip
);
$uid
=
hash
(
"sha512"
,
$ip
.
$_SERVER
[
"AGENT"
]
.
"uid"
);
}
$userList
=
Cache
::
get
(
HumanVerification
::
PREFIX
.
"."
.
$id
);
$user
=
$userList
[
$uid
];
if
(
$request
->
filled
(
"locked"
)){
$user
[
"locked"
]
=
boolval
(
$request
->
input
(
'locked'
));
}
elseif
(
$request
->
filled
(
"whitelist"
))
{
$user
[
"whitelist"
]
=
boolval
(
$request
->
input
(
'whitelist'
));
}
elseif
(
$request
->
filled
(
"unusedResultPages"
))
{
$user
[
"unusedResultPages"
]
=
intval
(
$request
->
input
(
'unusedResultPages'
));
}
HumanVerification
::
saveUser
(
$user
);
return
redirect
(
'admin/bot'
);
}
}
resources/views/humanverification/botOverview.blade.php
0 → 100644
View file @
11a4c4cf
@
extends
(
'layouts.subPages'
)
@
section
(
'title'
,
$title
)
@
section
(
'content'
)
<
style
>
table
form
{
padding
-
top
:
8
px
;
padding
-
bottom
:
8
px
;
}
td
:
nth
-
child
(
1
)
{
padding
-
right
:
8
px
;
}
</
style
>
<
table
>
<
tbody
>
<
tr
>
<
td
>
IP
-
Adresse
</
td
>
<
td
><
pre
>
{{
$ip
}}
</
pre
></
td
>
</
tr
>
<
tr
>
<
td
>
ID
</
td
>
<
td
><
pre
>
{{
$user
[
"id"
]}}
</
pre
></
td
>
</
tr
>
<
tr
>
<
td
>
User
-
ID
</
td
>
<
td
><
pre
>
{{
$user
[
"uid"
]}}
</
pre
></
td
>
</
tr
>
<
tr
>
<
td
>
Unused
Resultpages
</
td
>
<
td
>
<
form
action
=
""
method
=
"post"
>
<
input
onchange
=
"this.form.submit()"
type
=
"number"
name
=
"unusedResultPages"
id
=
"unusedResultPages"
value
=
"
{
{$user["unusedResultPages"]}
}
"
>
</
form
>
</
td
>
</
tr
>
<
tr
>
<
td
>
Whitelist
</
td
>
<
td
>
<
form
action
=
""
method
=
"post"
>
<
select
name
=
"whitelist"
id
=
"locked"
onchange
=
"this.form.submit()"
>
<
option
value
=
"1"
@
if
(
$user
[
"whitelist"
])
selected
@
endif
>
True
</
option
>
<
option
value
=
"0"
@
if
(
!
$user
[
"whitelist"
])
selected
@
endif
>
False
</
option
>
</
select
>
</
form
>
</
td
>
</
tr
>
<
tr
>
<
td
>
Locked
</
td
>
<
td
>
<
form
action
=
""
method
=
"post"
>
<
select
name
=
"locked"
id
=
"locked"
onchange
=
"this.form.submit()"
>
<
option
value
=
"1"
@
if
(
$user
[
"locked"
])
selected
@
endif
>
True
</
option
>
<
option
value
=
"0"
@
if
(
!
$user
[
"locked"
])
selected
@
endif
>
False
</
option
>
</
select
>
</
form
>
</
td
>
</
tr
>
<
tr
>
<
td
>
Locked
Key
</
td
>
<
td
><
pre
>
{{
$user
[
"lockedKey"
]}}
</
pre
></
td
>
</
tr
>
<
tr
>
<
td
>
Expiration
</
td
>
<
td
><
pre
>
{{
$user
[
"expiration"
]}}
</
pre
></
td
>
</
tr
>
</
tbody
>
</
table
>
@
endsection
routes/web.php
View file @
11a4c4cf
...
...
@@ -179,6 +179,8 @@ Route::group(
Route
::
get
(
'ip'
,
function
()
{
dd
(
Request
::
ip
(),
$_SERVER
[
"AGENT"
]);
});
Route
::
get
(
'bot'
,
'HumanVerification@botOverview'
);
Route
::
post
(
'bot'
,
'HumanVerification@botOverviewChange'
);
});
Route
::
get
(
'settings'
,
function
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment