#!/bin/sh
#This script is created by ssparser automatically. The parser first created by MaoShouyan
printf "Content-type: text/html
Cache-Control: no-cache

"
echo -n "";
. ../common/common.sh 
myself="/cgi-bin/Setup/`basename $0`"

echo -n "
<script type=\"text/javascript\" src=\"/img/common.js\"></script>
<script languate=javascript>
function kickoff(ipaddr, name)
{
        if (confirm(\"ȷҪû?\")) {
                window.location.href = \"${myself}?\" + \"name=\" + name + 
			\"&action=kickoff&ipaddr=\" + ipaddr;
	}
}
</script>
";
if [ "${CGI_action}" = "kickoff" ]; then
        operator_check "${myself}"
        errmsg=`${FLOWEYE} usrinfo logoff ip=${CGI_ipaddr}`
        if [ "$?" != "0" ]; then
		if [ "${errmsg}" = "BINDED" ]; then
			afm_dialog_msg "IP󶨣ǿ!"
		else
                	afm_dialog_msg "ִ:${errmsg}"
		fi
        else
                afm_dialog_msg "ɹ!"
                afm_load_page 0 "${myself}?name=${CGI_name}"
                exit 0
        fi
fi

echo -n "
<body>
"; cgi_show_title "Web֤->û[${CGI_name}]" 
echo -n "
<br>
<table width=580 border=0 cellspacing=1 cellpadding=1>
<tr id=tblhdr height=22>
	<td width=200 align=center>IPַ</td>
	<td width=200 align=center>¼ʱ</td>
        <td width=* align=center></td>
</tr>
";
no=1
idname="row1"
${FLOWEYE} usrauth list name=${CGI_name} showonline=1 | while read type ipaddr name mac birth ttl theothers
do 
echo -n "
	<tr id=\"${idname}\">
	<td align=center>${ipaddr}</td>
	<td align=center>${birth}</td>
	<td align=center>
"; if [ "{type}" = "ad" -o "${type}" = "web" -o "${type}" = "radlogin" ]; then 
echo -n "
	<a style=\"color:#0000ff\" href=\"javascript:kickoff('${ipaddr}', '${CGI_name}')\">ǿ</a></td>
"; else 
echo -n "
	ǿ</td>
"; fi 
echo -n "
	</tr>
";
	no=$((${no} + 1))
	if [ "${idname}" = "row1" ]; then
		idname="row2"
	else
		idname="row1"
	fi
done 
echo -n "
</table>
</body>
</html>
";