<%@ page language="C#" masterpagefile="~/SiteServer/MasterPage/PageTemplate.Master" autoeventwireup="true" inherits="SiteServer_CheckIp_IpConfig, v5star.Web" title="Untitled Page" theme="Default" %>

<asp:Content ID="Content1" ContentPlaceHolderID="PageBody" runat="Server">
    <style type="text/css">
.textiploghidden
{
    border-right: 2px;
    border-top: 2px;
    font-size: 12px;
    border-left: 2px;
    width: 30px;
    color: #ffffff;
    border-bottom: 2px;
    font-family: sans-serif;
    height: 22px;
    border: 1 solid #000000;
    background-color:White;
}
.textipinput
{
    border-right: 0px;
    border-top: 0px;
    font-size: 11px;
    border-left: 0px;
    width: 30px;
    color: #000000;
    border-bottom: 0px;
    font-family: sans-serif;
    height: 19px;
    background-color: #ffffff;
    text-align: center;
}

</style>
    <aspx:HeadMenuWebControls ID="HeadMenuWebControls1" runat="server" HeadOPTxt="编辑"
        HeadTitleTxt="访问IP管理">
    </aspx:HeadMenuWebControls>
    <aspx:TabOptionWebControls ID="TabOptionWebControls1" runat="server">
        <aspx:TabOptionItem ID="TabOptionItem1" runat="server" Tab_Name="访问规则列表">
            <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" Width="100%"
                OnRowCancelingEdit="GridView1_RowCancelingEdit" OnRowDeleting="GridView1_RowDeleting"
                OnRowEditing="GridView1_RowEditing" OnRowUpdating="GridView1_RowUpdating" OnRowCreated="GridView1_RowCreated">
                <Columns>
                    <asp:BoundField DataField="Content" HeaderText="说明" />
                    <asp:TemplateField HeaderText="起始IP">
                        <EditItemTemplate>
                            <table id="s" border="0" cellpadding="0" cellspacing="0" class="textiploghidden" style="width: 140px">
                                <tr>
                                    <td style="width: 50px;" align="center" valign="bottom">
                                        <asp:TextBox ID="txtIp_1" CssClass="textipinput" Text='<%# IpToStr(Eval("StartIP"),1) %>'
                                            runat="server" onkeydown="checkIPValid_1()" onkeyup="checkIPValid_2('aspnetForm','ctl00$PageBody$GridView1$ctl02$txtIp_1')"></asp:TextBox>
                                    </td>
                                    <td align="center" style="font-weight: bold; color: #000000; width: 4px;">
                                        .</td>
                                    <td align="center" valign="bottom" style="width: 50px;">
                                        <asp:TextBox ID="txtIp_2" CssClass="textipinput" Text='<%# IpToStr(Eval("StartIP"),2) %>'
                                            runat="server" onkeydown="checkIPValid_1()" onkeyup="checkIPValid_3(eval('document.aspnetForm.ctl00$PageBody$GridView1$ctl02$txtIp_2'))"></asp:TextBox></td>
                                    <td align="center" style="font-weight: bold; color: #000000; width: 4px;">
                                        .</td>
                                    <td style="width: 50px;" align="center" valign="bottom">
                                        <asp:TextBox ID="txtIp_3" CssClass="textipinput" Text='<%# IpToStr(Eval("StartIP"),3) %>'
                                            runat="server" onkeydown="checkIPValid_1()" onkeyup="checkIPValid_3(eval('document.aspnetForm.ctl00$PageBody$GridView1$ctl02$txtIp_3'))"></asp:TextBox></td>
                                    <td align="center" style="font-weight: bold; color: #000000; width: 4px;">
                                        .</td>
                                    <td style="width: 50px" align="center" valign="bottom">
                                        <asp:TextBox ID="txtIp_4" CssClass="textipinput" Text='<%# IpToStr(Eval("StartIP"),4) %>'
                                            runat="server" onkeydown="checkIPValid_1()" onkeyup="checkIPValid_3(eval('document.aspnetForm.ctl00$PageBody$GridView1$ctl02$txtIp_4'))"></asp:TextBox></td>
                                </tr>
                            </table>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <%# Eval("StartIP") %>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="结束IP">
                        <EditItemTemplate>
                           <table id="e" border="0" cellpadding="0" cellspacing="0" class="textiploghidden"
                                style="width: 140px">
                                <tr>
                                    <td style="width: 50px;" align="center" valign="bottom">
                                        <asp:TextBox ID="txtIp_5" CssClass="textipinput" Text='<%# IpToStr(Eval("EndIP"),1) %>'
                                            runat="server" onkeydown="checkIPValid_1()" onkeyup="checkIPValid_2('aspnetForm','ctl00$PageBody$GridView1$ctl02$txtIp_5')"></asp:TextBox>
                                    </td>
                                    <td align="center" style="font-weight: bold; color: #000000; width: 4px;">
                                        .</td>
                                    <td align="center" valign="bottom" style="width: 50px;">
                                        <asp:TextBox ID="txtIp_6" CssClass="textipinput" Text='<%# IpToStr(Eval("EndIP"),2) %>'
                                            runat="server" onkeydown="checkIPValid_1()" onkeyup="checkIPValid_3(eval('document.aspnetForm.ctl00$PageBody$GridView1$ctl02$txtIp_6'))"></asp:TextBox></td>
                                    <td align="center" style="font-weight: bold; color: #000000; width: 4px;">
                                        .</td>
                                    <td style="width: 50px;" align="center" valign="bottom">
                                        <asp:TextBox ID="txtIp_7" CssClass="textipinput" Text='<%# IpToStr(Eval("EndIP"),3) %>'
                                            runat="server" onkeydown="checkIPValid_1()" onkeyup="checkIPValid_3(eval('document.aspnetForm.ctl00$PageBody$GridView1$ctl02$txtIp_7'))"></asp:TextBox></td>
                                    <td align="center" style="font-weight: bold; color: #000000; width: 4px;">
                                        .</td>
                                    <td style="width: 50px" align="center" valign="bottom">
                                        <asp:TextBox ID="txtIp_8" CssClass="textipinput" Text='<%# IpToStr(Eval("EndIP"),4) %>'
                                            runat="server" onkeydown="checkIPValid_1()" onkeyup="checkIPValid_3(eval('document.aspnetForm.ctl00$PageBody$GridView1$ctl02$txtIp_8'))"></asp:TextBox></td>
                                </tr>
                            </table>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <%# Eval("EndIP") %>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="状态">
                        <ItemTemplate>
                            <asp:CheckBox ID="CB1" runat="server" ToolTip="选中表示生效" Checked='<%# Eval("Off_On")%>'
                                Text="生效" />
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:CommandField ShowEditButton="True" />
                    <asp:CommandField ShowDeleteButton="True" />
                </Columns>
            </asp:GridView>
            <aspx:CutePager ID="CutePager1" runat="server" HorizontalAlign="Center" OnPageChanged="CutePager1_PageChanged"
                ShowCustomInfoSection="Right">
            </aspx:CutePager>
            &nbsp;<asp:Literal ID="Literal1" runat="server"></asp:Literal>
        </aspx:TabOptionItem>
        <aspx:TabOptionItem ID="TabOptionItem2" runat="server" Tab_Name="添加访问IP规则">
            <table id="Table1" cellspacing="1" cellpadding="4" border="0" width="100%">
                <tr>
                    <td align="right" class="table_body">
                        说明</td>
                    <td class="table_none">
                        <asp:TextBox ID="TextInfo" runat="server" MaxLength="50" Width="165px"></asp:TextBox>[50字内]
                    </td>
                </tr>
                <tr>
                    <td align="right" class="table_body">
                        起始段</td>
                    <td class="table_none">
                        <table id="s" border="0" cellpadding="0" cellspacing="0" class="textiploghidden"
                                style="width: 140px">
                                <tr>
                                    <td style="width: 50px;" align="center" valign="bottom">
                                        <asp:TextBox ID="txtIp_1" CssClass="textipinput" Text='<%# IpToStr(Eval("StartIP"),1) %>'
                                            runat="server" onkeydown="checkIPValid_1()" onkeyup="checkIPValid_2('aspnetForm','ctl00$PageBody$txtIp_1')"></asp:TextBox>
                                    </td>
                                    <td align="center" style="font-weight: bold; color: #000000; width: 4px;">
                                        .</td>
                                    <td align="center" valign="bottom" style="width: 50px;">
                                        <asp:TextBox ID="txtIp_2" CssClass="textipinput" Text='<%# IpToStr(Eval("StartIP"),2) %>'
                                            runat="server" onkeydown="checkIPValid_1()" onkeyup="checkIPValid_3(eval('document.aspnetForm.ctl00$PageBody$txtIp_2'))"></asp:TextBox></td>
                                    <td align="center" style="font-weight: bold; color: #000000; width: 4px;">
                                        .</td>
                                    <td style="width: 50px;" align="center" valign="bottom">
                                        <asp:TextBox ID="txtIp_3" CssClass="textipinput" Text='<%# IpToStr(Eval("StartIP"),3) %>'
                                            runat="server" onkeydown="checkIPValid_1()" onkeyup="checkIPValid_3(eval('document.aspnetForm.ctl00$PageBody$txtIp_3'))"></asp:TextBox></td>
                                    <td align="center" style="font-weight: bold; color: #000000; width: 4px;">
                                        .</td>
                                    <td style="width: 50px" align="center" valign="bottom">
                                        <asp:TextBox ID="txtIp_4" CssClass="textipinput" Text='<%# IpToStr(Eval("StartIP"),4) %>'
                                            runat="server" onkeydown="checkIPValid_1()" onkeyup="checkIPValid_3(eval('document.aspnetForm.ctl00$PageBody$txtIp_4'))"></asp:TextBox></td>
                                </tr>
                            </table>
                    </td>
                </tr>
                <tr>
                    <td align="right" class="table_body">
                        结束段</td>
                    <td class="table_none">
                        <table id="e" border="0" cellpadding="0" cellspacing="0" class="textiploghidden"
                                style="width: 140px">
                                <tr>
                                    <td style="width: 50px;" align="center" valign="bottom">
                                        <asp:TextBox ID="txtIp_5" CssClass="textipinput" Text='<%# IpToStr(Eval("EndIP"),1) %>'
                                            runat="server" onkeydown="checkIPValid_1()" onkeyup="checkIPValid_2('aspnetForm','ctl00$PageBody$txtIp_5')"></asp:TextBox>
                                    </td>
                                    <td align="center" style="font-weight: bold; color: #000000; width: 4px;">
                                        .</td>
                                    <td align="center" valign="bottom" style="width: 50px;">
                                        <asp:TextBox ID="txtIp_6" CssClass="textipinput" Text='<%# IpToStr(Eval("EndIP"),2) %>'
                                            runat="server" onkeydown="checkIPValid_1()" onkeyup="checkIPValid_3(eval('document.aspnetForm.ctl00$PageBody$txtIp_6'))"></asp:TextBox></td>
                                    <td align="center" style="font-weight: bold; color: #000000; width: 4px;">
                                        .</td>
                                    <td style="width: 50px;" align="center" valign="bottom">
                                        <asp:TextBox ID="txtIp_7" CssClass="textipinput" Text='<%# IpToStr(Eval("EndIP"),3) %>'
                                            runat="server" onkeydown="checkIPValid_1()" onkeyup="checkIPValid_3(eval('document.aspnetForm.ctl00$PageBody$txtIp_7'))"></asp:TextBox></td>
                                    <td align="center" style="font-weight: bold; color: #000000; width: 4px;">
                                        .</td>
                                    <td style="width: 50px" align="center" valign="bottom">
                                        <asp:TextBox ID="txtIp_8" CssClass="textipinput" Text='<%# IpToStr(Eval("EndIP"),4) %>'
                                            runat="server" onkeydown="checkIPValid_1()" onkeyup="checkIPValid_3(eval('document.aspnetForm.ctl00$PageBody$txtIp_8'))"></asp:TextBox></td>
                                </tr>
                            </table>
                    </td>
                </tr>
                <tr>
                    <td align="right" class="table_body">
                        启用/停止</td>
                    <td class="table_none">
                        <asp:CheckBox ID="CheckBox1" runat="server" Checked="True" Text="选择表示启用"></asp:CheckBox></td>
                </tr>
                <tr>
                    <td colspan="2">
                        <asp:Button ID="add" runat="server" CssClass="button_bak" Text="添加" OnClick="add_Click">
                        </asp:Button></td>
                </tr>
            </table>
        </aspx:TabOptionItem>
        <aspx:TabOptionItem ID="TabOptionItem3" runat="server" Tab_Name="基本配置">
            <table id="Table2" border="0" cellpadding="4" cellspacing="1" width="100%">
                <tr>
                    <td style="height: 31px" width="120" class="table_body">
                        <div align="right">
                            开启/关闭</div>
                    </td>
                    <td style="height: 31px" width="361" class="table_none">
                        <asp:CheckBox ID="YN" runat="server" Checked="True" Text="[是否启用IP限制，钩上为开启]" /></td>
                </tr>
                <tr>
                    <td class="table_body">
                        <div align="right">
                            提示内容</div>
                    </td>
                    <td class="table_none">
                        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><font face="宋体"><font color="darkgray">[在限制内的IP所看到的提示，255字以内]</font></font></td>
                </tr>
                <tr>
                    <td class="table_body">
                        <p align="right">
                            允许/拒绝</p>
                    </td>
                    <td class="table_none">
                        <p>
                            <asp:CheckBox ID="YJ" runat="server" Checked="True" Text="[封锁规则，允许或拒绝存在的IP段访问，钩上为允许]" />&nbsp;</p>
                    </td>
                </tr>
                <tr>
                    <td class="table_body">
                        <div align="right">
                            后退/转到</div>
                    </td>
                    <td class="table_none">
                        <asp:CheckBox ID="HZ" runat="server" Checked="True" Text="[钩上为后退，钩上后转到地址无效]" /></td>
                </tr>
                <tr>
                    <td class="table_body">
                        <div align="right">
                            转到地址</div>
                    </td>
                    <td class="table_none">
                        <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox><span style="color: #a9a9a9;
                            font-family: 宋体">[需要转到的地址，可以为相对路径或绝对路径]</span></td>
                </tr>
                <tr>
                    <td colspan="2">
                        <asp:Button ID="B_Save" runat="server" CssClass="button_bak" Text="保 存" OnClick="B_Save_Click" />
                        <asp:Button ID="view" runat="server" CssClass="button_bak" Text="预 览" OnClick="view_Click" />
                    </td>
                </tr>
            </table>
        </aspx:TabOptionItem>
    </aspx:TabOptionWebControls>

    <script type="text/javascript">
    function checkIPValid_1() 
{ 
    if(event.shiftKey) 
    { 
        event.returnValue=false; 
        return; 
    } 
    var keyCode = parseInt(event.keyCode); 
    var result=true; 
    if((keyCode==8) || (keyCode==37) || (keyCode==39) || (keyCode==9)) return; 

    if((keyCode>=48) && (keyCode<=57)) return; 
    else result=false; 
    if((keyCode>=96) && (keyCode<=105)) return; 
    else result=false; 

    if((keyCode==110) || (keyCode==190) || (keyCode==32))  
    { 
        event.keyCode=9; 
        return; 
    } 
    if(result==false) event.returnValue=false;
} 

function checkIPValid_2(formname,ip) 
{ 
    var form = eval("document."+formname) 
    var ip_1 = parseInt(eval("aspnetForm."+ip+".value")); 
    if(ip_1>223) 
    { 
        eval("aspnetForm."+ip).value="223"; 
        alert(ip_1+"不是个有效地址，请指定一个介于1和223之间的数值"); 

    } 
    else if(ip_1==127) 
    { 
        eval("aspnetForm."+ip).value="1"; 
        alert("以127开头的IP地址无效，因为它们保留用作环回地址，请在1和223之间指定一些其他有效值"); 
    }
} 

function checkIPValid_3(mask) 
{ 
     
    if(typeof(mask) != 'object'){ 
        mask = eval(mask) 
    } 
    var maskInt=parseInt(mask.value); 
    if((maskInt<0) || (maskInt>255)) 
    { 
        mask.value=255; 
        alert(maskInt+"不是个有效项目，请指定一个介于0和255之间的数值"); 
    } 
} 
    </script>

</asp:Content>
