<?php
if(isset($_SESSION['locID']))
$loc = $_SESSION['locID'];
//include("config.inc.php");
echo ('<div id="center">');
echo "<h2>All users currently connected</h2>";
$q1 = "SELECT radacct.UserName, AcctStartTime, NASIPAddress, FramedIPAddress,userinfo.Type,userinfo.BillingPlan FROM radacct,userinfo WHERE radacct.UserName=userinfo.UserName AND AcctStopTime = '0000-00-00 00:00:00' AND LocationID='$loc'";
echo '<table border="1" width="100%" cellpadding=2>';
echo"<tr>";
echo "<td>";
printf('<input type="submit" name="user" class="smallButton" value=" User Name "/>');
echo "</td>";
echo "<td>";
printf('<input type="submit" name="time" class="smallButton" value="Connected"/>');
echo "</td>";
echo "<td>";
printf('<input type="submit" name="used" class="smallButton" value="NAS IP"/>');
echo "</td>";
echo "<td>";
printf('<input type="submit" name="status" class="smallButton" value="User IP"/>');
echo "</td>";
echo "<td>";
printf('<input type="submit" name="status" class="smallButton" value="Billing Plan"/>');
echo "</td>";
echo "<td>";
printf('<input type="submit" name="status" class="smallButton" value="Type"/>');
echo "</td>";
echo "<td></td>";
echo "</tr>";
// Now we querry the database
$result1 = $oreon->database->database->query($q1) or die("Query database error !");
$connections=$oreon->database->database->result_num_rows($result1);
if($connections == 0){ die('No Results');}
while ($row = $oreon->database->database->fetch_object($result1)) {
$array[] = $row;
$username = ($row->UserName);
$startTime = ($row->AcctStartTime);
$nasIP = ($row->NASIPAddress);
$userIP = ($row->FramedIPAddress);
$Type = ($row->Type);
$BillingPlan = ($row->BillingPlan);
// set up shades
if(!isset($shade)) { $shade = 2;}
echo("<tr>");
if($shade == 1) { echo('<td STYLE="background-color: #F2F7FB">'); }
else{ echo('<td STYLE="background-color: #cde5f4">'); }
echo "<form action=\"include/divers/sexyTabs.php\" method=\"post\" target=\"foo\" onsubmit=\"window.open('', 'foo', 'width=800,height=600,status=yes,resizable=yes,scrollbars=yes')\">";
echo("<input type=\"hidden\" name=\"ID\" value=\"$username\">");
echo("<input type=\"submit\" class=\"smallButton\" name=\"UserSelected\" value=\"$username\">");
echo('</form>');
echo("</td><small>");
if($shade == 1) { echo('<td STYLE="background-color: #F2F7FB">'); }
else{ echo('<td STYLE="background-color: #cde5f4">'); }
echo($startTime);
echo("</td>");
if($shade == 1) { echo('<td STYLE="background-color: #F2F7FB">'); }
else{ echo('<td STYLE="background-color: #cde5f4">'); }
echo($nasIP);
echo("</td>");
if($shade == 1) { echo('<td STYLE="background-color: #F2F7FB">'); }
else{ echo('<td STYLE="background-color: #cde5f4">'); }
echo($userIP);
echo("</td>");
if($shade == 1) { echo('<td STYLE="background-color: #F2F7FB">'); }
else{ echo('<td STYLE="background-color: #cde5f4">'); }
echo($BillingPlan);
echo("</td>");
if($shade == 1) { echo('<td STYLE="background-color: #F2F7FB">'); }
else{ echo('<td STYLE="background-color: #cde5f4">'); }
echo($Type);
echo("</td>");
if($shade == 1) { $shade = 2;}else{ $shade = 1; }
echo "<td>";
echo "<form method=\"post\" action=\"include/divers/disconnectunow.php\" target=\"disconnectu\" onsubmit=\"window.open('', 'disconnectu', 'width=400,height=100,status=yes,resizable=yes,scrollbars=yes')\">";
echo("<input type=\"hidden\" name=\"ID\" value=\"$username\">");
echo("<input type=\"hidden\" name=\"type\" value=\"$type\">");
echo("<input type=\"hidden\" name=\"attr\" value=\"$attrr\">");
echo("<input type=\"hidden\" name=\"phpmyprepaid\" value=\"".session_id()."\">");
printf('<input class="image" type="image" value="submit" name="disconnect_user" alt="Disconnect User" title="Disconnect User" src="images/disconnect.png">');
printf('</form>');
echo "</td>";
echo "</tr>";
}
echo "</table>";
echo ('</div>');
?>