Account/GetUserCount.ashx.cs

(完整代码) 1KB

using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Web.SessionState;
using System.Text;

namespace 客户订单管理2.Account
{
    public class GetUserCount : IHttpHandler, IRequiresSessionState
    {

        public void ProcessRequest(HttpContext context)
        {
            string userName = context.Request.QueryString["username"];
            userName = System.Web.HttpUtility.UrlDecode(userName);
            SqlConnection dataConnection;
            SqlCommand sqlCmd = new SqlCommand();
            string sql = "select count(*) from 系统_用户 where 用户名称='" + userName + "'";
            dataConnection = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["默认连接_3HK0R6GAS"].ConnectionString);
            object obj;
            try
            {
                dataConnection.Open();
                sqlCmd.Connection = dataConnection;
                sqlCmd.CommandText = sql;
                obj = sqlCmd.ExecuteScalar();
                dataConnection.Close();
                if (obj == null || (int)obj == 0)
                {
                    context.Response.Write("用户名可用");
                }
                else 
                {
                    context.Response.Write("用户名已被注册");
                }
            }
            catch
            {
                context.Response.Write(" ");
            }
        }

        public bool IsReusable
        {
            get
            {
                return true;
            }
        }
    }
}

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

AI 解读 AI

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

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