using System;
using System.Data.SqlClient;

public partial class _Default : System.Web.UI.Page
{
    sqloper sqloper = new sqloper();
    //留言本访问处理
    protected void Page_Load(object sender, EventArgs e)
    {
        if (book_open() == 1)
        {
            Response.Redirect(book_error());
        }
        else
        {
            string[] stopip=book_stopip().Split(',');
            int i=0;
            for (i = 0; i < stopip.Length;i++ )
            {
                if (stopip[i] == Request.UserHostAddress.ToString())
                {
                    Response.Redirect(book_error());
                }
            }
        }

    }

    //留言本名字读取
    protected string bookname_show()
    {
        return sqloper.loaddb("select * from config", "gname");
    }
    //关键字读取
    protected string bookkey_show()
    {
        return sqloper.loaddb("select * from config", "gkey");
    }
    //留言本维护设置开关
    protected int book_open()
    {
        return Convert.ToInt16(sqloper.loaddb("select * from config", "gopen"));
    }
    //留言本错误页面
    protected string book_error()
    {
        return sqloper.loaddb("select * from config", "gerror");
    }
    //禁止浏览留言本ip
    protected string book_stopip()
    {
        return sqloper.loaddb("select * from config", "gstopip");
    }
}
