嗨,那里如何将sql登录系统添加到此服务器 [英] Hi there how can i add sql login system to this server

查看:84
本文介绍了嗨,那里如何将sql登录系统添加到此服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我需要一些人帮助将sql用户身份验证添加到以下代码中.

i need some people help adding a sql user authentication to the following code.

基本上,我们有一个客户端向该用c#编写的服务器发送用户ID +密码(在md5中),该服务器从字面上监听tcp连接,并说您可以在对该程序进行身份验证时立即使用该程序,无论他们对输入的内容进行身份验证都是尝试过的将SQL添加到此 但是我只是不知道是否有人可以帮忙.

basically we have a client that sends user id + password (in md5) to this server written in c# that literally listens on a tcp connection and says you can use the program or not at the moment its authing everything they enter ive tried adding sql into this but i just cant so wondered if any one can help.

如果有人想提供帮助,但他们需要访问更多代码,请回复,然后张贴副本.

if anyone would like to help but they need access to a bit more code please reply and ill post up a copy.

预先感谢

代码:

private d0 Login(SessInfo CurrentSess, object[] args)
		{
			string text = null;
			if (args.Length >= 3)
			{
				string str = (string)args[0];
				string str2 = (string)args[1];
				byte bot = (byte)args[2];
				byte[] bytes = Encoding.ASCII.GetBytes(str + str2);
				byte[] bytes2 = BitConverter.GetBytes(DateTime.Now.ToBinary());
				byte[] bytes3 = BitConverter.GetBytes(this.rand.Next());
				byte[] array = new byte[bytes.Length + bytes2.Length + bytes3.Length];
				Buffer.BlockCopy(bytes, 0, array, 0, bytes.Length);
				Buffer.BlockCopy(bytes2, 0, array, bytes.Length, bytes2.Length);
				Buffer.BlockCopy(bytes3, 0, array, bytes.Length + bytes2.Length, bytes3.Length);
				text = DataLib.MD5(array);
                this.Sessions.Add(new SessInfo(text, bot));
				
			}
           
			d0 d = new d0();
			if (text != null)
			{
				d.Success = true;
				d.Body = "Welcome You may now continue";
				d.Data = Encoding.ASCII.GetBytes(text);
			}
			else
			{
				d.Success = false;
				d.Body = "Authentication failed";
			}
			return d;
		}

推荐答案

您能解释一下,将sql添加到此"是什么意思吗?
Can you explain, what you exactly mean by "adding sql into this"?


这篇关于嗨,那里如何将sql登录系统添加到此服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆