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

📄 dologin.aspx.cs

📁 学术会议在线投稿系统 fghgfhgfhgfhfgh
💻 CS
字号:
using System;
using System.Data;
using System.Text;
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.Security.Cryptography;
using WebDB;

public partial class dologin : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        String t = Request.QueryString["t"].ToString();

        Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
        Response.ExpiresAbsolute = DateTime.Now.AddDays(-1);
        Response.AddHeader("pragma", "no-cache");
        Response.AddHeader("cache-control", "no-cache, must-revalidate");
        Response.CacheControl = "no-cache";
        
        switch (t)
        {
            case "siin":
                validate();
                break;
            case "shin":
                ShowSignIn();
                break;
            case "sout":
                SignOut();
                break;
            case "siup":
                ShowSignUp();
                break;
            case "chdup":
                CheckDup();
                break;
            default:
                break;
        }


    }
    protected void ShowSignIn()
    {
        psin.Visible = true;
    }
    protected void ShowSignUp()
    {
        psup.Style["text-align"] = "center";
        psup.Visible = true;
    }
    protected void SignOut()
    {
        Session["uid"] = null;
        psout.Visible = true;
    }
    protected void validate()
    {
        pin.Visible = true;   
        Logins plogin = new Logins();

        MD5 md5cry = new MD5CryptoServiceProvider();

        String uid = Request.Form["u"].ToString();
        String pwd = Request.Form["p"].ToString();
        String error_string = "";
        int cid = 0;
        int acid = 0;

        lbuid.Text = uid;

        byte[] byteInput = UTF8Encoding.UTF8.GetBytes(pwd);
        MD5CryptoServiceProvider objMD5 = new MD5CryptoServiceProvider();
        byte[] byteOutput = objMD5.ComputeHash(byteInput);
        pwd = BitConverter.ToString(byteOutput).Replace("-", "").ToLower();

        if (plogin.validate(uid, pwd,ref acid,ref cid, ref error_string) == 1)
        {
            xmlst.Text = "<LGST s=\"1\" />";
            if (cid != 0)
            {
                lbst.Text = "Signed In - You have contest";
            }
            else
            {
                lbst.Text = "Signed In";
            }
            Session["uid"] = uid;
            Session["cid"] = cid;
            Session["acid"] = acid;
        }
        else
        {
            xmlst.Text = "<LGST s=\"0\" />";
            lbst.Text = "Failed";
            Session["uid"] = null;
            Session["cid"] = null;
            Session["acid"] = null;
        }
    }
    protected void CheckDup()
    {
        Logins plogin = new Logins();
        String uid = Request.Form["u"].ToString();
        String error_string = "";

        if (plogin.check_duplicate(uid, ref error_string) == 0)
        {
            Response.Write("<CDST s=\"0\" />");
            Response.End();
        }
        else
        {
            Response.Write("<CDST s=\"1\" />");
            Response.End();
        }
    }
}

⌨️ 快捷键说明

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