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

📄 login.ascx.cs

📁 Internet聊天室,学习网络聊天实例
💻 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;
using Web_Speaking.DataAccesslayer;
using Web_Speaking.Modelayer;
using Web_Speaking.Businesslayer;
using System.Data.SqlClient;

namespace Web_Speaking.controls
{
    public partial class login : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            string str_stra = "";
            int num = 0;
            SQLHelper sh = new SQLHelper();
            Class_login cls = new Class_login();
            cls.pub_user_name = this.TextBox1.Text;
            cls.pub_user_pwd = this.TextBox2.Text;
            if (this.TextBox1.Text.IndexOf("'") >= 0 || this.TextBox1.Text.IndexOf(";") >= 0)
            {
                Page.ClientScript.RegisterClientScriptBlock(GetType(), "sadas", "<script>alert('你输入带有非法字符符号!')</script>");
            }
            else
            {
                SQL Cls_Sql = new SQL();
                if (Cls_Sql.GetOnlineMsg(cls).Tables[0].Rows.Count == 0)
                {
                    Page.ClientScript.RegisterClientScriptBlock(GetType(), "sadas", "<script>alert('登陆失败!')</script>");
                    return;
                }
                else
                {
                    if (Convert.ToInt32(Cls_Sql.GetOnlineMsg(cls).Tables[0].Rows[0]["online"]) == 1)
                    {
                        Page.ClientScript.RegisterClientScriptBlock(GetType(), "sadas", "<script>alert('用户已在线!')</script>");
                        return;
                    }
                }

                SortedList cmd_list = new SortedList();
                cmd_list.Add("@user_name", cls.pub_user_name);
                cmd_list.Add("@password", cls.pub_user_pwd);

                SortedList out_list = new SortedList();
                out_list.Add("@messg_str", "");
                out_list.Add("@check_num", "");

                SortedList result_list = new SortedList();
                sh.Admin_login("login_pro", cmd_list, out_list, ref result_list);

                str_stra = result_list[1].ToString();
                num = Convert.ToInt32(result_list[0].ToString());
                if (num == 1)
                {

                    Session["sname"] = this.TextBox1.Text;
                    Session["sid"] = Cls_Sql.GetOnlineMsg(cls).Tables[0].Rows[0]["L_Id"].ToString();
                    Response.Redirect("../Default.aspx?sanme=" + this.TextBox1.Text.Trim() + "");

                }
                else
                {
                    Page.ClientScript.RegisterClientScriptBlock(GetType(), "sadas", "<script>alert('" + str_stra.ToString() + "')</script>");
                }
            }
        }
    }
}

⌨️ 快捷键说明

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