user/getpass.aspx.cs

(完整代码) 2KB

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class user_getpass : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack)
        {
            Regular regex = new Regular();
            string username = t_username.Text.Trim();
            if (regex.IsUserName(username))
            {
                string identifyingCode = InitialValidate();
                string receiver = "";
                Md5Pw md5 = new Md5Pw();
                SqlStore sql = new SqlStore();
                string validate = md5.Md5(identifyingCode.Substring(0, 32)) + identifyingCode.Substring(13, 38) + md5.Md5(identifyingCode.Substring(32, 32));
                sql.GetPass(username, validate, ref receiver);
                if (receiver != "")
                {
                    //发送邮件
                    Mail sendmail = new Mail();
                    sendmail.GetPassWord(username, receiver, identifyingCode);
                    Response.Write("<script type='text/javascript'>alert('修改密码相关链接地址已经发往您的注册邮箱,请登陆您的邮箱查收!');location='" + Request.UrlReferrer.AbsoluteUri + "';</script>");
                }
                else
                    Response.Write("<script type='text/javascript'>alert('该用户名不存在!');location='" + Request.UrlReferrer.AbsoluteUri + "';</script>");
            }
            else
                Response.Write("<script type='text/javascript'>alert('请确认您的用户名!');location='" + Request.UrlReferrer.AbsoluteUri + "';</script>");
        }
    }
    /// <summary>
    /// 产生64为验证码
    /// </summary>
    /// <returns></returns>
    protected string InitialValidate()
    {
        string[] key = new string[36] { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" };
        Random rand = new Random();
        string initial = "";
        for (int i = 0; i < 64; i++)
            initial += key[rand.Next(0, 35)];
        return initial.ToUpper();
    }
}

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。