基本信息
源码名称:基于ASP.NET图片广告验证码的实现
源码大小:1.03M
文件格式:.rar
开发语言:C#
更新时间:2018-06-23
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):78630559

本次赞助数额为: 4 元 
   源码介绍
制作一个简易留言板,采用验证码技术,防止用户批量发布信息,俗称“灌水”

static int i = -1;  
 
        protected void lbt_change_Click(object sender, EventArgs e)
        {
            string[,] product = { { "农夫果园", "nfgy" }, { "康师傅", "ksf" }, { "水果部落", "sgbl" }, { "银鹭", "yl" }, { "益目之源", "ymzy" } };
            string picture_path = "./images/";
            int j;
            Random rd = new Random();
            do { j = rd.Next(product.Length / 2);  } while (i == j);
            i = j;
            Session["check_code"]=product[j,0];
            ImageButton1.ImageUrl = picture_path product[j, 1] ".jpg";
        }

        protected void btn_show_Click(object sender, EventArgs e)
        {
            string your_message = tb_message.Text.Trim();
            string your_code = tb_code.Text.Trim();
            string now_time = DateTime.Now.ToString() "---";
            Boolean ok1 = String.IsNullOrEmpty(your_message);
            Boolean ok2 = (your_code != Session["check_code"].ToString());
            if (ok1) { tb_message.Text = ""; return; }
            if (ok2) { tb_code.Text = ""; return; }
            tb_show.Text = tb_show.Text.Insert(0,now_time your_message "\n");
            tb_message.Text = tb_code.Text = "";
            lbt_change_Click(sender,e);
        }

        protected void btn_clear_Click(object sender, EventArgs e)
        {
            tb_message.Text = tb_code.Text = "";
            tb_message.Focus();
            tb_show.ReadOnly = false;
            tb_show.Text = "";
            tb_show.ReadOnly = true;
        }