⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 default.aspx.cs

📁 购物车主要是为广大网上顾客购物的资源平台。购物车主要目标是建设在网上对用户进行信息服务互动平台。
💻 CS
字号:
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 login : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            this.RadioButtonList1.Items[0].Selected = true;
            this.RadioButtonList1.Items[1].Selected = false;
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (this.RadioButtonList1.Items[0].Selected == true)
        {
            string Uid = this.TextBox1.Text.Trim();
            string Upwd = this.TextBox2.Text.Trim();
            string sql = "SELECT * FROM Userlist WHERE Uid='" + Uid + "' and Upwd='" + Upwd + "'";

            DBClass db = new DBClass();
            DataTable dt = db.GetDataTable(sql);
            if (dt.Rows.Count > 0)
            {
                Session["Uid"] = dt.Rows[0]["Uid"].ToString();
                Session["Uname"] = dt.Rows[0]["Uname"].ToString();
            
                Response.Redirect("modifyuser.aspx?name='" + dt.Rows[0]["Uname"] + "'");


            }
            else
                Response.Write("<script> alert('您输入的用户名或者密码错误,请重新输入');</script>");
            this.TextBox2.Text = "";
        }
        if (this.RadioButtonList1.Items[1].Selected == true)
        {
            string Aname = this.TextBox1.Text.Trim();
            string Apwd = this.TextBox2.Text.Trim();
            string sql = "select * from Admin where Aname='" + Aname + "'and Apwd='" + Apwd + "'";
            DBClass db = new DBClass();
            DataTable dt = db.GetDataTable(sql);
            if (dt.Rows.Count > 0)
            {
                Session["Aname"] = dt.Rows[0]["Aname"].ToString();
                Response.Redirect("AModify.aspx?Aname='"+Session["Aname"]+"'");
                Response.Write("<script> alert('你已登录了管理员!');</script>");
            }
            else
            {
                Response.Write("<script> alert('您输入的管理员名或者密码错误,请重新输入');</script>");
                this.TextBox2.Text = "";

            }
        }
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        this.TextBox1.Text = "";
        this.TextBox2.Text = "";
    }

    protected void Button3_Click(object sender, EventArgs e)
    {
        Response.Redirect("Reg.aspx");
    }
}


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -