<?php
/* This file is used to display all cards that have been created
It is expected that in production, this feature will be rather
useless because of the number of accounts that will build up
over time. Some sort of method for clearing old accounts will
need to be implemented. For now, AllCards is the first step
in building a reporting system.
This file Trappe Vincent 2006 and released under the GPL.
If you didn't get a copy of the GPL with this, do a search for
GPL and find it your self. Remember, I copyrighted this so if
you are using it you better have a license to use it. GPl
works for me.
//////////////////////////////////////////////////////////
// THIS SCRIPT DISPLAYS ACCOUNTS FOR A LOCATION //
// First we pull the session location ID and then //
// use it to pull the correct cards. //
// we use the button ID to figure out which type //
// of cards we want to pull //
//////////////////////////////////////////////////////////
*/
include_once('config.inc.php');
if (check_access($oreon,'1')) {
if (isset ($msg))
{
unset ($msg);
}
if (isset ($_SESSION['locID']))
{
$loc = $_SESSION['locID'];
}
$LocName = $_SESSION['LocName'];
if (!isset ($buttonID))
{
$msg = "$msg <p class=\"error\">No button ID was sent</p>"; // this shouldn't happen
}
if (!isset ($msg))
{ // no errors? ... hit it. Need to reset button id
?><script type="text/javascript" >
function sendButton(button)
{
var j=0;
var tab=new Array();
var form=document.getElementById('event_id');
var str='';
var str2='';
var strf='';
for (var i = 0; i < form.length; i++) {
if (form[i].checked) {
tab[j]=form[i].value;
str+=form[i].value+',';
j++;
}
}
strf=str.substring(0,str.length-1);
if (button.name=='print_html')
{
formau=document.getElementById('print_form_html');
str2='<input type="hidden" name="id" value="'+strf+'">';
document.getElementById('tab_acct_html').innerHTML=str2;
formau.submit();
}
if (button.name=='print_pdf')
{
formau=document.getElementById('print_form_pdf');
str2='<input type="hidden" name="id" value="'+strf+'">';
document.getElementById('tab_acct_pdf').innerHTML=str2;
formau.submit();
}
if (button.name=='print_cards')
{
formau=document.getElementById('print_form_cards');
str2='<input type="hidden" name="id" value="'+strf+'">';
document.getElementById('tab_acct_cards').innerHTML=str2;
formau.submit();
}
if (button.name=='add_unit')
{
formau=document.getElementById('add_unit_form');
str2='<input type="hidden" name="id" value="'+strf+'">';
document.getElementById('tab_acct').innerHTML=str2;
formau.submit();
}
if (button.name=='delete_btn')
{
var text=file('include/divers/delete_accts.php?id='+strf);
alert(text);
form.submit();
}
}
function toggleCheck (element, name)
{
var form = document.getElementById('event_id');
//var form = element.form;
var checked = element.checked;
for (var i = 0; i < form.length; i++)
if (form[i].name.indexOf (name) == 0)
form[i].checked = !form[i].checked;
//form.delete_btn.disabled = !checked;
document.getElementById('delete_btn').disabled = !checked;
document.getElementById('add_unit').disabled = !checked;
document.getElementById('print_pdf').disabled = !checked;
document.getElementById('print_html').disabled = !checked;
document.getElementById('print_cards').disabled = !checked;
}
function configureButton (element, name)
{
var form = document.getElementById('event_id');
var checked = element.checked;
if (!checked)
{
for (var i = 0; i < form.length; i++)
{
if (form.elements[i].name.indexOf (name) == 0)
{
if (form.elements[i].checked)
{
checked = true;
break;
}
}
}
}
if (!element.checked) {
tc=document.getElementById('toggle_check');
tc.checked = false;
}
document.getElementById('delete_btn').disabled = !checked;
document.getElementById('print_pdf').disabled = !checked;
document.getElementById('print_html').disabled = !checked;
document.getElementById('print_cards').disabled = !checked;
document.getElementById('add_unit').disabled = !checked;
}
</script>
<?
if (isset ($_POST['userdelete']))
delete_user ($_POST['userdelete']);
if (isset ($_POST['limit_view']))
$limit = $limit_view = $_POST['limit_view'];
else if (isset ($_GET['limit_view']))
$limit = $limit_view = $_GET['limit_view'];
else
{
$limit = $limit_view = 10;
} // <-- Hook for later feature
if (isset ($_GET['bpcname']))
$bpname = $_GET['bpcname'];
if ($debug) print "<br> OCTET TYPE ". $octet_type;
$tab = getaccountvalueButton ($buttonID, $octet_type);
$db = $tab['db'];
$exp = $tab['exp'];
$type = $tab['type'];
$attr = $tab['attr'];
$attrr = $tab['attrr'];
$exp = $tab['exp'];
// Moving through pages now works even when sorted. FIXED - SWong
// Retrieve GET data from next/previous buttons
if (isset ($_GET['s']))
{
$s = $_GET['s'];
}
if (isset ($_GET['so']))
{
$so = $_GET['so'];
}
// Default to sorting by UserName else set to previous
if (!isset ($so))
{
$sort = "UserName";
}
else
{
$sort = $so;
}
// Change the sort order if the user selected a column heading
if (isset ($_POST['FirstName']))
{
$sort = 'FirstName';
}
if (isset ($_POST['LastName']))
{
$sort = 'LastName';
}
if (isset ($_POST['used']))
{
$sort = 'TotalSessionTime';
}
if (isset ($_POST['CrDate']))
{
$sort = 'CrDate';
}
if (isset ($_POST['UserName']))
{
$sort = 'UserName';
} // all this needs to be fixed
// Update current sort order
$so = $sort;
if (isset ($_POST['findAccountName']))
$username = $_POST['findAccountName'];
if (isset ($_POST['billing_plan_select']))
$bpname = $_POST['billing_plan_select'];
if (isset ($_POST['activate']))
$activate = $_POST['activate'];
if (isset ($_GET['radiusprofile'])) {
$radiusprofile = $_GET['radiusprofile_select'];
if ($radiusprofile != 'All' and $radiusprofile!='')
$radiusprofileq = " AND RadiusProfile='".get_radiusprofile_id($radiusprofile)."'";
}
if (isset ($_GET['group'])) {
$group = $_GET['group'];
$groupdb='';
$groupq='';
$groupj='';
if ($group != 'All' and $group!='') {
$groupdb=",usergroup";
$groupq = " AND usergroup.GroupName='".$_GET['group']."' ";
$groupj = " AND usergroup.UserName=userinfo.UserName ";
}
}
if (isset ($_POST['radiusprofile_select'])) {
$radiusprofile = $_POST['radiusprofile_select'];
if ($radiusprofile != 'All' and $radiusprofile!='')
$radiusprofileq = " AND RadiusProfile='".get_radiusprofile_id($radiusprofile)."'";
}
if (isset ($_POST['group_select'])) {
$group = $_POST['group_select'];
$groupdb='';
$groupq='';
$groupj='';
if ($group != 'All') {
$groupdb=",usergroup";
$groupq = " AND usergroup.GroupName='".$_POST['group_select']."' ";
$groupj = " AND usergroup.UserName=userinfo.UserName ";
}
}
if (isset ($_POST['crdate_select']))
{
$crdate = $_POST['crdate_select'];
if ($crdate == 'All')
$crdatedata = "";
else
$crdatedata = " AND CrDate='$crdate'";
}
else if ($_GET['crdate_select'])
{
$crdate = $_GET['crdate_select'];
if ($crdate == 'All')
$crdatedata = "";
else
$crdatedata = " AND CrDate='$crdate'";
}
//////////////////////////////////////////////////////////////////
//USEFUL BUTTON
//////////////////////////////////////////////////////////////////
echo "All $type Accounts listed for $LocName <br><br> ";
echo "<table width=100%>";
echo ('<tr >');
echo ('<form name="cfbp" action="phpmyprepaid.php" method="post">');
echo ("<input type=\"hidden\" name=\"buttonID\" value='$buttonID'>");
echo ("<input type=\"hidden\" name=\"actionf\" value=\"billing_plan\">");
echo ('<td width="100" style="text-align: left">');
if (isset ($username))
echo
"<input type=text size=17 class=text value=\"$username\" name=\"findAccountName\">";
else
echo
"<input type=text size=17 class=text value=\"\" name=\"findAccountName\">";
echo ('</td>');
echo (' <td style="height: 33px; width: 33px; text-align: left;">
<input class="image" name="FindAccount" alt="Find account" title="Find account" src="images/search.png" value="" height="25" type="image">');
echo ("<input type=\"hidden\" name=\"buttonID\" value='$buttonID'>");
echo '</td><td style="width=100px; text-align: right">Display view :';
echo ('</td>');
echo ('<td style="text-align: left">');
$tab = array ('10', '20', '30', '50', '100', '150', '300', 'All');
echo '<select name="limit_view" onChange="document.cfbp.submit();">';
for ($i = 0; $i < sizeof ($tab); $i++)
if ($limit_view == $tab[$i])
echo '<option "selected" value="'.$tab[$i].'">'.$tab[$i].'</option>';
else
echo '<option value="'.$tab[$i].'">'.$tab[$i].'</option>';
echo ('</select>');
echo ('</td></tr></table>');
echo ('<table><tr><td width="170">');
echo ' Billing plan :';
echo ('</td>');
echo ('<td width="200" style="align: left;">');
echo
'<select name="billing_plan_select" onChange="document.cfbp.submit();">';
$q1 = "select Id,NameBp,TimeBp,PriceBp,TypeBp,CurrencyBp From BillingPlan WHERE LocationID='".$_SESSION['locID']."' ORDER BY NameBp"; // get all the timed cards
$result = $oreon->database->database->query ($q1);
if ($bpname == '' or $bpname == 'All')
echo '<option "selected" value="All">All';
else
echo '<option value="All">All';
echo '</option>';
while ($row = $oreon->database->database->fetch_object ($result))
{
if ($row->NameBp == $bpname)
echo '<option "selected" value="'.$row->NameBp.'">'.$row->NameBp;
else
echo '<option value="'.$row->NameBp.'">'.$row->NameBp;
echo '</option>';
}
echo ('</select>');
echo ('</td>');
echo ('<td>');
echo ('<td >');
echo 'Creation date :';
echo ('</td>');
echo ('<td style="text-align: left;">');
$result2 =$oreon->database->database->query ("SELECT CrDate From userinfo Where LocationID='".$_SESSION['locID']."' GROUP BY CrDate ORDER BY CrDate");
echo '<select name="crdate_select" onChange="document.cfbp.submit();">';
if ($crdate == '' or $crdate == 'All')
echo '<option "selected" value="All">All</option>';
else
echo '<option value="All">All</option>';
while ($row = $oreon->database->database->fetch_object ($result2))
{
if ($row->CrDate == $crdate)
echo '<option "selected" value="'.$row->CrDate.'">'.$row->CrDate.
'</option>';
else
echo '<option value="'.$row->CrDate.'">'.$row->CrDate.'</option>';
}
echo ('</select>');
echo ('</td></tr></table>');
echo ('<table><tr><td width="170">');
echo ' Radius Profile :';
echo ('</td>');
echo ('<td width="200" style="align: left;">');
echo '<select name="radiusprofile_select" onChange="document.cfbp.submit();">';
$q1 = "select id,RadiusProfileName From radiusprofile WHERE location_id='".$_SESSION['locID']."' GROUP BY RadiusProfileName ORDER BY RadiusProfileName"; // get all the timed cards
$result = $oreon->database->database->query ($q1);
if ($radiusprofile == '' or $radiusprofile == 'All')
echo '<option "selected" value="All">All';
else
echo '<option value="All">All';
echo '</option>';
while ($row = $oreon->database->database->fetch_object ($result))
{
if ($row->RadiusProfileName == $radiusprofile)
echo '<option "selected" value="'.$row->RadiusProfileName.'">'.$row->RadiusProfileName;
else
echo '<option value="'.$row->RadiusProfileName.'">'.$row->RadiusProfileName;
echo '</option>';
}
echo ('</select>');
echo ('</td>');
echo ('<td >');
echo 'Group :';
echo ('</td>');
echo ('<td style="text-align: left;">');
$result2=$oreon->database->database->query("SELECT ID,gp_name FROM group_template WHERE location_id='".$_SESSION['locID']."'");
echo '<select name="group_select" onChange="document.cfbp.submit();">';
if ($group == '' or $group == 'All')
echo '<option "selected" value="All">All</option>';
else
echo '<option value="All">All</option>';
while ($row = $oreon->database->database->fetch_object ($result2))
{
if ($row->gp_name == $group)
echo '<option "selected" value="'.$row->gp_name.'">'.$row->gp_name.
'</option>';
else
echo '<option value="'.$row->gp_name.'">'.$row->gp_name.'</option>';
}
echo ('</select>');
echo ('</td></tr></table>');
echo ('<table width=100%><tr><td width="170">');
if ($activate == '-1')
{
$activatedata = "";
echo
'<input type="radio" checked name="activate" value="-1" onChange="document.cfbp.submit();"> All ';
}
else
echo
'<input type="radio" checked name="activate" value="-1" onChange="document.cfbp.submit();"> All ';
if ($activate == '1')
{
$activatedata = " AND activated='1' ";
echo
'<input checked type="radio" name="activate" value="1" onChange="document.cfbp.submit();"> Activate';
}
else
echo
'<input type="radio" name="activate" value="1" onChange="document.cfbp.submit();"> Activate';
if ($activate == '0')
{
$activatedata = " AND activated='0' ";
echo
' <input type="radio" checked name="activate" value="0" onChange="document.cfbp.submit();"> Not activate';
}
else
echo
' <input type="radio" name="activate" value="0" onChange="document.cfbp.submit();"> Not activate';
echo ("</table></td></tr>");
echo "</table>";
echo '</form>';
//////////////////////////////////////////////////////////////////
// USED FOR SET THE SORT VALUE
//////////////////////////////////////////////////////////////////
if (!isset ($so))
{
$sort = "UserName";
}
if (isset ($_POST['UserName']))
{
$sort = 'UserName';
} // all this needs to be fixed
if (isset ($_POST['BillingPlan']))
{
$sort = 'BillingPlan';
}
if (isset ($_POST['SessionTime']))
{
$sort = 'AcctSessionTime';
}
//if(isset($_POST['LastName'])) { $sort = 'LastName';} NOT USED ONLY IN SUBSCR
if (isset ($_POST['CrDate']))
{
$sort = 'CrDate';
}
if (isset ($_POST['activeDate']))
{
$sort = 'activeDate';
}
if (isset ($_POST['Value']))
{
$sort = 'Value';
}
if (isset ($_POST['TotalSessionTime']))
{
$sort = 'TotalSessionTime';
}
// if(!isset($so)) { $sort = "UserName"; }
$order = 'ORDER by ';
$groupby = ' GROUP BY userinfo.UserName';
// if(isset($addcr)) { $cr = ', CrDate'; }else{ $cr = NULL; }
if ($bpname != 'All' and $bpname != '')
$bpnamevalue = "AND BillingPlan='".get_plan_Id ($bpname)."'";
else
$bpnamevalue = "";
//////////////////////////////////////////////////////////////
//WE ARE QUERYING THE DATABASE
//////////////////////////////////////////////////////////////
if (isset ($username) and $username != '')
$q1 = "SELECT userinfo.ID,userinfo.UserName, BillingPlan, LastName, CrDate,activeDate,Value FROM $db,userinfo$groupdb WHERE $db.UserName=userinfo.UserName $groupj AND $attr AND LocationID='$loc' AND userinfo.Username REGEXP ('$username') AND Type='$type' $groupq $radiusprofileq $crdatedata $activatedata $bpnamevalue $groupby ORDER BY $sort "; // get all
else
$q1 = "SELECT userinfo.ID,userinfo.UserName, BillingPlan, LastName, CrDate,activeDate,Value FROM $db,userinfo$groupdb WHERE $db.UserName=userinfo.UserName $groupj AND $attr AND LocationID='$loc' AND Type='$type' $groupq $radiusprofileq $crdatedata $activatedata $bpnamevalue $groupby ORDER BY $sort "; // get all
if (empty ($s))
{ // <---- Requires the weird non functional echo above FIXME
$s = 0; // <---- I think an if(!isset($s) might work if we pull the GET
}
//////////////////////////////////////////////////////////////
//DELETE USER AND ADD UNIT
//////////////////////////////////////////////////////////////
echo "<table width=100%><tr><td style=\"text-align: right;\">";
echo "<form method=\"post\" action=\"include/display/add_unit.php\" id=\"add_unit_form\" target=\"addunit\" onsubmit=\"window.open('', 'addunit', 'width=400,height=100,status=yes,resizable=yes,scrollbars=yes')\">";
echo ("<input type=\"hidden\" name=\"phpmyprepaid\" value=\"".session_id ()."\">");
echo("<input type=\"hidden\" name=\"type\" value=\"$type\">");
echo("<input type=\"hidden\" name=\"attr\" value=\"$attrr\">");
echo("<input type=\"hidden\" name=\"dbname\" value=\"$db\">");
echo ('<div id="tab_acct"></div>');
printf ('<input class="image" type="image" value="submit" name="add_unit" id="add_unit" disabled alt="Add unit to user" title="Add unit to user" src="images/insertf.png" onClick="sendButton(this)">');
printf ('</form>');
echo "</td>";
echo "<td style=\"text-align: right; width: 24px\">";
echo '<script type="text/javascript">
function confirmDelete( btn) {
if(confirm("Are you sure, you want to delete this user ?" )) sendButton(btn);
return false; //pour ne pas revenir au début de la page
}
</script>';
printf ("<input type=\"hidden\" name=\"buttonID\" value=\"$buttonID\">");
printf ("<input type=\"hidden\" name=\"userdelete\" value=\"$usernametmp\">");
printf ('<input class="image" type="image" class="tdimage" value="submit" name="delete_btn" disabled id="delete_btn" alt="Delete user" title="Delete user" onClick="confirmDelete(this)" src="images/deletef.png" >');
echo "</td>";
echo '</tr></table>';
//////////////////////////////////////////////////////////////////
/////DISPLAY ACCOUNT BEGIN
//////////////////////////////////////////////////////////////////
$result1 = $oreon->database->database->query ($q1) or die ("Query database error !");
$numrows=$oreon->database->database->result_num_rows ($result1);
if ($limit!='All')
$q1.=" LIMIT $s,$limit";
echo "<table border=\"1\" width=\"100%\" >";
echo "<tr>";
?>
<td width=2% class="text" align="center"><input type="checkbox" name="toggle_check" id="toggle_check" value="1" onClick="toggleCheck( this, 'mark_eids' )";></td >
<?php
echo "<td width=20%>";
printf ('<form action="phpmyprepaid.php "method="post">');
printf ("<input type=\"hidden\" name=\"buttonID\" value=\"$buttonID\">");
printf ("<input type=\"hidden\" name=\"so\" value=\"$so\">");
printf ("<input type=\"hidden\" name=\"s\" value=\"$s\">");
printf ("<input type=\"hidden\" name=\"limit\" value=\"$limit\">");
printf ('<input type="submit" name="UserName" class="smallButton" value=" Username "/>');
printf ('</form>');
echo "</td>";
echo "<td width=\"40\">";
printf ('<form action="phpmyprepaid.php "method="post">');
printf ("<input type=\"hidden\" name=\"buttonID\" value=\"$buttonID\">");
printf ("<input type=\"hidden\" name=\"so\" value=\"$so\">");
printf ("<input type=\"hidden\" name=\"s\" value=\"$s\">");
printf ("<input type=\"hidden\" name=\"limit\" value=\"$limit\">");
printf
('<input type="submit" name="BillingPlan" class="smallButton" value="Billing Plan"/>');
printf ('</form>');
echo "</td>";
// echo "<td width=40>";
//REMOVED NOT USEFUL
// printf('<form action="phpmyprepaid.php "method="post">');
// printf("<input type=\"hidden\" name=\"buttonID\" value=\"$buttonID\">");
// printf("<input type=\"hidden\" name=\"so\" value=\"$so\">");
// printf("<input type=\"hidden\" name=\"s\" value=\"$s\">");
// printf('<input type="submit" name="LastName" class="button" value="Last Name"/>');
// printf('</form>');
// echo "</td>";
if ($type != "Divers" and $type != "Subscription Divers")
{
echo "<td width=\"150\">";
printf ('<form action="phpmyprepaid.php "method="post">');
printf ("<input type=\"hidden\" name=\"buttonID\" value=\"$buttonID\">");
printf ("<input type=\"hidden\" name=\"so\" value=\"Value\">");
printf ("<input type=\"hidden\" name=\"s\" value=\"$s\">");
printf ("<input type=\"hidden\" name=\"limit\" value=\"$limit\">");
printf ('<input type="submit" name="Value" class="smallButton" value="Value"/>');
printf ('</form>');
echo "</td>";
}
echo "<td width=\"150\">";
//printf('<form action="phpmyprepaid.php "method="post">');
printf ("<input type=\"hidden\" name=\"buttonID\" value=\"$buttonID\">");
printf ("<input type=\"hidden\" name=\"so\" value=\"TotalSessionTime\">");
printf ("<input type=\"hidden\" name=\"s\" value=\"$s\">");
printf ("<input type=\"hidden\" name=\"limit\" value=\"$limit\">");
printf ('<input type="submit" name="TotalSessionTime" class="smallButton" value="Used"/>');
//printf('</form>');
echo "</td>";
echo "<td width=\"40\">";
printf ('<form action="phpmyprepaid.php "method="post">');
printf ("<input type=\"hidden\" name=\"buttonID\" value=\"$buttonID\">");
printf ("<input type=\"hidden\" name=\"so\" value=\"activateDate\">");
printf ("<input type=\"hidden\" name=\"s\" value=\"$s\">");
printf ("<input type=\"hidden\" name=\"limit\" value=\"$limit\">");
printf ('<input type="submit" name="activeDate" class="smallButton" value="Activate Date "/>');
printf ('</form>');
echo "</td>";
echo "</tr>";
if ($debug) print $q1;
$result1 = $oreon->database->database->query ($q1) or die ("Query database error !");
$count = 1 + $s; // <-- sets the page number
if (isset ($_POST['ID']))
{
$pullUser = $_POST['ID'];
unset ($_POST['ID']);
}
while ($row = $oreon->database->database->fetch_object ($result1))
{
if (!isset ($shade))
{
$shade = 2;
}
$array[] = $row;
$ID = ($row->ID);
$usernametmp = ($row->UserName);
$BillingPlan = get_plan_name (($row->BillingPlan));
$CrDate = ($row->CrDate);
if ($type !="Subscription Mac")
$Value = round (($row->Value));
$activeDate = ($row->activeDate);
echo ("<tr>");
$q2 ="SELECT SUM(AcctSessionTime) as TotalSessionTime,SUM($acctoutputoctetsattr) AS sum_output FROM radacct WHERE UserName='$usernametmp'";
$numresults2 = $oreon->database->database->query ($q2); // <------ FIGURE OUT HOW MANY RESULTS WE ARE PULLING
$numrows2 = $oreon->database->database->result_num_rows ($numresults2);
$res2 = $oreon->database->database->query ($q2) or die ("Query database error !");
$r2 = $oreon->database->database->fetch_object ($res2);
if ($type == "Octets" or $type == "Subscription Octets")
$used = round ($r2->sum_output );
else
$used = round ($r2->TotalSessionTime );
if ($used == '')
$used = '0';
?><form name="event_form" id="event_id" method="post" action="<?= $PHP_SELF ?>"><?
?><td align="center" class="text" ><input type="checkbox" name="mark_eids[]" id="mark_eids_tab[]" value="<?print $usernametmp?>" onClick="configureButton( this, 'mark_eids' );" ></td>
<?
if ($shade == 1)
{
echo ('<td STYLE="background-color: #F2F7FB">');
}
else
{
echo ('<td STYLE="background-color: #cde5f4">');
}
echo ('<input type="button" class="smallButton" name="UserSelected" value="'.$usernametmp.'" onClick="window.open(\'include/divers/sexyTabs.php?phpmyprepaid='.session_id.'&usr='.$usernametmp.'\',\'User informations\',\'width=800,height=600,status=yes,resizable=yes,menubar=yes,scrollbars=yes\');" >');
echo ("</td><small>");
if ($shade == 1)
{
echo ('<td STYLE="background-color: #F2F7FB"><small>');
}
else
{
echo ('<td STYLE="background-color: #cde5f4"><small>');
}
echo ($BillingPlan);
echo ("</td>");
//if($shade == 1) { echo('<td STYLE="background-color: #F2F7FB"><small>'); }
//else{ echo('<td STYLE="background-color: #cde5f4"><small>'); }
//echo($LastName);
//echo("</td>");
if ($type == "Subscription Expiration" or $type == "Expiration")
{
$Value = date_from_attribute ($row->Value, $dateFormat);
if ($shade == 1)
{
echo ('<td STYLE="background-color: #F2F7FB"><small>');
}
else
{
echo ('<td STYLE="background-color: #cde5f4"><small>');
}
}
else
{
if ($shade == 1)
{
echo ('<td STYLE="background-color: #F2F7FB"><small>');
}
else
{
echo ('<td STYLE="background-color: #cde5f4" ><small>');
}
}
if ($type == "Hourly" or $type == "Subscription Time")
$Value = time2str ($Value );
else if ($type == "Octets" or $type == "Subscription Octets")
$Value = octets2str ($Value);
echo ("<small>".$Value."</small>");
echo ("</td>");
if ($shade == 1)
{
echo ('<td STYLE="background-color: #F2F7FB"><small>');
}
else
{
echo ('<td STYLE="background-color: #cde5f4" ><small>');
}
if ($type == "Hourly" or $type == "Subscription Time")
$used = time2str ($used );
else if ($type == "Octets" or $type == "Subscription Octets")
$used = octets2str ($used );
else
$used = time2str ($used );
echo "<small>";
echo ($used);
echo "</small>";
echo ("</td>");
if ($shade == 1)
{
echo ('<td STYLE="background-color: #F2F7FB"><small>');
}
else
{
echo ('<td STYLE="background-color: #cde5f4"><small>');
}
//echo($activeDate);
echo "<small>";
echo date_from_attribute ($activeDate, $dateFormat);
echo "</small>";
echo ("</td>");
echo ("</tr>");
if (isset ($pullUser) && $pullUser == $usernametmp)
{
// pullUser($pulluser);
include ('include/divers/pullUser.php');
include ('include/divers/include/divers/sexyTabs.php');
echo ('<tr>');
echo ('<td colspan = 5>');
echo ('</td>');
echo ('</tr>');
unset ($pullUser);
}
$count++; // <--- adds 0ne to the page number
if ($shade == 2)
{
$shade = 1;
}
else
{
$shade = 2;
}
}
if ($limit!='All')
$currPage = (($s / $limit) + 1);
echo "</table></form><br>";
//////////////////////////////////////////////////////////////////
// SET UP THE REST OF THE RESULTS PAGES //
// Some of this code once came from an online tutorial //
// I used when I was building a website. I will find //
// The author later or re-write. CP //
//////////////////////////////////////////////////////////////////
if ($limit!='All') {
if ($s >= 1)
{ // <---- Don't need a back button if this is the first page
$prevs = ($s - $limit);
print
" <a href=\"phpmyprepaid.php?&so=$sort&limit_view=$limit&s=$prevs&buttonID=$buttonID&crdate=$crdate&group=$group&radiusprofile=$radiusprofile&bpcname=$bpname&actionf=$actionf&username=$username\"><img src=\"images/leftarrow.png\" title=\"Previous $limit\"></a>";
}
$pages = intval ($numrows / $limit); // <--This figures out how many pages we have
// $pages now contains int of pages needed unless there is a remainder from division
if ($numrows % $limit)
{
// has remainder so add one page
$pages++;
}
// check to see if last pagea
if (($pages != 0) && !((($s + $limit) / $limit) == $pages) && $pages != 1)
{
// not last page so give NEXT link
$next = $s + $limit;
echo
" <a href=\"phpmyprepaid.php?&so=$sort&s=$next&limit_view=$limit&crdate=$crdate&group=$group&radiusprofile=$radiusprofile&buttonID=$buttonID&bpcname=$bpname&actionf=$actionf&username=$username\"><img src=\"images/rightarrow.png\" title=\"Next $limit\"></a>";
$a = $s + ($limit);
}
if ($a > $numrows)
{
$a = $numrows;
}
}
if ($numrows == 0)
{
$b = 0;
echo "<br><br><p> No result to display.</p>";
}
else
{
$b = $s + 1;
echo "<br><br><p>Showing results $b to $a of $numrows</p>";
echo "<table width=100%><tr><td width=13% style=\"text-align: left;\">";
echo "<b> Print html : ";
echo "</td>";
echo "<td>";
echo "<form method=\"post\" action=\"include/display/printListUserHTML.php\" id=\"print_form_html\" target=\"Print html\" >";
echo ("<input type=\"hidden\" name=\"phpmyprepaid\" value=\"".session_id ()."\">");
echo("<input type=\"hidden\" name=\"type\" value=\"$type\">");
echo("<input type=\"hidden\" name=\"attr\" value=\"$attrr\">");
echo("<input type=\"hidden\" name=\"db\" value=\"$db\">");
echo ('<div id="tab_acct_html"></div>');
printf ('<input class="image" type="image" value="submit" name="print_html" id="print_html" disabled alt="Print html" title="Print html" src="images/html.png" onClick="sendButton(this)">');
printf ('</form>');
echo "</td>";
echo "<td width=13% style=\"text-align: left;\"><b> Print PDF: ";
echo "</td>";
echo "<td>";
echo "<form method=\"post\" action=\"include/display/printListUserPDF.php\" id=\"print_form_pdf\" target=\"Print pdf\" >";
echo ("<input type=\"hidden\" name=\"phpmyprepaid\" value=\"".session_id ()."\">");
echo("<input type=\"hidden\" name=\"type\" value=\"$type\">");
echo("<input type=\"hidden\" name=\"attr\" value=\"$attrr\">");
echo("<input type=\"hidden\" name=\"db\" value=\"$db\">");
echo ('<div id="tab_acct_pdf"></div>');
printf ('<input class="image" type="image" value="submit" name="print_pdf" id="print_pdf" disabled alt="Print pdf" title="Print pdf" src="images/pdf.png" onClick="sendButton(this)">');
printf ('</form>');
echo "</td>";
echo "<td width=14% style=\"text-align: left;\"><b> Print Cards : ";
echo "</td>";
echo "<td width=5% style=\"text-align: left;\">";
echo "<form method=\"post\" action=\"include/display/printListUserCards.php\" id=\"print_form_cards\" target=\"Print cards\" >";
echo ("<input type=\"hidden\" name=\"phpmyprepaid\" value=\"".session_id ()."\">");
echo("<input type=\"hidden\" name=\"type\" value=\"$type\">");
echo("<input type=\"hidden\" name=\"attr\" value=\"$attrr\">");
echo("<input type=\"hidden\" name=\"db\" value=\"$db\">");
echo ('<div id="tab_acct_cards"></div>');
printf ('<input class="image" type="image" value="submit" name="print_cards" id="print_cards" disabled alt="Print cards" title="Print cards" src="images/tpl.png" onClick="sendButton(this)">');
echo "</td>";
echo "<td style=\"text-align: left;\">";
get_template_html($default_tpl,$loc);
echo "</td>";
printf ('</form>');
echo "</tr>";
echo "</table>";
//printfckhref ("", $buttonID, $sort, $loc, $username, 'all', $bpname,$crdate, $activate);
}
}
else
{
echo ($msg);
}
}
?>