#!/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 
echo -n "
<script type=\"text/javascript\" src=\"/img/common.js\"></script>
<script languate=\"javascript\">
function Validate(frm)
{
	var ttl = document.getElementsByName(\"ipttl\")[0];
	ttl.value = TrimAll(ttl.value);
	if (ttl.value == \"\" || !IsDigit(ttl.value)) {
		alert(\"ʱ!\");
		ttl.select();
		return false;
	}
	if (ttl.value < 60) {
		alert(\"ʱ䲻С60!\");
		ttl.select();
		return false;
	}
	return true;
}
</script>
"; 
if [ "${REQUEST_METHOD}" = "POST" ]; then
	errmsg=`${FLOWEYE} jflow config jflow_check_ipobj=${CGI_checkip} jflow_ipobj_ttl=${CGI_ipttl}`
	if [ "$?" != "0" ]; then
		afm_dialog_msg "ִ: ${errmsg}"
	else
		afm_dialog_msg "ɹ!"
	fi
fi
for nameval in `${FLOWEYE} jflow stat`
do
	eval "${nameval}"
done
CGI_checkip="${jflow_check_ipobj}"
CGI_ipttl="${jflow_ipobj_ttl}"

echo -n "
<body>
"; cgi_show_title "-->IPͳ" 
echo -n "
<br>
<form method=post onsubmit=\"return Validate(this)\" action=\"/cgi-bin/Setup/ipstat_config\">
<table width=600 border=0 cellspacing=0 cellpadding=3 bgcolor=\"#ffffff\">
<tr id=row1>
	<td width=40></td>
	<td width=150 align=left>IPͳƹ</td>
	<td width=* align=left>
		<select name=checkip value=${CGI_checkip} style=\"width:100\">
		";
			if [ ${CGI_checkip} -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 "
	</td>
</tr>
<tr id=row1>
	<td></td>
        <td align=left>IPʱ</td>
	<td width=* align=left>
		<input type=text name=ipttl style=\"width:100px\" value=\"${CGI_ipttl}\"></input>&nbsp;(,ϵͳԶɾʱ䳬ֵIP)</td>
</tr>
</table>
<table style=\"width:600; border-bottom:1px #787882 solid; color:#0000ff\">
<tr><td align=right>&nbsp;</td></tr>
</table>
<table style=\"width:600\"> 
<tr>
        <td align=right>
		<input type=submit style=\"width:80\" value=\"ύ\"></input>
	</td>
</tr>
</table>
</form>
</body>
</html>
";