Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
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
smradius
smradius
Compare revisions
2d3e450fcbd591b7ecd414fd407a913d15a0f8ae to master
Compare revisions
Changes are shown as if the
source
revision was being merged into the
target
revision.
Learn more about comparing revisions.
Source
smradius/smradius
Select target project
No results found
master
Select Git revision
Swap
Target
centiva-shail/smradius
Select target project
smradius/smradius
centiva-shail/smradius
nkukard/smradius
3 results
2d3e450fcbd591b7ecd414fd407a913d15a0f8ae
Select Git revision
Show changes
Only incoming changes from source
Include changes to target since source was created
Compare
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
webui/user/index.php
+384
-469
384 additions, 469 deletions
webui/user/index.php
webui/user/logs.php
+71
-51
71 additions, 51 deletions
webui/user/logs.php
webui/user/styles.css
+1
-1
1 addition, 1 deletion
webui/user/styles.css
with
456 additions
and
521 deletions
webui/user/index.php
View file @
b659b33b
<?php
# Main User Control Panel Page
# Copyright (c) 2007-20
09
, AllWorldIT
# Copyright (c) 2007-20
15
, AllWorldIT
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
...
...
@@ -25,6 +25,12 @@ include("include/header.php");
# NB: We will only end up here if we authenticated!
# Displays error
function
webuiError
(
$msg
)
{
echo
isset
(
$msg
)
?
$msg
:
"Unknown error"
;
}
# Display details
function
displayDetails
()
{
global
$db
;
...
...
@@ -33,82 +39,90 @@ function displayDetails() {
# Get user's ID
$sql
=
"
SELECT
ID
ID
, Username
FROM
${DB_TABLE_PREFIX}users
WHERE
Username = "
.
$db
->
quote
(
$_SESSION
[
'username'
])
.
"
"
;
$res
=
$db
->
query
(
$sql
);
if
(
!
(
is_object
(
$res
)))
{
webuiError
(
"Error fetching user information"
);
}
$row
=
$res
->
fetchObject
();
# Set user ID
$userID
=
$row
->
id
;
$username
=
$row
->
username
;
# Get accounting data
$currentMonth
=
date
(
"Y-m"
);
$sql
=
"
SELECT
AcctSessionTime,
AcctInputOctets
,
AcctInputGigawords
,
AcctOutputOctets
,
AcctOutputGigawords
SUM(AcctSessionTime) / 60 AS
AcctSessionTime,
SUM(
AcctInputOctets
) / 1024 / 1024 +
SUM(
AcctInputGigawords
) * 4096 +
SUM(
AcctOutputOctets
) / 1024 / 1024 +
SUM(
AcctOutputGigawords
) * 4096 AS TotalTraffic
FROM
${DB_TABLE_PREFIX}accounting
WHERE
Username = "
.
$db
->
quote
(
$
_SESSION
[
'
username
'
]
)
.
"
Username = "
.
$db
->
quote
(
$username
)
.
"
AND
EventTimestamp >= "
.
$db
->
quote
(
$currentMonth
)
.
"
ORDER BY
EventTimestamp
DESC
PeriodKey = "
.
$db
->
quote
(
$currentMonth
)
.
"
"
;
$res
=
$db
->
query
(
$sql
);
if
(
!
(
is_object
(
$res
)))
{
webuiError
(
"Error fetching user accounting"
);
}
# Set total traffic and uptime used
$totalTraffic
=
0
;
$totalUptime
=
0
;
while
(
$row
=
$res
->
fetchObject
())
{
# Traffic in
$inputDataItem
=
0
;
if
(
isset
(
$row
->
acctinputoctets
)
&&
$row
->
acctinputoctets
>
0
)
{
$inputDataItem
+=
(
$row
->
acctinputoctets
/
1024
)
/
1024
;
}
if
(
isset
(
$row
->
acctinputgigawords
)
&&
$row
->
acctinputgigawords
>
0
)
{
$inputDataItem
+=
(
$row
->
acctinputgigawords
*
4096
);
}
# Pull in row
$row
=
$res
->
fetchObject
();
$totalTraffic
+=
$inputDataItem
;
# Traffic
if
(
isset
(
$row
->
totaltraffic
)
&&
$row
->
totaltraffic
>
0
)
{
$totalTraffic
+=
$row
->
totaltraffic
;
}
# Uptime
if
(
isset
(
$row
->
acctsessiontime
)
&&
$row
->
acctsessiontime
>
0
)
{
$totalUptime
+=
$row
->
acctsessiontime
;
}
# Traffic out
$outputDataItem
=
0
;
# Fetch user uptime and traffic cap (group attributes)
$sql
=
"
SELECT
${DB_TABLE_PREFIX}group_attributes.Name, ${DB_TABLE_PREFIX}group_attributes.Value
FROM
${DB_TABLE_PREFIX}group_attributes, ${DB_TABLE_PREFIX}users_to_groups
WHERE
${DB_TABLE_PREFIX}users_to_groups.GroupID = ${DB_TABLE_PREFIX}group_attributes.GroupID
AND ${DB_TABLE_PREFIX}users_to_groups.UserID = "
.
$db
->
quote
(
$userID
)
.
"
AND ${DB_TABLE_PREFIX}group_attributes.Disabled = 0
"
;
$res
=
$db
->
query
(
$sql
);
if
(
!
(
is_object
(
$res
)))
{
webuiError
(
"Error fetching user attributes"
);
}
if
(
isset
(
$row
->
acctoutputoctets
)
&&
$row
->
acctoutputoctets
>
0
)
{
$outputDataItem
+=
(
$row
->
acctoutputoctets
/
1024
)
/
1024
;
}
if
(
isset
(
$row
->
acctoutputgigawords
)
&&
$row
->
acctoutputgigawords
>
0
)
{
$outputDataItem
+=
(
$row
->
acctoutputgigawords
*
4096
);
# Initial values
$trafficCap
=
"Prepaid"
;
$uptimeCap
=
"Prepaid"
;
while
(
$row
=
$res
->
fetchObject
())
{
if
(
$row
->
name
===
"SMRadius-Capping-Traffic-Limit"
)
{
$trafficCap
=
(
int
)
$row
->
value
;
}
$totalTraffic
+=
$outputDataItem
;
# Uptime
$sessionTimeItem
=
0
;
if
(
isset
(
$row
->
acctsessiontime
)
&&
$row
->
acctsessiontime
>
0
)
{
$sessionTimeItem
+=
$row
->
acctsessiontime
;
if
(
$row
->
name
===
"SMRadius-Capping-Uptime-Limit"
)
{
$uptimeCap
=
(
int
)
$row
->
value
;
}
$totalUptime
+=
$sessionTimeItem
;
# Round up
$totalUptime
=
ceil
(
$totalUptime
/
60
);
}
# Fetch user uptime and traffic cap
# Fetch user uptime and traffic cap
(user attributes)
$sql
=
"
SELECT
Name, Value
...
...
@@ -116,17 +130,19 @@ function displayDetails() {
${DB_TABLE_PREFIX}user_attributes
WHERE
UserID = "
.
$db
->
quote
(
$userID
)
.
"
AND Disabled = 0
"
;
$res
=
$db
->
query
(
$sql
);
if
(
!
(
is_object
(
$res
)))
{
webuiError
(
"Error fetching user attributes"
);
}
# Set uptime and traffic cap
$trafficCap
=
"Prepaid"
;
$uptimeCap
=
"Prepaid"
;
# Override group_attributes with user attributes
while
(
$row
=
$res
->
fetchObject
())
{
if
(
$row
->
name
==
"SMRadius-Capping-Traffic-Limit"
)
{
if
(
$row
->
name
==
=
"SMRadius-Capping-Traffic-Limit"
)
{
$trafficCap
=
(
int
)
$row
->
value
;
}
if
(
$row
->
name
==
"SMRadius-Capping-Uptime-Limit"
)
{
if
(
$row
->
name
==
=
"SMRadius-Capping-Uptime-Limit"
)
{
$uptimeCap
=
(
int
)
$row
->
value
;
}
}
...
...
@@ -136,7 +152,9 @@ function displayDetails() {
SELECT
${DB_TABLE_PREFIX}topups_summary.Balance,
${DB_TABLE_PREFIX}topups.Type,
${DB_TABLE_PREFIX}topups.Value
${DB_TABLE_PREFIX}topups.Value,
${DB_TABLE_PREFIX}topups.ValidFrom,
${DB_TABLE_PREFIX}topups.ValidTo
FROM
${DB_TABLE_PREFIX}topups_summary,
${DB_TABLE_PREFIX}topups
...
...
@@ -146,511 +164,408 @@ function displayDetails() {
AND ${DB_TABLE_PREFIX}topups_summary.PeriodKey = "
.
$db
->
quote
(
$currentMonth
)
.
"
AND ${DB_TABLE_PREFIX}topups_summary.Depleted = 0
ORDER BY
${DB_TABLE_PREFIX}topups.Timestamp
${DB_TABLE_PREFIX}topups.Timestamp
ASC
"
;
$res
=
$db
->
query
(
$sql
);
if
(
!
(
is_object
(
$res
)))
{
webuiError
(
"Error fetching topup summaries"
);
}
# Store summary topups
$topups
=
array
();
$i
=
0
;
while
(
$row
=
$res
->
fetchObject
())
{
$topups
[
$i
]
=
array
();
$topups
[
$i
][
'Type'
]
=
$row
->
type
;
$topups
[
$i
][
'Limit'
]
=
$row
->
balance
;
$topups
[
$i
][
'OriginalLimit'
]
=
$row
->
value
;
$topups
[
$i
][
'CurrentLimit'
]
=
$row
->
balance
;
$topups
[
$i
][
'Limit'
]
=
$row
->
value
;
$topups
[
$i
][
'ValidFrom'
]
=
$row
->
validfrom
;
$topups
[
$i
][
'Expires'
]
=
$row
->
validto
;
$i
++
;
}
# Fetch user uptime and traffic topups
$thisMonth
UnixTime
=
strtotime
(
$currentMonth
)
;
$now
=
time
(
);
$thisMonth
Timestamp
=
date
(
"Y-m"
)
.
'-01'
;
$now
=
date
(
"Y-m-d"
);
$sql
=
"
SELECT
Value, Type
Value, Type
, ValidFrom, ValidTo
FROM
${DB_TABLE_PREFIX}
topups
topups
WHERE
${DB_TABLE_PREFIX}topups.
UserID = "
.
$db
->
quote
(
$userID
)
.
"
AND
${DB_TABLE_PREFIX}topups.
ValidFrom
>
= "
.
$db
->
quote
(
$thisMonth
Unix
Time
)
.
"
AND
${DB_TABLE_PREFIX}topups.
ValidTo > "
.
$db
->
quote
(
$now
)
.
"
AND
${DB_TABLE_PREFIX}topups.
Depleted = 0
UserID = "
.
$db
->
quote
(
$userID
)
.
"
AND ValidFrom = "
.
$db
->
quote
(
$thisMonthTime
stamp
)
.
"
AND ValidTo >
=
"
.
$db
->
quote
(
$now
)
.
"
AND Depleted = 0
ORDER BY
${DB_TABLE_PREFIX}topups.
Timestamp
Timestamp
ASC
"
;
$res
=
$db
->
query
(
$sql
);
if
(
!
(
is_object
(
$res
)))
{
webuiError
(
"Error fetching topup"
);
}
# Store normal topups
while
(
$row
=
$res
->
fetchObject
())
{
$topups
[
$i
]
=
array
();
$topups
[
$i
][
'Type'
]
=
$row
->
type
;
$topups
[
$i
][
'Limit'
]
=
$row
->
value
;
$topups
[
$i
][
'ValidFrom'
]
=
$row
->
validfrom
;
$topups
[
$i
][
'Expires'
]
=
$row
->
validto
;
$i
++
;
}
# Set excess traffic usage
$excessTraffic
=
0
;
if
(
is_numeric
(
$trafficCap
)
&&
$trafficCap
>
0
)
{
$excessTraffic
+=
$totalTraffic
-
$trafficCap
;
}
elseif
(
is_string
(
$trafficCap
))
{
$excessTraffic
+=
$totalTraffic
;
}
# Calculate topup usage for prepaid and normal users
$totalTrafficTopupsAvail
=
0
;
if
(
!
(
is_numeric
(
$trafficCap
)
&&
$trafficCap
==
0
))
{
#
Set excess uptime
usage
$excess
Uptime
=
0
;
if
(
is_numeric
(
$uptimeCap
)
&&
$uptimeCap
>
0
)
{
$excess
Uptime
+=
$totalUptime
-
$uptimeCap
;
}
else
if
(
is_string
(
$uptimeCap
))
{
$excess
Uptime
+=
$totalUptime
;
}
#
Excess
usage
$excess
=
0
;
if
(
$trafficCap
===
"Prepaid"
)
{
$excess
=
$totalTraffic
;
}
else
{
$excess
=
$totalTraffic
>
$trafficCap
?
(
$totalTraffic
-
$trafficCap
)
:
0
;
}
# Loop through traffic topups and check for current topup, total topups not being used
if
(
is_string
(
$trafficCap
)
||
$trafficCap
!=
0
)
{
$currentTrafficTopup
=
array
();
$topupTrafficRemaining
=
0
;
# Loop through all valid topups
$trafficRows
=
array
();
$i
=
0
;
# User is using traffic from topups
if
(
$excessTraffic
>
0
)
{
foreach
(
$topups
as
$topupItem
)
{
if
(
$topupItem
[
'Type'
]
==
1
)
{
if
(
$excessTraffic
<=
0
)
{
$topupTrafficRemaining
+=
$topupItem
[
'Limit'
];
next
(
$topupItem
);
}
elseif
(
$excessTraffic
>=
$topupItem
[
'Limit'
])
{
$excessTraffic
-=
$topupItem
[
'Limit'
];
}
else
{
if
(
isset
(
$topupItem
[
'OriginalLimit'
]))
{
$currentTrafficTopup
[
'Cap'
]
=
$topupItem
[
'OriginalLimit'
];
}
else
{
$currentTrafficTopup
[
'Cap'
]
=
$topupItem
[
'Limit'
];
}
$currentTrafficTopup
[
'Used'
]
=
$excessTraffic
;
$excessTraffic
-=
$topupItem
[
'Limit'
];
}
}
}
# User has not used traffic topups yet
}
else
{
foreach
(
$topups
as
$topupItem
)
{
if
(
$topupItem
[
'Type'
]
==
1
)
{
if
(
$i
==
0
)
{
if
(
isset
(
$topupItem
[
'OriginalLimit'
]))
{
$currentTrafficTopup
[
'Cap'
]
=
$topupItem
[
'OriginalLimit'
];
}
else
{
$currentTrafficTopup
[
'Cap'
]
=
$topupItem
[
'Limit'
];
}
$i
=
1
;
$currentTrafficTopup
[
'Used'
]
=
0
;
}
else
{
$topupTrafficRemaining
+=
$topupItem
[
'Limit'
];
}
foreach
(
$topups
as
$topup
)
{
# Traffic topups
if
(
$topup
[
'Type'
]
==
1
)
{
# Topup not currently in use
if
(
$excess
<=
0
)
{
$trafficRows
[
$i
]
=
array
();
$trafficRows
[
$i
][
'Cap'
]
=
$topup
[
'Limit'
];
$trafficRows
[
$i
][
'Used'
]
=
isset
(
$topup
[
'CurrentLimit'
])
?
(
$topup
[
'Limit'
]
-
$topup
[
'CurrentLimit'
])
:
0
;
$trafficRows
[
$i
][
'ValidFrom'
]
=
$topup
[
'ValidFrom'
];
$trafficRows
[
$i
][
'Expires'
]
=
$topup
[
'Expires'
];
# Set total available topups
$totalTrafficTopupsAvail
+=
isset
(
$topup
[
'CurrentLimit'
])
?
$topup
[
'CurrentLimit'
]
:
$topup
[
'Limit'
];
$i
++
;
# Topup currently in use
}
elseif
(
!
isset
(
$topup
[
'CurrentLimit'
])
&&
$excess
<
$topup
[
'Limit'
])
{
$trafficRows
[
$i
]
=
array
();
$trafficRows
[
$i
][
'Cap'
]
=
$topup
[
'Limit'
];
$trafficRows
[
$i
][
'Used'
]
=
$excess
;
$trafficRows
[
$i
][
'ValidFrom'
]
=
$topup
[
'ValidFrom'
];
$trafficRows
[
$i
][
'Expires'
]
=
$topup
[
'Expires'
];
# Set total available topups
$totalTrafficTopupsAvail
+=
$topup
[
'Limit'
];
# Set current topup
$currentTrafficTopup
=
array
();
$currentTrafficTopup
[
'Used'
]
=
$excess
;
$currentTrafficTopup
[
'Cap'
]
=
$topup
[
'Limit'
];
# If we hit this topup then all the rest of them are available
$excess
=
0
;
$i
++
;
}
elseif
(
isset
(
$topup
[
'CurrentLimit'
])
&&
$excess
<
$topup
[
'CurrentLimit'
])
{
$trafficRows
[
$i
]
=
array
();
$trafficRows
[
$i
][
'Cap'
]
=
$topup
[
'Limit'
];
$trafficRows
[
$i
][
'Expires'
]
=
$topup
[
'Expires'
];
$trafficRows
[
$i
][
'ValidFrom'
]
=
$topup
[
'ValidFrom'
];
$trafficRows
[
$i
][
'Used'
]
=
(
$topup
[
'Limit'
]
-
$topup
[
'CurrentLimit'
])
+
$excess
;
# Set total available topups
$totalTrafficTopupsAvail
+=
$topup
[
'CurrentLimit'
];
# Set current topup
$currentTrafficTopup
=
array
();
$currentTrafficTopup
[
'Used'
]
=
(
$topup
[
'Limit'
]
-
$topup
[
'CurrentLimit'
])
+
$excess
;
$currentTrafficTopup
[
'Cap'
]
=
$topup
[
'Limit'
];
# If we hit this topup then all the rest of them are available
$excess
=
0
;
$i
++
;
# Topup has been used up
}
else
{
$trafficRows
[
$i
]
=
array
();
$trafficRows
[
$i
][
'Cap'
]
=
$topup
[
'Limit'
];
$trafficRows
[
$i
][
'Used'
]
=
$topup
[
'Limit'
];
$trafficRows
[
$i
][
'ValidFrom'
]
=
$topup
[
'ValidFrom'
];
$trafficRows
[
$i
][
'Expires'
]
=
$topup
[
'Expires'
];
# Subtract this topup from excess usage
$excess
-=
isset
(
$topup
[
'CurrentLimit'
])
?
$topup
[
'CurrentLimit'
]
:
$topup
[
'Limit'
];
$i
++
;
}
}
}
}
# Loop through uptime topups and check for current topup, total topups not being used
if
(
is_string
(
$uptimeCap
)
||
$uptimeCap
!=
0
)
{
$currentUptimeTopup
=
array
();
$topupUptimeRemaining
=
0
;
$i
=
0
;
# User is using uptime from topups
if
(
$excessUptime
>
0
)
{
foreach
(
$topups
as
$topupItem
)
{
if
(
$topupItem
[
'Type'
]
==
2
)
{
if
(
$excessUptime
<=
0
)
{
$topupUptimeRemaining
+=
$topupItem
[
'Limit'
];
next
(
$topupItem
);
}
elseif
(
$excessUptime
>=
$topupItem
[
'Limit'
])
{
$excessUptime
-=
$topupItem
[
'Limit'
];
}
else
{
if
(
isset
(
$topupItem
[
'OriginalLimit'
]))
{
$currentUptimeTopup
[
'Cap'
]
=
$topupItem
[
'OriginalLimit'
];
}
else
{
$currentUptimeTopup
[
'Cap'
]
=
$topupItem
[
'Limit'
];
}
$currentUptimeTopup
[
'Used'
]
=
$excessUptime
;
$excessUptime
-=
$topupItem
[
'Limit'
];
}
}
}
# User has not used uptime topups yet
# Calculate topup usage for prepaid and normal users
$totalUptimeTopupsAvail
=
0
;
if
(
!
(
is_numeric
(
$uptimeCap
)
&&
$uptimeCap
==
0
))
{
# Excess usage
$excess
=
0
;
if
(
$uptimeCap
===
"Prepaid"
)
{
$excess
=
$totalUptime
;
}
else
{
foreach
(
$topups
as
$topupItem
)
{
if
(
$topupItem
[
'Type'
]
==
2
)
{
if
(
$i
==
0
)
{
if
(
isset
(
$topupItem
[
'OriginalLimit'
]))
{
$currentUptimeTopup
[
'Cap'
]
=
$topupItem
[
'OriginalLimit'
];
}
else
{
$currentUptimeTopup
[
'Cap'
]
=
$topupItem
[
'Limit'
];
}
$i
=
1
;
$currentUptimeTopup
[
'Used'
]
=
0
;
}
else
{
$topupUptimeRemaining
+=
$topupItem
[
'Limit'
];
}
}
}
$excess
=
$totalUptime
>
$uptimeCap
?
(
$totalUptime
-
$uptimeCap
)
:
0
;
}
}
/*
# Fetch user phone and email info
$sql = "
SELECT
Phone, Email
FROM
${DB_TABLE_PREFIX}wisp_userdata
WHERE
UserID = '$userID'
";
# Loop through all valid topups
$uptimeRows
=
array
();
$i
=
0
;
foreach
(
$topups
as
$topup
)
{
$res = $db->query($sql);
# Uptime topups
if
(
$topup
[
'Type'
]
==
2
)
{
$userPhone = "Not set";
$userEmail = "Not set";
if ($res->rowCount() > 0) {
$row = $res->fetchObject();
$userPhone = $row->phone;
$userEmail = $row->email;
}
*/
# Topup not currently in use
if
(
$excess
<=
0
)
{
$uptimeRows
[
$i
]
=
array
();
$uptimeRows
[
$i
][
'Cap'
]
=
$topup
[
'Limit'
];
$uptimeRows
[
$i
][
'Used'
]
=
isset
(
$topup
[
'CurrentLimit'
])
?
(
$topup
[
'Limit'
]
-
$topup
[
'CurrentLimit'
])
:
0
;
$uptimeRows
[
$i
][
'ValidFrom'
]
=
$topup
[
'ValidFrom'
];
$uptimeRows
[
$i
][
'Expires'
]
=
$topup
[
'Expires'
];
# Set total available topups
$totalUptimeTopupsAvail
+=
isset
(
$topup
[
'CurrentLimit'
])
?
$topup
[
'CurrentLimit'
]
:
$topup
[
'Limit'
];
# These two items need fixing
$isDialup
=
0
;
$userService
=
"Not set"
;
$i
++
;
# Topup currently in use
}
elseif
(
!
isset
(
$topup
[
'CurrentLimit'
])
&&
$excess
<
$topup
[
'Limit'
])
{
$uptimeRows
[
$i
]
=
array
();
$uptimeRows
[
$i
][
'Cap'
]
=
$topup
[
'Limit'
];
$uptimeRows
[
$i
][
'Used'
]
=
$excess
;
$uptimeRows
[
$i
][
'ValidFrom'
]
=
$topup
[
'ValidFrom'
];
$uptimeRows
[
$i
][
'Expires'
]
=
$topup
[
'Expires'
];
# Set total available topups
$totalUptimeTopupsAvail
+=
$topup
[
'Limit'
];
# Set current topup
$currentUptimeTopup
=
array
();
$currentUptimeTopup
[
'Used'
]
=
$excess
;
$currentUptimeTopup
[
'Cap'
]
=
$topup
[
'Limit'
];
# If we hit this topup then all the rest of them are available
$excess
=
0
;
$i
++
;
}
elseif
(
isset
(
$topup
[
'CurrentLimit'
])
&&
$excess
<
$topup
[
'CurrentLimit'
])
{
$uptimeRows
[
$i
]
=
array
();
$uptimeRows
[
$i
][
'Cap'
]
=
$topup
[
'Limit'
];
$uptimeRows
[
$i
][
'Expires'
]
=
$topup
[
'Expires'
];
$uptimeRows
[
$i
][
'ValidFrom'
]
=
$topup
[
'ValidFrom'
];
$uptimeRows
[
$i
][
'Used'
]
=
(
$topup
[
'Limit'
]
-
$topup
[
'CurrentLimit'
])
+
$excess
;
# Set total available topups
$totalUptimeTopupsAvail
+=
$topup
[
'CurrentLimit'
];
# Set current topup
$currentUptimeTopup
=
array
();
$currentUptimeTopup
[
'Used'
]
=
(
$topup
[
'Limit'
]
-
$topup
[
'CurrentLimit'
])
+
$excess
;
$currentUptimeTopup
[
'Cap'
]
=
$topup
[
'Limit'
];
# If we hit this topup then all the rest of them are available
$excess
=
0
;
$i
++
;
# Topup has been used up
}
else
{
$uptimeRows
[
$i
]
=
array
();
$uptimeRows
[
$i
][
'Cap'
]
=
$topup
[
'Limit'
];
$uptimeRows
[
$i
][
'Used'
]
=
$topup
[
'Limit'
];
$uptimeRows
[
$i
][
'ValidFrom'
]
=
$topup
[
'ValidFrom'
];
$uptimeRows
[
$i
][
'Expires'
]
=
$topup
[
'Expires'
];
# Subtract this topup from excess usage
$excess
-=
isset
(
$topup
[
'CurrentLimit'
])
?
$topup
[
'CurrentLimit'
]
:
$topup
[
'Limit'
];
$i
++
;
}
}
}
}
# HTML
?>
<table
class=
"blockcenter"
>
<tr>
<td
colspan=
"4"
class=
"section"
>
Account Information
</td>
<td
width=
"500"
colspan=
"4"
class=
"section"
>
Account Information
</td>
</tr>
<tr>
<td
align=
"center"
class=
"title"
>
Username
</td>
<td
align=
"center"
class=
"title"
>
Traffic Cap
</td>
<td
align=
"center"
class=
"title"
>
Uptime Cap
</td>
</tr>
<tr>
<td
align=
"center"
class=
"value"
>
<?php
echo
$username
;
?>
</td>
<td
align=
"center"
class=
"value"
>
<?php
if
(
is_numeric
(
$trafficCap
)
&&
$trafficCap
==
0
)
{
echo
"Unlimited"
;
}
elseif
(
is_string
(
$trafficCap
)
&&
$trafficCap
===
"Prepaid"
)
{
echo
$trafficCap
;
}
else
{
echo
$trafficCap
.
" MB"
;
}
?>
</td>
<td
align=
"center"
class=
"value"
>
<?php
if
(
is_numeric
(
$uptimeCap
)
&&
$uptimeCap
==
0
)
{
echo
"Unlimited"
;
}
elseif
(
is_string
(
$uptimeCap
)
&&
$uptimeCap
===
"Prepaid"
)
{
echo
$uptimeCap
;
}
else
{
echo
$uptimeCap
.
" MB"
;
}
?>
</td>
</tr>
<tr>
<td
colspan=
"2"
class=
"title"
>
Username
</td>
<td
colspan=
"2"
class=
"title"
>
Service
</td>
<td>
</td>
</tr>
<tr>
<td
colspan=
"2"
class=
"value"
>
<?php
echo
$_SESSION
[
'username'
];
?>
</td>
<td
colspan=
"2"
class=
"value"
>
<?php
echo
$userService
;
?>
</td>
<td
colspan=
"4"
class=
"section"
>
Traffic Usage
</td>
</tr>
<tr>
<td
align=
"center"
class=
"title"
>
Active Topup
</td>
<td
align=
"center"
class=
"title"
>
Total Topup
</td>
<td
align=
"center"
class=
"title"
>
Total Usage
</td>
</tr>
<td
align=
"center"
class=
"value"
>
<?php
if
(
isset
(
$currentTrafficTopup
)
&&
(
!
(
is_numeric
(
$trafficCap
)
&&
$trafficCap
==
0
)))
{
echo
sprintf
(
"%.2f"
,
$currentTrafficTopup
[
'Used'
])
.
"/"
.
sprintf
(
$currentTrafficTopup
[
'Cap'
])
.
" MB"
;
}
else
{
echo
"None"
;
}
?>
</td>
<td
align=
"center"
class=
"value"
>
<?php
echo
$totalTrafficTopupsAvail
.
" MB"
;
?>
</td>
<td
align=
"center"
class=
"value"
>
<?php
echo
sprintf
(
"%.2f"
,
$totalTraffic
)
.
" MB"
;
?>
</td>
<tr>
</tr>
<tr>
<td>
</td>
</tr>
<tr>
<td
colspan=
"4"
class=
"section"
>
Uptime Usage
</td>
</tr>
<tr>
<td
align=
"center"
class=
"title"
>
Active Topup
</td>
<td
align=
"center"
class=
"title"
>
Total Topup
</td>
<td
align=
"center"
class=
"title"
>
Total Usage
</td>
</tr>
<tr>
<td
align=
"center"
class=
"value"
>
<?php
if
(
isset
(
$currentUptimeTopup
)
&&
(
!
(
is_numeric
(
$uptimeCap
)
&&
$uptimeCap
==
0
)))
{
echo
sprintf
(
"%.2f"
,
$currentUptimeTopup
[
'Used'
])
.
"/"
.
sprintf
(
$currentUptimeTopup
[
'Cap'
])
.
" MB"
;
}
else
{
echo
"None"
;
}
?>
</td>
<td
align=
"center"
class=
"value"
>
<?php
echo
$totalUptimeTopupsAvail
.
" MB"
;
?>
</td>
<td
align=
"center"
class=
"value"
>
<?php
echo
sprintf
(
"%.2f"
,
$totalUptime
)
.
" Min"
;
?>
</td>
</tr>
</table>
<p>
</p>
<?php
#
Only
display
cap for DSL users
if
(
!
$isDialup
)
{
#
Dont
display
if we unlimited
if
(
!
(
is_numeric
(
$trafficCap
)
&&
$trafficCap
==
0
)
)
{
?>
<table
class=
"blockcenter"
>
<tr>
<td
colspan=
"
4
"
class=
"section"
>
Traffic
Usage
</td>
<td
width=
"500"
colspan=
"
3
"
class=
"section"
>
T
opup Overview: T
raffic
</td>
</tr>
<tr>
<td
class=
"title"
>
Traffic Cap
</td>
<td
class=
"title"
>
Unused Topup
</td>
<td
class=
"title"
>
Current Topup
</td>
<td
class=
"title"
>
Used This Month
</td>
<td
align=
"center"
class=
"title"
>
Used
</td>
<td
align=
"center"
class=
"title"
>
Valid From
</td>
<td
align=
"center"
class=
"title"
>
Valid To
</td>
</tr>
<tr>
<?php
if
(
is_numeric
(
$trafficCap
)
&&
$trafficCap
>
0
)
{
?>
<td
class=
"value"
>
<?php
echo
$trafficCap
;
?>
MB
</td>
<?php
}
elseif
(
is_numeric
(
$trafficCap
)
&&
$trafficCap
==
0
)
{
?>
<td
class=
"value"
>
Uncapped
</td>
<?php
}
else
{
?>
<td
class=
"value"
>
<?php
echo
$trafficCap
;
?>
</td>
<?php
}
if
(
is_numeric
(
$trafficCap
)
&&
$trafficCap
==
0
)
{
?>
<td
class=
"value"
>
N/A
</td>
<?php
}
else
{
?>
<td
class=
"value"
>
<?php
echo
$topupTrafficRemaining
;
?>
MB
</td>
<?php
}
if
(
isset
(
$currentTrafficTopup
[
'Used'
])
&&
isset
(
$currentTrafficTopup
[
'Cap'
]))
{
?>
<td
class=
"value"
>
<?php
printf
(
'%.2f'
,
$currentTrafficTopup
[
'Used'
]);
print
(
"/"
.
$currentTrafficTopup
[
'Cap'
]);
?>
MB
</td>
<?php
}
else
{
foreach
(
$trafficRows
as
$trafficRow
)
{
?>
<td
class=
"value"
>
N/A
</td>
<?php
}
?>
<td
class=
"value"
>
<?php
printf
(
'%.2f'
,
$totalTraffic
);
?>
MB
</td>
</tr>
<tr>
<td
align=
"center"
class=
"value"
>
<?php
if
(
isset
(
$currentTrafficTopup
[
'Used'
])
&&
isset
(
$currentTrafficTopup
[
'Cap'
]))
{
$topupPercent
=
ceil
((
$currentTrafficTopup
[
'Used'
]
/
$currentTrafficTopup
[
'Cap'
])
*
100
);
echo
sprintf
(
"%.2f"
,
$trafficRow
[
'Used'
])
.
"/"
.
sprintf
(
$trafficRow
[
'Cap'
])
.
" MB"
;
?>
<tr>
<td
colspan=
"4"
>
<div
class=
"graph"
>
<strong
class=
"bar"
style=
"width:
<?php
echo
$topupPercent
.
'%'
;
?>
"
>
<?php
echo
$topupPercent
.
'%'
?>
</strong>
</div>
</td>
<td
align=
"center"
class=
"value"
>
<?php
$validFrom
=
strtotime
(
$trafficRow
[
'ValidFrom'
]);
echo
date
(
"Y-m-d"
,
$validFrom
);
?>
</td>
<td
align=
"center"
class=
"value"
>
<?php
$validTo
=
strtotime
(
$trafficRow
[
'Expires'
]);
echo
date
(
"Y-m-d"
,
$validTo
);
?>
</td>
</tr>
<?php
}
?>
</table>
<?php
}
# Dont display if we unlimited
if
(
!
(
is_numeric
(
$uptimeCap
)
&&
$uptimeCap
==
0
))
{
?>
<p>
</p>
<table
class=
"blockcenter"
>
<tr>
<td
colspan=
"
4
"
class=
"section"
>
Uptime Usag
e
</td>
<td
width=
"500"
colspan=
"
3
"
class=
"section"
>
Topup Overview: Uptim
e
</td>
</tr>
<tr>
<td
class=
"title"
>
Uptime Cap
</td>
<td
class=
"title"
>
Unused Topup
</td>
<td
class=
"title"
>
Current Topup
</td>
<td
class=
"title"
>
Used This Month
</td>
<td
align=
"center"
class=
"title"
>
Used
</td>
<td
align=
"center"
class=
"title"
>
Valid From
</td>
<td
align=
"center"
class=
"title"
>
Valid To
</td>
</tr>
<tr>
<?php
if
(
is_numeric
(
$uptimeCap
)
&&
$uptimeCap
>
0
)
{
?>
<td
class=
"value"
>
<?php
echo
$uptimeCap
;
?>
Min
</td>
<?php
}
elseif
(
is_numeric
(
$uptime
Cap
)
&&
$uptime
Cap
==
0
)
{
foreach
(
$uptime
Rows
as
$uptime
Row
)
{
?>
<td
class=
"value"
>
Uncapped
</td>
<?php
}
else
{
?>
<td
class=
"value"
>
<?php
echo
$uptimeCap
;
?>
</td>
<?php
}
if
(
is_numeric
(
$uptimeCap
)
&&
$uptimeCap
==
0
)
{
?>
<td
class=
"value"
>
N/A
</td>
<?php
}
else
{
?>
<td
class=
"value"
>
<?php
echo
$topupUptimeRemaining
;
?>
Min
</td>
<?php
}
if
(
isset
(
$currentUptimeTopup
[
'Used'
])
&&
isset
(
$currentUptimeTopup
[
'Cap'
]))
{
?>
<td
class=
"value"
>
<?php
printf
(
'%.2f'
,
$currentUptimeTopup
[
'Used'
]);
print
(
"/"
.
$currentUptimeTopup
[
'Cap'
]);
?>
Min
</td>
<?php
}
else
{
?>
<td
class=
"value"
>
N/A
</td>
<?php
}
?>
<td
class=
"value"
>
<?php
printf
(
'%.2f'
,
$totalUptime
);
?>
Min
</td>
</tr>
<tr>
<td
align=
"center"
class=
"value"
>
<?php
if
(
isset
(
$currentUptimeTopup
[
'Used'
])
&&
isset
(
$currentUptimeTopup
[
'Cap'
]))
{
$topupPercent
=
ceil
((
$currentUptimeTopup
[
'Used'
]
/
$currentUptimeTopup
[
'Cap'
])
*
100
);
echo
sprintf
(
"%.2f"
,
$uptimeRow
[
'Used'
])
.
"/"
.
sprintf
(
$uptimeRow
[
'Cap'
])
.
" MB"
;
?>
<tr>
<td
colspan=
"4"
>
<div
class=
"graph"
>
<strong
class=
"bar"
style=
"width:
<?php
echo
$topupPercent
.
'%'
;
?>
"
>
<?php
echo
$topupPercent
.
'%'
?>
</strong>
</div>
</td>
<td
align=
"center"
class=
"value"
>
<?php
$validFrom
=
strtotime
(
$uptimeRow
[
'ValidFrom'
]);
echo
date
(
"Y-m-d"
,
$validFrom
);
?>
</td>
<td
align=
"center"
class=
"value"
>
<?php
$validTo
=
strtotime
(
$uptimeRow
[
'Expires'
]);
echo
date
(
"Y-m-d"
,
$validTo
);
?>
</td>
</tr>
<?php
}
?>
<!--
<tr>
<td colspan="2" class="section">Notifications</td>
</tr>
<form method="post">
<tr>
<td class="title">Email Address</td>
<td class="value">
<input type="text" name="notifyMethodEmail" value="php echo $userEmail; "></input>
</td>
</tr>
<tr>
<td class="title">Cell Number</td>
<td class="value">
<input type="text" name="notifyMethodCell" value="php echo $userPhone; "></input>
</td>
</tr>
</form>
--!>
</table>
<?php
}
}
?>
<tr>
<td></td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td colspan="4" align="center">
<a href="logs.php">Usage Logs</a>
</td>
</tr>
</table>
<br><br>
<font size="-1">
Note:
<li>Please contact your ISP if you have any problem using this interface.</li>
</font>
<p>
</p>
<p
align=
"center"
><a
href=
"logs.php"
>
Usage Logs
</a></p>
<?php
}
/*
# If this is a post and we're updating
if (isset($_POST['notifyUpdate']) && $_POST['notifyUpdate'] == "update") {
$username = $_SESSION['username'];
# Get user's ID
$sql = "
SELECT
ID
FROM
${DB_TABLE_PREFIX}users
WHERE
Username = '$username'
";
$res = $db->query($sql);
$row = $res->fetchObject();
$userID = $row->id;
$sql = "
SELECT
Name, Value
FROM
${DB_TABLE_PREFIX}user_attributes
WHERE
UserID = '$userID'
";
$res = $db->query($sql);
$userPhone = "Unavailable";
$userEmail = "Unavailable";
while ($row = $res->fetchObject()) {
if ($row->name == "SMRadius-Notify-Phone") {
$userPhone = $row->value;
}
if ($row->name == "SMRadius-Notify-Email") {
$userEmail = $row->value;
}
}
# If we want to update email address
if (isset($_POST['notifyMethodEmail']) && !empty($_POST['notifyMethodEmail'])) {
$db->beginTransaction();
# Unavailble if no email address is set yet
if ($userEmail == "Unavailable") {
# Prepare to insert email address for the first time
$emailStatement = $db->prepare("INSERT INTO
${DB_TABLE_PREFIX}user_attributes (UserID,Name,Operator,Value)
VALUES
('$userID','SMRadius-Notify-Email','=*',?)
");
$emailResult = $emailStatement->execute(array($_POST['notifyMethodEmail'],));
# If successful, commit
if ($emailResult) {
$db->commit();
echo "<center>Email address updated</center>";
# Else, rollback changes and give error
} else {
$db->rollback();
echo "<center>Error updating email address, please contact your ISP.</center>";
}
} else {
# Prepare to update existing email address
$emailStatement = $db->prepare("UPDATE
${DB_TABLE_PREFIX}user_attributes
SET
Value = ?
WHERE
Name = 'SMRadius-Notify-Email'
AND
UserID = '$userID'
");
$emailResult = $emailStatement->execute(array($_POST['notifyMethodEmail'],));
# If successful, commit
if ($emailResult) {
$db->commit();
echo "<center>Email address updated</center>";
# Else, rollback changes and give error
} else {
$db->rollback();
echo "<center>Error updating email address, please contact your ISP.</center>";
}
}
}
# If we want to update phone number
if (isset($_POST['notifyMethodCell']) && !empty($_POST['notifyMethodCell'])) {
$db->beginTransaction();
# Unavailable if there is none found for this user
if ($userPhone == "Unavailable") {
# Prepare to insert first number
$phoneStatement = $db->prepare("INSERT INTO
${DB_TABLE_PREFIX}user_attributes (UserID,Name,Operator,Value)
VALUES
('$userID','SMRadius-Notify-Phone','=*',?)
");
$phoneResult = $phoneStatement->execute(array($_POST['notifyMethodCell'],));
# If successful, commit
if ($phoneResult) {
$db->commit();
echo "<center>Mobile phone number updated</center>";
# Else, rollback changes and give error
} else {
$db->rollback();
echo "<center>Error updating mobile phone number, please contact your ISP.</center>";
}
} else {
# Prepare to update existing number
$phoneStatement = $db->prepare("UPDATE
${DB_TABLE_PREFIX}user_attributes
SET
Value = ?
WHERE
Name = 'SMRadius-Notify-Phone'
AND
UserID = '$userID'
");
$phoneResult = $phoneStatement->execute(array($_POST['notifyMethodPhone'],));
# If successful, commit
if ($emailResult) {
$db->commit();
echo "<center>Mobile phone number updated</center>";
# Else, rollback changes and give error
} else {
$db->rollback();
echo "<center>Error updating mobile phone number, please contact your ISP.</center>";
}
}
}
}
*/
displayDetails
();
# Footer
...
...
This diff is collapsed.
Click to expand it.
webui/user/logs.php
View file @
b659b33b
<?php
# Radius user logs
# Copyright (C) 2007-20
09
, AllWorldIT
# Copyright (C) 2007-20
15
, AllWorldIT
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
...
...
@@ -43,6 +43,16 @@ function displayLogs() {
<p
class=
"middle center"
>
Display logs between
<?php
# Validate dates before sending
if
(
isset
(
$_POST
[
'searchFrom'
]))
{
if
(
!
(
preg_match
(
"/^\d
{
4
}
\-(0[1-9]|1[0-2])\-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/"
,
$_POST
[
'searchFrom'
])))
{
unset
(
$_POST
[
'searchFrom'
]);
}
}
if
(
isset
(
$_POST
[
'searchFrom'
]))
{
$searchFrom
=
date
(
"Y-m-d"
,
strtotime
(
$_POST
[
'searchFrom'
]));
$_POST
[
'searchFrom'
]
=
$searchFrom
;
}
if
(
isset
(
$_POST
[
'searchFrom'
]))
{
?>
<input
type=
"text"
name=
"searchFrom"
size=
"11"
value=
"
<?php
echo
$_POST
[
'searchFrom'
]
?>
"
/>
...
...
@@ -55,6 +65,16 @@ function displayLogs() {
?>
and
<?php
# Validate dates before sending
if
(
isset
(
$_POST
[
'searchTo'
]))
{
if
(
!
(
preg_match
(
"/^\d
{
4
}
\-(0[1-9]|1[0-2])\-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/"
,
$_POST
[
'searchTo'
])))
{
unset
(
$_POST
[
'searchTo'
]);
}
}
if
(
isset
(
$_POST
[
'searchTo'
]))
{
$searchFrom
=
date
(
"Y-m-d"
,
strtotime
(
$_POST
[
'searchTo'
]));
$_POST
[
'searchTo'
]
=
$searchFrom
;
}
if
(
isset
(
$_POST
[
'searchTo'
]))
{
?>
<input
type=
"text"
name=
"searchTo"
size=
"11"
value=
"
<?php
echo
$_POST
[
'searchTo'
]
?>
"
/>
...
...
@@ -95,79 +115,78 @@ function displayLogs() {
$extraSQL
.
=
" AND EventTimestamp <= ?"
;
array_push
(
$extraSQLVals
,
$_POST
[
'searchTo'
]);
#
Query to get all defaul
t
d
at
a
#
Accounting query FIXME nas receive and transmi
t
r
at
es
$sql
=
"
SELECT
EventTimestamp,
CallingStationID,
AcctSessionTime
,
AcctInputOctets
,
AcctInputGigawords
,
AcctOutputOctets
,
AcctOutputGigawords
,
AcctTerminateCause
FROM
${DB_TABLE_PREFIX}accounting
WHERE
EventTimestamp,
CallingStationID,
AcctSessionTime
/ 60 AS AcctSessionTime,
AcctInputOctets
/ 1024 / 1024 +
AcctInputGigawords
* 4096 AS AcctInputMbyte,
AcctOutputOctets
/ 1024 / 1024 +
AcctOutputGigawords
* 4096 AS AcctOutputMbyte,
AcctTerminateCause
FROM
${DB_TABLE_PREFIX}accounting
WHERE
Username = "
.
$db
->
quote
(
$_SESSION
[
'username'
])
.
"
$extraSQL
ORDER BY
EventTimestamp
DESC
"
;
"
;
$res
=
$db
->
prepare
(
$sql
);
$res
->
execute
(
$extraSQLVals
);
# Define totals:
$totalData
=
0
;
$totalInputData
=
0
;
$totalOutputData
=
0
;
$totalSessionTime
=
0
;
# Display logs
$totalInput
=
0
;
$totalOutput
=
0
;
$totalTime
=
0
;
while
(
$row
=
$res
->
fetchObject
())
{
# Input data calculation
$inputDataItem
=
0
;
if
(
isset
(
$row
->
acctinputoctets
)
&&
$row
->
acctinputoctets
>
0
)
{
$inputDataItem
+=
(
$row
->
acctinputoctets
/
1024
)
/
1024
;
$inputData
=
0
;
if
(
isset
(
$row
->
acctinputmbyte
)
&&
$row
->
acctinputmbyte
>
0
)
{
$inputData
+=
$row
->
acctinputmbyte
;
}
if
(
isset
(
$row
->
acctinputgigawords
)
&&
$row
->
acctinputgigawords
>
0
)
{
$inputDataItem
+=
(
$row
->
acctinputgigawords
*
4096
);
}
$totalInputData
+=
$inputDataItem
;
$totalInput
+=
$inputData
;
# Output data calculation
$outputDataItem
=
0
;
if
(
isset
(
$row
->
acctoutputoctets
)
&&
$row
->
acctoutputoctets
>
0
)
{
$outputDataItem
+=
(
$row
->
acctoutputoctets
/
1024
)
/
1024
;
$outputData
=
0
;
if
(
isset
(
$row
->
acctoutputmbyte
)
&&
$row
->
acctoutputmbyte
>
0
)
{
$outputData
+=
$row
->
acctoutputmbyte
;
}
if
(
isset
(
$row
->
acctoutputgigawords
)
&&
$row
->
acctoutputgigawords
>
0
)
{
$outputDataItem
+=
(
$row
->
acctoutputgigawords
*
4096
);
}
$totalOutputData
+=
$outputDataItem
;
$totalData
+=
$totalOutputData
+
$totalInputData
;
$totalOutput
+=
$outputData
;
#
T
ime calculation
$sessionTime
Item
=
0
;
#
Upt
ime calculation
$sessionTime
=
0
;
if
(
isset
(
$row
->
acctsessiontime
)
&&
$row
->
acctsessiontime
>
0
)
{
$sessionTime
Item
+=
(
$row
->
acctsessiontime
-
(
$row
->
acctsessiontime
%
60
))
/
60
;
$sessionTime
+=
$row
->
acctsessiontime
;
}
$totalSessionTime
+=
$sessionTimeItem
;
$totalTime
+=
$sessionTime
;
?>
<tr>
<td
class=
"desc"
>
<?php
echo
$row
->
eventtimestamp
;
?>
</td>
<td
class=
"desc"
>
<?php
echo
$row
->
acct
session
t
ime
;
?>
</td>
<td
class=
"desc"
>
<?php
printf
(
"%.2f"
,
$
session
T
ime
)
;
?>
</td>
<td
class=
"desc"
>
<?php
echo
$row
->
callingstationid
;
?>
</td>
<td
class=
"center desc"
>
<?php
echo
strRadiusTermCode
(
$row
->
acctterminatecause
);
?>
</td>
<td
class=
"center desc"
>
<?php
echo
"NASTransmitRate"
;
?>
</td>
<td
class=
"center desc"
>
<?php
echo
"NASReceiveRate"
;
?>
</td>
<td
class=
"right desc"
>
<?php
printf
(
'%.2f'
,
$inputDataItem
);
?>
</td>
<td
class=
"right desc"
>
<?php
printf
(
'%.2f'
,
$outputDataItem
);
?>
</td>
<td
class=
"center desc"
>
<?php
if
(
isset
(
$row
->
nastransmitrate
))
{
echo
$row
->
nastransmitrate
;
}
?>
</td>
<td
class=
"center desc"
>
<?php
if
(
isset
(
$row
->
nasreceiverate
))
{
echo
$row
->
nasreceiverate
;
}
?>
</td>
<td
class=
"right desc"
>
<?php
printf
(
"%.2f"
,
$inputData
);
?>
</td>
<td
class=
"right desc"
>
<?php
printf
(
"%.2f"
,
$outputData
);
?>
</td>
</tr>
<?php
}
...
...
@@ -178,15 +197,16 @@ function displayLogs() {
</tr>
<?php
}
else
{
$totalTraffic
=
$totalInput
+
$totalOutput
;
?>
<tr>
<td
colspan=
"6"
class=
"right"
>
Sub Total:
</td>
<td
class=
"right desc"
>
<?php
printf
(
'
%.2f
'
,
$totalInput
Data
);
?>
</td>
<td
class=
"right desc"
>
<?php
printf
(
'
%.2f
'
,
$totalOutput
Data
);
?>
</td>
<td
class=
"right desc"
>
<?php
printf
(
"
%.2f
"
,
$totalInput
);
?>
</td>
<td
class=
"right desc"
>
<?php
printf
(
"
%.2f
"
,
$totalOutput
);
?>
</td>
</tr>
<tr>
<td
colspan=
"6"
class=
"right"
>
Total:
</td>
<td
colspan=
"2"
class=
"center desc"
>
<?php
printf
(
'
%.2f
'
,
$total
Data
);
?>
</td>
<td
colspan=
"2"
class=
"center desc"
>
<?php
printf
(
"
%.2f
"
,
$total
Traffic
);
?>
</td>
</tr>
<?php
}
...
...
This diff is collapsed.
Click to expand it.
webui/user/styles.css
View file @
b659b33b
/*
*
* User Control Panel Stylesheet
* Copyright (C) 2007-20
09
, AllWorldIT
* Copyright (C) 2007-20
15
, AllWorldIT
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
...
...
This diff is collapsed.
Click to expand it.
Prev
1
…
6
7
8
9
10
Next