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

"
echo -n "";
. ../common/common.sh 
myself="/cgi-bin/Pppoe/`basename $0`"
MOD_TAB_LIST="#/cgi-bin/Pppoe/pppoesvr_config б#/cgi-bin/Pppoe/pppoesvr_list"

echo -n "
<script type=\"text/javascript\" src=\"/img/common.js\"></script>
<script language=\"javascript\">
function beforeCommit(frm)
{
	var keepalive = document.getElementsByName(\"keepalive\")[0];
	var radexptime = document.getElementsByName(\"radexptime\")[0];
	keepalive.value = TrimAll(keepalive.value);
	radexptime.value = TrimAll(radexptime.value);
	return true;
}
function onCancel() 
{
	window.location.href = \"${returl}\";
}
</script>
";
fail=0
if [ "${REQUEST_METHOD}" = "POST" ]; then
	cmdargs="${cmdargs} enable=${CGI_enable} keepalive=${CGI_keepalive}"
	cmdargs="${cmdargs} radexptime=${CGI_radexptime}"
	cmdargs="${cmdargs} ignorecache=${CGI_ignorecache}"
	cmdargs="${cmdargs} auto_macbind=${CGI_auto_macbind}"
	errmsg=`${FLOWEYE} pppoesvr config ${cmdargs}`
	if [ "$?" != "0" ]; then 
		afm_dialog_msg "ʧ:${errmsg}"
	fi
fi
if [ ${fail} -eq 0 ]; then 
	for nameval in `${FLOWEYE} pppoesvr stat`
	do
		eval "CGI_${nameval}"
	done
	[ "${CGI_radexptime}" = "0" ] && CGI_radexptime=600
	[ "${CGI_auto_macbind}" = "" ] && CGI_auto_macbind=0
fi

echo -n "
<body>
"; cgi_show_title "PPPOE֤->" 
echo -n "
<br>
<form method=post onsubmit=\"return beforeCommit(this)\" action=\"${myself}\">
<table width=700 border=0 cellspacing=0 cellpadding=3 bgcolor=\"#ffffff\">
<tr id=row1>
	<td width=10></td>
	<td width=120 align=left>PPPOE</td>
	<td width=* align=left>
		<select name=enable value=\"${CGI_enable}\" style=\"width:100\">
		";
			if [ ${CGI_enable} -eq 0 ]; then
				echo "<option value=1></option>"
				echo "<option value=0 selected></option>" 
			else 
				echo "<option value=1 selected></option>"
				echo "<option value=0></option>" 
			fi
		
echo -n "
		</select>
	</td>
</tr>
<tr id=row1>
	<td width=20></td>
	<td width=120 align=left></td>
	<td width=* align=left>
		<select name=ignorecache value=\"${CGI_ignorecache}\" style=\"width:100\">
		";
			if [ ${CGI_ignorecache} -eq 0 ]; then
				echo "<option value=1></option>"
				echo "<option value=0 selected></option>" 
			else 
				echo "<option value=1 selected></option>"
				echo "<option value=0></option>" 
			fi
		
echo -n "
		</select>&nbsp;(ʹûǣʱЧ)
	</td>
</tr>
<tr id=row1>
	<td width=20></td>
	<td width=120 align=left>MACԶ</td>
	<td width=* align=left>
		<select name=auto_macbind value=\"${CGI_auto_macbind}\" style=\"width:100\">
		";
			if [ "${CGI_auto_macbind}" = "1" ]; then
				echo "<option value=0></option>"
				echo "<option value=1 selected></option>" 
			else
				echo "<option value=0 selected></option>"
				echo "<option value=1></option>" 
			fi
		
echo -n "
		</select>&nbsp;(ѡԱ˺,ãڵһε½ʱԶMAC˺)
	</td>
</tr>
<tr id=row1>
	<td width=20></td>
	<td width=120 align=left>ͻ</td>
	<td width=* align=left><input type=text name=keepalive style=\"width:100\" value=${CGI_keepalive}></input>&nbsp;(,0ʾ)</td>
</tr>
<tr id=row1>
        <td width=20></td>
        <td width=120 align=left>ûʱ</td>
        <td width=* align=left><input type=text name=radexptime style=\"width:100\" value=${CGI_radexptime}></input>&nbsp;(,RADIUS֤ûںߵʱ)</td>
</tr>
</table>
<table style=\"width:700; border-bottom:1px #787882 solid; color:#0000ff\">
<tr><td align=right>&nbsp;</td></tr>
</table>
<table style=\"width:700\"> 
<tr><td align=right><input type=submit style=\"width:80\" value=\"ύ\" /></td></tr>
</table>
</form>
</body>
</html>
";