コード例 #1
0
ファイル: RegisterComp.aspx.cs プロジェクト: iamsee/Tourinfo
    protected void But_Register_Click(object sender, EventArgs e)
    {
        string CompName  = Text_CompName.Text.Trim();
        string CompMail  = Text_CompMail.Text.Trim();
        string CompPwd   = Text_CompPwd.Text.Trim();
        string CompPhone = Text_CompPhone.Text.Trim();



        CompPwd = PublicClass.getMd5Hash(CompPwd);//md5加密处理

        sqlString = "insert into TB_Company(CompName,CompMail,CompPwd,CompPhone,CompDate,CompState) values('" + CompName + "','" + CompMail + "','" + CompPwd + "','" + CompPhone + "'," + "getdate()" + "," + 1 + ")";
        if (db.ExecuteSQL(sqlString) > 0)
        {
            SendMail sm    = new SendMail();
            string   to    = Text_CompMail.Text.Trim();
            string   title = "邮箱确认邮件";
            string   guid  = Guid.NewGuid().ToString();
            //内容链接直接给的本地运行的路径,如在运行的端口号不一致时,得修改这个端中号(1142)
            string content = @"<a href='http://localhost:1142/Confirm.aspx?user="******"'>http://localhost:1142/Confirm.aspx?user="******"</a>";

            if (sm.Send(sm.MakeMail(to, title, content)))
            {
                sqlString = "update TB_Company set MailActive='" + guid + "' where CompMail='" + to + "'";
                db.ExecuteSQL(sqlString);
                Response.Write("<script>alert('邮箱确认邮件已经发送到您的邮箱请注意确认,系统将返回登录页面');location.href='CompLogin.aspx';</script>");
            }
            else
            {
                Response.Write("用户注册失败!");
            }
        }
    }
コード例 #2
0
    protected void But_SendMail_Click(object sender, EventArgs e)
    {
        SendMail sm    = new SendMail();
        string   to    = CompMail;
        string   title = "邮箱确认邮件";
        string   guid  = Guid.NewGuid().ToString();
        //内容链接直接给的本地运行的路径,如在运行的端口号不一致时,得修改这个端中号(1142)
        string content = @"<a href='http://localhost:1142/Confirm.aspx?user="******"'>http://localhost:1142/Confirm.aspx?user="******"</a>";

        if (sm.Send(sm.MakeMail(to, title, content)))
        {
            sqlString = "update TB_Company set MailActive='" + guid + "' where CompMail='" + to + "'";
            db.ExecuteSQL(sqlString);
            Response.Write("<script>alert('邮箱确认邮件已经发送到您的邮箱请注意确认,请点击确认链接后刷新此界面');</script>");
        }
    }
コード例 #3
0
    protected void btnRegister_Click(object sender, EventArgs e)
    {
        if (txtEmail.Text.Trim() == "")
        {
            Response.Write("Email地址不能为空!");
            return;
        }
        if (txtPwd.Text.Trim() == "")
        {
            Response.Write("密码不能为空!");
            return;
        }
        if (txtPwd.Text.Trim() != txtConfirm.Text.Trim())
        {
            Response.Write("二次输入的密码不一致!");
            return;
        }
        string     sql = "insert into mail(email,pwd) values ('" + txtEmail.Text.Trim() + "','" + txtPwd.Text.Trim() + "')";
        ExecuteSQl es  = new ExecuteSQl();

        if (es.ExcuteSql(sql) != 0)
        {
            SendMail sm    = new SendMail();
            string   to    = txtEmail.Text.Trim();
            string   title = "TestEmail";
            string   guid  = Guid.NewGuid().ToString();
            //内容链接直接给的本地运行的路径,如在运行的端口号不一致时,得修改这个端中号(1142)
            string content = @"<a href='http://localhost:1142/Confirm.aspx?user="******"'>http://localhost:1142/Confirm.aspx?user="******"</a>";

            if (sm.Send(sm.MakeMail(to, title, content)))
            {
                string strSql = "update mail set active='" + guid + "' where email='" + to + "'";
                es.ExcuteSql(strSql);
                Response.Write("用户注册成功!请注意查收邮件!");
            }
            else
            {
                Response.Write("用户注册失败!");
            }
        }
    }