#!/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`"
returl="/cgi-bin/Pppoe/ippool_list"

echo -n "
<script type=\"text/javascript\" src=\"/img/common.js\"></script>
<script language=\"javascript\">
function beforeAddProxy(frm)
{
	var name  = document.getElementsByName(\"name\")[0];
	var start = document.getElementsByName(\"start\")[0];
	var end   = document.getElementsByName(\"end\")[0];
	name.value = TrimAll(name.value);
	if (!IsName(name.value)) {
		alert(\"в&ַ!\");
		ifname.select();
		return false;
	}
	start.value = TrimAll(start.value);
	if (!IsIPAddr(start.value)) {
		alert(\"ʼַ!\");
		start.select();
		return false;
	}
	end.value = TrimAll(end.value);
	if (!IsIPAddr(end.value)) {
		alert(\"ַ!\");
		end.select();
		return false;
	}
	return true;
}
function onCancel() 
{
	window.location.href = \"${returl}\";
}
</script>
";
if [ "${REQUEST_METHOD}" = "POST" ]; then
	operator_check "${myself}"
	errmsg=`${FLOWEYE} pppoeippool set id=${CGI_id} name=${CGI_name} start=${CGI_start} end=${CGI_end}`
	if [ "$?" != "0" ]; then
		afm_dialog_msg "ʧ:${errmsg}"
	else
		afm_load_page 0 "${returl}"
		exit 0
	fi
fi

echo -n "
<body>
"; cgi_show_title "PPPOE->û->˺" 
echo -n "
<br>
<form method=post onsubmit=\"return beforeAddProxy(this)\" action=\"${myself}\">
<table style=\"font:14px\" width=600 border=0 cellspacing=0 cellpadding=3 bgcolor=\"#ffffff\">
<tr id=row1>
	<td width=40></td>
        <td width=80 align=left>˺</td>
	<td width=*  align=left><input type=text name=name style=\"width:120px\" value=\"${CGI_name}\" />&nbsp;(30Ӣַ)
</tr>
<tr id=row1>
	<td width=40></td>
        <td width=80 align=left>˺</td>
	<td width=*  align=left><input type=password name=passwd1 style=\"width:120px\" value=\"${CGI_passwd1}\" />&nbsp;(30Ӣַ)
</tr>
<tr id=row1>
	<td width=40></td>
        <td width=80 align=left></td>
	<td width=*  align=left><input type=password name=passwd2 style=\"width:120px\" value=\"${CGI_passwd2}\" />&nbsp;(30Ӣַ)
</tr>
<tr id=row1>
	<td width=40></td>
        <td width=80 align=left>ע</td>
	<td width=*  align=left><input type=text name=memo style=\"width:400\" value=\"${CGI_memo}\" />
</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=hidden name=id value=\"${CGI_id}\" />
		<input type=submit id=newbtn value=\"ύ\"></input>
		<input type=button id=newbtn value=\"ȡ\" onclick=\"onCancel()\"></input>
	</td>
</tr>
</table>
</form>
</body>
</html>
";