今天想到得不错的代码注释,感觉还可以

            DateTime LstSoTm;
            iInfo[1] = 0;//当前页
            iInfo[2] = 0;//总记录
            iInfo[3] = 0;//总页数
            iInfo[4] = 9;//分页数量

            sInfo[1] = "";//统计sql
            sInfo[2] = "";//数据sql
            sInfo[3] = "";//分页Url

            if (Request.QueryString["Page"] != "" && Request.QueryString["Page"] != "null" && EU_Pub.IsNumber(Request.QueryString["Page"]))//8处理分页,或分页浏览时,重复判断搜索间隔
            {
                iInfo[1] = Int32.Parse(Request.QueryString["Page"]);
            }
            else
            {
                try
                {   //1 获取上次搜索时间
                    LstSoTm = (DateTime)Session["LastSoTime"];
                    if (DateTime.Compare(DateTime.Now.AddSeconds(-5), LstSoTm) < 1)
                    {//2比较间隔
                        Response.Write("你搜索太快了!5秒种后再试!");
                        Response.Write("<a href=\"JavaScript:history.go(-1);\">Back</a>");
                        Response.End();
                    }
                }
                catch { Session["LastSoTime"] = DateTime.Now; }//3发生没有搜索过、或者过期的错误时
            }
            string Key = "";
            Key = Request.Form["soKey"];//4获取key,Sql注入另处理
            try { if (Key == null) { Key = (string)Session["soKey"]; } }//9分页浏览时,丢失key
            catch { }
            if (Key == null || Key.Length > 20 || Key.Length < 1)//5,直接输入网址,太长和为空时
            {
                Response.Write("请输入适当的关键词!");
                Response.Write("<a href=\"JavaScript:history.go(-1);\">Back</a>");
                Response.End();
            }

            Session["soKey"] = Key;//6
            //7 数据操作
posted @ 2010-01-09 16:40  张三封  阅读(263)  评论(2编辑  收藏  举报