users/Login.aspx.cs

(完整代码) 1KB

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


public partial class index : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Label1.Text = "欢迎光临,您是第" + Application["Count"] + "位游客!";
        if (Session["IsLogin"] != null)
        {
            if (Session["IsLogin"].ToString() == "ok")
            {
                Label1.Text = Session["name"] + "您好!<a href=update.aspx>修改用户信息</a> <a href=Loginout.aspx>注销</a>";
            }
        }
    }
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        string sql = "select count(*) from UserInfo where UserName='" + txtUserName.Text + "'";
        int n = MyClass.ExecuteScalar(sql);
        if (n > 0)
        {
            sql = "select count(*) from UserInfo where UserName='" + txtUserName.Text + "' and UserPwd='" + txtUserPwd.Text + "'";
            n = MyClass.ExecuteScalar(sql);
            if (n > 0)
            {
                Session["IsLogin"] = "ok";
                Session["Name"] = txtUserName.Text.ToString().Trim();
                Response.Redirect("Login.aspx");
            }
            else
            {
                Response.Write("<script>alert('密码错误!')</script>");
            }
        }
        else
        {
            Response.Write("<script>alert('该用户不存在!')</script>");
        }
    }
}

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

AI 解读 AI

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

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