Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
iwl-live
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Anthony.Suerte
iwl-live
Commits
8dbf2131
Commit
8dbf2131
authored
Sep 03, 2021
by
Antonio.Suerte
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remittance API Request Header Logger
parent
9c20d48b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
2 deletions
+39
-2
MoneyRequest.php
api/MoneyRequest.php
+39
-2
No files found.
api/MoneyRequest.php
View file @
8dbf2131
...
@@ -103,6 +103,12 @@ class MoneyRequest extends System {
...
@@ -103,6 +103,12 @@ class MoneyRequest extends System {
private
$toFee
=
NO_COUNT
;
private
$toFee
=
NO_COUNT
;
// end-of-case-to-case-basis-variables
// end-of-case-to-case-basis-variables
/**
*
* @var string
*/
private
$accessLogDir
=
NO_STRING
;
public
function
__construct
(){
public
function
__construct
(){
parent
::
__construct
();
parent
::
__construct
();
...
@@ -124,8 +130,39 @@ class MoneyRequest extends System {
...
@@ -124,8 +130,39 @@ class MoneyRequest extends System {
$this
->
referer
=
$this
->
getColumnData
(
$_SERVER
,
"HTTP_REFERER"
);
$this
->
referer
=
$this
->
getColumnData
(
$_SERVER
,
"HTTP_REFERER"
);
}
}
private
function
logDetails
(
$content
,
$logType
){
$logDate
=
date
(
"Y-m-d"
);
$logTimestamp
=
date
(
"[Y-m-d H:i:s]"
);
$logFile
=
NO_STRING
;
switch
(
$logType
){
case
VAL_INT_1
:
$logFile
=
$this
->
accessLogDir
;
break
;
}
error_log
(
"
{
$logTimestamp
}
\r\n
{
$content
}
\r\n
"
,
VAL_INT_3
,
"
{
$logFile
}
/Log_
{
$logDate
}
.log"
);
}
public
function
validate
(){
public
function
validate
(){
$this
->
accessLogDir
=
"Logs/remittance/access"
;
if
(
!@
file_exists
(
$this
->
accessLogDir
)){
mkdir
(
$this
->
accessLogDir
,
0777
,
true
);
}
$requestDetails
=
[
"IP_Address"
=>
$this
->
getColumnData
(
$_SERVER
,
"REMOTE_ADDR"
),
"Program_Code"
=>
$this
->
pnum
];
$requestDetails
=
print_r
(
array_merge
(
$requestDetails
,
apache_request_headers
()),
true
);
$this
->
logDetails
(
$requestDetails
,
VAL_INT_1
);
$userAgent
=
$this
->
getColumnData
(
$_SERVER
,
"HTTP_USER_AGENT"
);
$userAgent
=
$this
->
getColumnData
(
$_SERVER
,
"HTTP_USER_AGENT"
);
$referer
=
$this
->
getColumnData
(
$_SERVER
,
"HTTP_REFERER"
);
$whitelisitingValidationPassed
=
true
;
$whitelisitingValidationPassed
=
true
;
...
@@ -135,7 +172,7 @@ class MoneyRequest extends System {
...
@@ -135,7 +172,7 @@ class MoneyRequest extends System {
// second layer of validation (Whitelisted Domains)
// second layer of validation (Whitelisted Domains)
$isDomainInRemittanceDisabled
=
false
;
$isDomainInRemittanceDisabled
=
false
;
if
(
$userAgent
){
if
(
$userAgent
&&
$referer
){
// this condition will be considered if this was triggered in browser
// this condition will be considered if this was triggered in browser
if
(
!
$this
->
checkSettlementIpAddress
(
$this
->
pnum
,
"allow_ip_in_remittance"
,
$isIpInRemittanceDisabled
)){
if
(
!
$this
->
checkSettlementIpAddress
(
$this
->
pnum
,
"allow_ip_in_remittance"
,
$isIpInRemittanceDisabled
)){
if
(
!
$isIpInRemittanceDisabled
)
if
(
!
$isIpInRemittanceDisabled
)
...
...
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