登陆页面.aspx.cs

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
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 _Default : System.Web.UI.Page 
{
    int temp = 0;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            DropDownList1.Items.Add("管理员");
            DropDownList1.Items.Add("教师");
            DropDownList1.Items.Add("学生");
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string strcnn="server=.;database=学生成绩智能管理系统;Integrated Security=True;";
        string strcmd="";
        if(TextBox1.Text!=""&&TextBox2.Text!="")
        {
            if (DropDownList1.Text == "管理员")
            {
                strcmd = "select count(*) from 用户表  where  用户名='" + TextBox1.Text + "' and 密码='" + TextBox2.Text + "'";
                temp = 1;
            }
            if (DropDownList1.Text == "教师")
            {
                strcmd = "select count(*) from  教师表 where  教师编号='" + TextBox1.Text + "' and 密码='" + TextBox2.Text + "'";
                temp = 2;
            }
            if (DropDownList1.Text == "学生")
            {
                strcmd = "select count(*) from  学生表 where  学号='" + TextBox1.Text + "' and 密码='" + TextBox2.Text + "'";
                temp = 3;
            }
            SqlConnection cnn = new SqlConnection(strcnn);
            cnn.Open();
            SqlCommand cmd = new SqlCommand(strcmd,cnn);
            if ((int)cmd.ExecuteScalar() == 1)
            {
                this.Session.Add("name", Convert.ToString(TextBox1.Text));
                if (temp == 1)
                    Response.Redirect("管理模块//学生信息管理.aspx");
                if (temp == 2)
                    Response.Redirect("教师模块//Default1.aspx");
                if (temp == 3)
                    Response.Redirect("学生模块//Default.aspx");
            }
            else
                Response.Write("<script LANGUAGE='javascript'>alert('账号或密码错误!');history.go(-1);</script>");
            cnn.Close();
后面还有 11 行代码,解锁后查看完整代码

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

AI 解读

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

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