XDF/CheckCode.aspx.cs
(开头部分) 5KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.IO;
using System.Drawing.Imaging;
using System.Text;
public partial class CheckCode : System.Web.UI.Page
{
private string code;
private const int ImageHeigth = 22; //验证码图片的高度
private const double ImageLengthBase = 12.5; //验证码图片中每个字符的宽度
private const int ImageLineNumber = 25; //噪音线的数量
private const int ImagePointNumber = 100; //噪点的数量
private int length;
public static string VALIDATECODEKEY; //此处用来保存验证码到Session的Key的名称
static CheckCode()
{
VALIDATECODEKEY = "VALIDATECODEKEY";
}
//设置验证码的长度和内容
public CheckCode()
{
this.length = 4;
this.code = string.Empty;
}
/// <summary>
/// 产生随机的验证码并加入Session
/// </summary>
/// <param name="length">验证码长度</param>
/// <returns></returns>
public string CreateCode(int length)
{
if (length <= 0)
{
return string.Empty;
}
Random random = new Random();
StringBuilder builder = new StringBuilder();
//产生随机的验证码并拼接起来
for (int i = 0; i < length; i++)
{
builder.Append(random.Next(0, 10));
}
this.code = builder.ToString();
this.Session[VALIDATECODEKEY] = this.code;
return this.code;
}
/// <summary>
后面还有 89 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。