[C#] syntaxhighlighter_viewsource syntaxhighlighter_copycode
[WebMethod]
public string userLogin(string loginName, string password)
{
//password为loginName与实际的password一起加密后的值
string key = MD5.CurKey();
password = MD5.EncryptString(loginName + password, key);
string[] prototype = new string[] { "operatorID", "loginName", "name", "disabled", "role", "companyID" };
List<Dictionary<string, object>> list = basedao.findMapByProperties("T_P_Operator", prototype, "loginName='" + loginName + "' and password = '" + password + "'");
if (list.Count == 0)
{
return "0";//用户名或者密码错误
}
else
{
if (Int32.Parse(list[0]["disabled"] + "") == 1)
{
return "1";//登录成功
}
else
{
return "2";//用户被禁用
}
}