Essay/EssayIndex.aspx.cs
(完整代码) 1KBusing System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
namespace Essay
{
public partial class EssayIndex : System.Web.UI.Page
{
public string sql = "Data Source=. ;Trusted_Connection=SSPI;Initial Catalog=Essay";
protected void Page_Load(object sender, EventArgs e)
{
}
protected void BtnLogIn_Click(object sender, EventArgs e)
{
string stdnum = this.txtNum.Text.Trim();
SqlConnection conn = new SqlConnection(sql);
conn.Open();
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandType = CommandType.Text;
cmd.CommandText = "Select * from Authors where StdNum='"+stdnum+"'";
SqlDataReader dr = cmd.ExecuteReader();
dr.Read();
if (dr.HasRows)
{
string password = dr["Password"].ToString();
string code = dr["Code"].ToString();
Session["AuthorID"] = dr["AuthorID"].ToString();//session相当于一个临时存储器
if (password == txtPassword.Text && code == txtCodeNum.Text)
{
Response.Redirect("AuthorIndex.aspx");
}
else
{
Response.Write("<Script>alert('密码或授权码不正确!')</Script>");
}
conn.Close();
}
else {
Response.Write("<Script>alert('该学号不存在!')</Script>");
}
}
protected void Button1_Click(object sender, EventArgs e)
{
Response.Redirect("CodeForget.aspx");
}
}
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。
