Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
smradius
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
shail
smradius
Commits
55b5367d
Commit
55b5367d
authored
16 years ago
by
Robert Anderson
Browse files
Options
Downloads
Patches
Plain Diff
added search for logs using timestamp
parent
6b215513
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
webui/user-logs.php
+177
-63
177 additions, 63 deletions
webui/user-logs.php
with
177 additions
and
63 deletions
webui/user-logs.php
+
177
−
63
View file @
55b5367d
...
@@ -32,62 +32,179 @@ printHeader(array(
...
@@ -32,62 +32,179 @@ printHeader(array(
),
),
));
));
?>
?>
<p
class=
"pageheader"
>
User Log
</p>
<p
class=
"pageheader"
>
User Log
</p>
<form
id=
"main_form"
action=
"user-attributes.php"
method=
"post"
>
<p
/>
<table
class=
"results"
style=
"width: 75%;"
>
<tr
class=
"resultstitle"
>
<td
class=
"textcenter"
>
ServiceType
</td>
<td
class=
"textcenter"
>
FramedProtocol
</td>
<td
class=
"textcenter"
>
NASPort
</td>
<td
class=
"textcenter"
>
NASPortType
</td>
<td
class=
"textcenter"
>
CallingSationID
</td>
<td
class=
"textcenter"
>
CalledStationID
</td>
<td
class=
"textcenter"
>
NASPortID
</td>
<td
class=
"textcenter"
>
AcctSessionID
</td>
<td
class=
"textcenter"
>
FramedIPAddress
</td>
<td
class=
"textcenter"
>
ActAuthentic
</td>
<td
class=
"textcenter"
>
EventTimestamp
</td>
<td
class=
"textcenter"
>
NASIdentifier
</td>
<td
class=
"textcenter"
>
NASIPAddress
</td>
<td
class=
"textcenter"
>
AcctDelayTime
</td>
<td
class=
"textcenter"
>
AcctSessionTime
</td>
<td
class=
"textcenter"
>
AcctInputOctets
</td>
<td
class=
"textcenter"
>
AcctInputGigawords
</td>
<td
class=
"textcenter"
>
AcctInputPackets
</td>
<td
class=
"textcenter"
>
AcctOutputOctets
</td>
<td
class=
"textcenter"
>
AcctOutputGigawords
</td>
<td
class=
"textcenter"
>
AcctOutputPackets
</td>
<td
class=
"textcenter"
>
AcctStatusType
</td>
<td
class=
"textcenter"
>
AcctTerminateCause
</td>
</tr>
<?php
<?php
if
(
isset
(
$_POST
[
'user_id'
]))
{
if
(
isset
(
$_POST
[
'user_id'
]))
{
#
Fet
ch user
name from id supplied
#
Whi
ch user
in the accounting table should we look for?
$stmt
=
$db
->
prepare
(
"SELECT Username FROM ${DB_TABLE_PREFIX}users WHERE ID = ?"
);
$stmt
=
$db
->
prepare
(
"SELECT Username FROM ${DB_TABLE_PREFIX}users WHERE ID = ?"
);
$stmt
->
execute
(
array
(
$_POST
[
'user_id'
]));
$stmt
->
execute
(
array
(
$_POST
[
'user_id'
]));
$row
=
$stmt
->
fetchObject
();
$row
=
$stmt
->
fetchObject
();
$stmt
->
closeCursor
();
$stmt
->
closeCursor
();
$getuser
=
$row
->
username
;
$getuser
=
$row
->
username
;
$sql
=
"SELECT ServiceType, FramedProtocol, NASPort, NASPortType, CallingStationID, CalledStationID, NASPortID, AcctSessionID, FramedIPAddress, AcctAuthentic, EventTimestamp, NASIdentifier, NASIPAddress, AcctDelayTime, AcctSessionTime, AcctInputOctets, AcctInputGigawords, AcctInputPackets, AcctOutputOctets, AcctOutputGigawords, AcctOutputPackets, AcctStatusType, AcctTerminateCause FROM ${DB_TABLE_PREFIX}accounting WHERE Username = '
$getuser
'"
;
$res
=
$db
->
query
(
$sql
);
?>
<form
id=
"main_form"
action=
"user-logs.php"
method=
"post"
>
<!-- Search things -->
<div>
<table>
<tr>
<td>
From (yyyy-mm-dd)
</td>
</tr>
<tr>
<td><input
type=
"text"
name=
"date_from"
/></td>
</tr>
<tr>
<td>
To (yyyy-mm-dd)
</td>
</tr>
<tr>
<td><input
type=
"text"
name=
"date_to"
/></td>
</tr>
<tr>
<input
type=
"hidden"
name=
"user_id"
value=
<?php
echo
$_POST
[
'user_id'
];
?>
/
>
<td><input
type=
"submit"
value=
"Get results"
/></td>
</tr>
</table>
</div>
</form>
<p
/>
<!-- Tables headings -->
<table
class=
"results"
style=
"width: 75%;"
>
<tr
class=
"resultstitle"
>
<td
class=
"textcenter"
>
EventTimestamp
</td>
<td
class=
"textcenter"
>
ServiceType
</td>
<td
class=
"textcenter"
>
FramedProtocol
</td>
<td
class=
"textcenter"
>
NASPort
</td>
<td
class=
"textcenter"
>
NASPortType
</td>
<td
class=
"textcenter"
>
CallingSationID
</td>
<td
class=
"textcenter"
>
CalledStationID
</td>
<td
class=
"textcenter"
>
NASPortID
</td>
<td
class=
"textcenter"
>
AcctSessionID
</td>
<td
class=
"textcenter"
>
FramedIPAddress
</td>
<td
class=
"textcenter"
>
AcctAuthentic
</td>
<td
class=
"textcenter"
>
NASIdentifier
</td>
<td
class=
"textcenter"
>
NASIPAddress
</td>
<td
class=
"textcenter"
>
AcctDelayTime
</td>
<td
class=
"textcenter"
>
AcctSessionTime
</td>
<td
class=
"textcenter"
>
Data-Input
</td>
<td
class=
"textcenter"
>
Data-Output
</td>
<td
class=
"textcenter"
>
AcctStatusType
</td>
<td
class=
"textcenter"
>
AcctTerminateCause
</td>
</tr>
<?php
# Extra SQL
$extraSQL
=
""
;
$extraSQLVals
=
array
();
$limitSQL
=
""
;
# Do we have a from date?, if so add it to our query
if
(
isset
(
$_POST
[
'date_from'
]))
{
$extraSQL
.
=
" AND EventTimestamp >= ?"
;
array_push
(
$extraSQLVals
,
$_POST
[
'date_from'
]);
}
# Do we have a from date?, if so add it to our query
if
(
isset
(
$_POST
[
'date_to'
]))
{
$extraSQL
.
=
" AND EventTimestamp <= ?"
;
array_push
(
$extraSQLVals
,
$_POST
[
'date_to'
]);
}
$rownums
=
0
;
# Modify if we had a partial search or no search
while
(
$row
=
$res
->
fetchObject
())
{
if
(
count
(
$extraSQLVals
)
<
2
)
{
if
(
$row
->
framedipaddress
!=
NULL
)
{
$limitSQL
=
"LIMIT 50"
;
$rownums
=
$rownums
+
1
;
}
else
{
$rownums
=
$rownums
-
1
;
}
}
# Query to get all default data
$sql
=
"
SELECT
EventTimestamp,
ServiceType,
FramedProtocol,
NASPort,
NASPortType,
CallingStationID,
CalledStationID,
NASPortID,
AcctSessionID,
FramedIPAddress,
AcctAuthentic,
NASIdentifier,
NASIPAddress,
AcctDelayTime,
AcctSessionTime,
AcctInputOctets,
AcctInputGigawords,
AcctOutputOctets,
AcctOutputGigawords,
AcctStatusType,
AcctTerminateCause
FROM
${DB_TABLE_PREFIX}accounting
WHERE
Username = '
$getuser
'
$extraSQL
ORDER BY
EventTimestamp
DESC
$limitSQL
"
;
$res
=
$db
->
prepare
(
$sql
);
$res
->
execute
(
$extraSQLVals
);
$rownums
=
0
;
while
(
$row
=
$res
->
fetchObject
())
{
if
(
$row
->
eventtimestamp
!=
NULL
)
{
$rownums
=
$rownums
+
1
;
}
else
{
$rownums
=
$rownums
-
1
;
}
# Data usage
# ==========
# Input
$inputData
=
0
;
if
(
!
empty
(
$row
->
acctinputoctets
)
&&
$row
->
acctinputoctets
>
0
)
{
$inputData
=
(
$row
->
accinputoctets
/
1024
/
1024
);
}
if
(
!
empty
(
$row
->
acctinputgigawords
)
&&
$row
->
inputgigawords
>
0
)
{
$inputData
=
(
$row
->
acctinputgigawords
*
4096
);
}
if
(
$inputData
!=
0
)
{
$inputDataDisplay
=
ceil
(
$inputData
*
100
)
/
100
;
}
else
{
$inputDataDisplay
=
0
;
}
$totalInputData
=
$totalInputData
+
$inputData
;
# Output
$outputData
=
0
;
if
(
!
empty
(
$row
->
acctoutputoctets
)
&&
$row
->
acctoutputoctets
>
0
)
{
$outputData
=
(
$row
->
acctoutputoctets
/
1024
/
1024
);
}
if
(
!
empty
(
$row
->
acctoutputgigawords
)
&&
$row
->
acctoutputgigawords
>
0
)
{
$outputData
=
(
$row
->
acctoutputgigawords
*
4096
);
}
if
(
$outputData
!=
0
)
{
$outputDataDisplay
=
ceil
(
$outputData
*
100
)
/
100
;
}
else
{
$outputDataDisplay
=
0
;
}
$totalOutputData
=
$totalOutputData
+
$outputData
;
?>
?>
<tr
class=
"resultsitem"
>
<tr
class=
"resultsitem"
>
<td
class=
"textcenter"
>
<?php
echo
$row
->
eventtimestamp
?>
</td>
<td
class=
"textcenter"
>
<?php
echo
$row
->
servicetype
?>
</td>
<td
class=
"textcenter"
>
<?php
echo
$row
->
servicetype
?>
</td>
<td
class=
"textcenter"
>
<?php
echo
$row
->
framedprotocol
?>
</td>
<td
class=
"textcenter"
>
<?php
echo
$row
->
framedprotocol
?>
</td>
<td
class=
"textcenter"
>
<?php
echo
$row
->
nasport
?>
</td>
<td
class=
"textcenter"
>
<?php
echo
$row
->
nasport
?>
</td>
...
@@ -98,44 +215,41 @@ printHeader(array(
...
@@ -98,44 +215,41 @@ printHeader(array(
<td
class=
"textcenter"
>
<?php
echo
$row
->
acctsessionid
?>
</td>
<td
class=
"textcenter"
>
<?php
echo
$row
->
acctsessionid
?>
</td>
<td
class=
"textcenter"
>
<?php
echo
$row
->
framedipaddress
?>
</td>
<td
class=
"textcenter"
>
<?php
echo
$row
->
framedipaddress
?>
</td>
<td
class=
"textcenter"
>
<?php
echo
$row
->
acctauthentic
?>
</td>
<td
class=
"textcenter"
>
<?php
echo
$row
->
acctauthentic
?>
</td>
<td
class=
"textcenter"
>
<?php
echo
$row
->
eventtimestamp
?>
</td>
<td
class=
"textcenter"
>
<?php
echo
$row
->
nasidentifier
?>
</td>
<td
class=
"textcenter"
>
<?php
echo
$row
->
nasidentifier
?>
</td>
<td
class=
"textcenter"
>
<?php
echo
$row
->
nasipaddress
?>
</td>
<td
class=
"textcenter"
>
<?php
echo
$row
->
nasipaddress
?>
</td>
<td
class=
"textcenter"
>
<?php
echo
$row
->
acctdelaytime
?>
</td>
<td
class=
"textcenter"
>
<?php
echo
$row
->
acctdelaytime
?>
</td>
<td
class=
"textcenter"
>
<?php
echo
$row
->
acctsessiontime
?>
</td>
<td
class=
"textcenter"
>
<?php
echo
$row
->
acctsessiontime
?>
</td>
<td
class=
"textcenter"
>
<?php
echo
$row
->
acctinputoctets
?>
</td>
<td
class=
"textcenter"
>
<?php
echo
$inputDataDisplay
?>
Mbytes
</td>
<td
class=
"textcenter"
>
<?php
echo
$row
->
acctinputgigawords
?>
</td>
<td
class=
"textcenter"
>
<?php
echo
$outputDataDisplay
?>
Mbytes
</td>
<td
class=
"textcenter"
>
<?php
echo
$row
->
acctinputpackets
?>
</td>
<td
class=
"textcenter"
>
<?php
echo
$row
->
acctoutputoctets
?>
</td>
<td
class=
"textcenter"
>
<?php
echo
$row
->
acctoutputgigawords
?>
</td>
<td
class=
"textcenter"
>
<?php
echo
$row
->
acctoutputpackets
?>
</td>
<td
class=
"textcenter"
>
<?php
echo
$row
->
acctstatustype
?>
</td>
<td
class=
"textcenter"
>
<?php
echo
$row
->
acctstatustype
?>
</td>
<td
class=
"textcenter"
>
<?php
echo
$row
->
acctterminatecause
?>
</td>
<td
class=
"textcenter"
>
<?php
echo
$row
->
acctterminatecause
?>
</td>
</tr>
</tr>
<?php
<?php
}
}
$res
->
closeCursor
();
$res
->
closeCursor
();
if
(
$rownums
<=
0
)
{
if
(
$rownums
<=
0
)
{
?>
?>
<p
/>
<tr>
<tr>
<td
colspan=
"23"
class=
"textcenter"
>
No logs found for user:
<?php
echo
$getuser
?>
</td>
<td
colspan=
"23"
class=
"textcenter"
>
No logs found for user:
<?php
echo
$getuser
?>
</td>
</tr>
</tr>
<?php
<?php
}
}
unset
(
$rownums
);
unset
(
$rownums
);
}
else
{
}
else
{
?>
?>
<tr
class=
"resultitem"
>
<tr>
<td
c
olspan=
"5"
class=
"textcenter
"
>
No
U
ser ID selected
</td>
<td
c
lass=
"warning
"
>
No
u
ser ID selected
</td>
</tr>
</tr>
<?php
<?php
}
}
?>
?>
</table>
</table>
</form>
<?php
<?php
printFooter
();
printFooter
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment