Location: PHPKode > projects > Total ISP > total-isp/callweekall.php
<?include "./auth.inc.php";
if (!$n)

if (!$order)

if (!$type)

if (!$year)

if ($archive)
        $radacct = 'radacctarchive';
        $radacct = 'radacct';


function weekofyear() {
        $d = 1;
        while (date("w",mktime(0,0,0,1,$d,date("Y"))) != 1) {

if (!$week)

<BODY bgcolor=white>
<P><SELECT NAME=order><option value="top"<?
	if ($order=='top')
		print " selected";
<option value="bottom""<?
        if ($order=='bottom')
                print " selected";
<INPUT TYPE=TEXT SIZE=4 NAME=n value="<? echo $n ?>"> 

<SELECT NAME="type">
<option value="bytes"<? if ($type=='bytes') print " SELECTED"; ?>>Downloaders</option>
<option value="ibytes"<? if ($type=='ibytes') print " SELECTED"; ?>>Uploaders</option>
<option value="atime"<? if ($type=='atime') print " SELECTED"; ?>>Time Users</option>
<option value="calls"<? if ($type=='calls') print " SELECTED"; ?>>Callers</option>

for Week
<INPUT TYPE=TEXT Name=week SIZE=2 VALUE="<? echo $week ?>">

<SELECT NAME="year">
<option value="1998"<? if ($year=='1998') print " selected"; ?>>1998</option>
<option value="1999"<? if ($year=='1999') print " selected"; ?>>1999</option>
<option value="2000"<? if ($year=='2000') print " selected"; ?>>2000</option>
<option value="2001"<? if ($year=='2001') print " selected"; ?>>2001</option>

<input type=checkbox name=recentpay <? if ($recentpay) print "checked"; ?>>

include "./hms.inc.php";
include "./mysql.inc.php";

if ($order=='top')

$sql="SELECT UserName, sum(AcctOutputOctets) as bytes,
sum(AcctSessionTime) as atime, sum(AcctInputOctets) as ibytes, count(UserName) as calls, AccountType 
FROM $radacct, SubAccounts WHERE WeekNumber=$week AND YEAR(realtime)=$year And Login=UserName GROUP BY UserName ORDER BY
$type $DESC
LIMIT $n";

?><TABLE border=1>
<TR><TH>UserName</TH><TH>Account Type</TH><TH>MB Out</TH><TH>Time</TH><TH>%33.6</TH><TH>Mb In</TH><TH>Calls</TH>
<? if ($recentpay) print "<TD>Days since last Payment</TD>"; ?>
while ($row=mysql_fetch_row($result)){
	print "<TR>";
	print "<TD><A HREF=\"jump.php?username=$row[0]\">$row[0]</A></TD>";
	print "<TD>$row[5]</TD><TD>";
	if ($row[1] > $red)
		print "<FONT COLOR=RED>";
	print intval($row[1]/1000000);
	print "</TD><TD>";
	print hhms($row[2]);
	print "</TD><TD>";
	if ($row[2])
	if ($percent>40)
		print "<FONT COLOR=RED>";
	print $percent." %";
	if ($row[1])
	printf("<FONT SIZE=-2> (%01.2f)",$row[3]/$row[1]);
	print "</TD><TD>";
	print intval($row[3]/1000000);
	print "</TD><TD>";
	print $row[4];
	print "</TD>";
	if ($recentpay){
		#look for payments in the last week?
		$psql = "SELECT TO_DAYS(now())-TO_DAYS(PaymentDate), Purchase FROM Payments, SubAccounts 
		WHERE SubAccounts.CustomerID=Payments.CustomerID
		AND Login='$row[0]' ORDER BY PaymentDate DESC LIMIT 1";
		$pres = mysql_query($psql);
		#print mysql_error();
		if (mysql_num_rows($pres)){
			$ndays = mysql_result($pres,0);
			print "<TD>";
			if ($ndays < 9)
				print "($ndays) ".mysql_result($pres,0,1);
				print $ndays;
			print "</TD>";
	print "</TR>";


<A HREF="cvimage.php?week=<? echo $week ?>">See Call Volume Graph</A> 


Return current item: Total ISP