<?php
echo "<td class=\"bl\" colspan=2><table border=2 width=540 cellpadding=12 cellspacing=0 bgcolor=\"#666699\" valign=top>
<td class=\"bl\">";
$res = $oreon->database->database->query("DELETE FROM radacct WHERE username='$pullUser' AND acctstoptime = 0 ;");
echo "Successfull delete information for user $pullUser from the database<br>";
$tmp_file = tempnam("/tmp/",'DA');
$comm="echo \"User-Name =".$pullUser."\" | radclient $radius_server:3799 40 $radiussecret". ' >' . $tmp_file." 2>&1";
echo $comm;
//$comm = "radclient" . " $radius_server:3799" . ' 40 ' . $radiussecret. ' >' . $tmp_file;
$fp = popen($comm,"w");
if ($fp)
{
fwrite($fp, "User-Name = $pullUser\n");
pclose($fp);
$reply = file($tmp_file);
unlink($tmp_file);
if (ereg('code 41', $reply[0]))
echo "<b><small>Successful Response from Chillispot user disconnect !!!<br>";
else
echo "<b><small>Unable to disconnect user from chillispot !!!<br>";
array_shift($reply);
if (count($reply))
{
$msg .= "<br><b>Server response:</b><br>\n";
foreach ($reply as $val)
{
$msg .= "<i>$val</i><br>\n";
}
}
}
if ($res)
echo "<b>Successful deleted open sessions from accounting </b><br>\n";
else
echo "<b>Error deleting open sessions for user" .die("Query database error !"). "</b><br>\n";
?>