WebSite1/login.aspx.cs

(开头部分) 2KB

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

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;
using System.Data.SqlClient;

public partial class login : System.Web.UI.Page
{
    String UserName;
    String UserPassword;
    String Power;
    protected void Page_Load(object sender, EventArgs e)
    {
        ShowMsn.Text = "对不起你还没有登陆";
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        ShowMsn.Text.Trim();
        UserName = LoginUserName.Text.Trim ();
        UserPassword = LoginUserPassword.Text.Trim ();
        Power = LoginChoose.Text;
        Session["NiName"] = UserName.ToString();
      //  string STconnection = ConfigurationSettings.AppSettings["strconnection"];
        SqlConnection conn = new SqlConnection("Server=.;Integrated Security=sspi;DATABASE=Angel_JLSystem");
        string sql = "Select* from JianLi_User where User_Name ='"+UserName +"'and User_Password='"+UserPassword +"'and AllowAdmin='"+Power +"'";
        SqlCommand cmd = new SqlCommand(sql, conn);
         try
           {
               conn.Open();
               SqlDataReader sdr = cmd.ExecuteReader();            
                if (sdr.Read ())
                 {
                  //判断管理权限
                  if (Power  == "0")
                   {
                     Response.Redirect("index.aspx");
                   }
                  else if (Power  == "1")
                   {
                    //如果是管理员就定向到STManagerLogin.aspx页面
                    Response.Redirect("admin/main.aspx");
                   } 
                }
              else
                  {
                    //用户名密码不正确就返回到Index.aspx页面
                    Response.Write("<script language='javascript'>alert('登陆失败!');</script>");
                   // ShowMsn.Text = "登陆失败!";
                   // Response.Redirect("login.aspx");
                  }  
         }
        catch (Exception e1)
        {
            System.Console.WriteLine(e1);
后面还有 8 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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