using System;
using System.Collections.Generic;
using System.Text;
using Discuz.Common;
using Discuz.Forum;
using Discuz.Config;
using Discuz.Entity;
public static void Login(string username, string password)
{
try
{
Discuz.Config.GeneralConfigInfo config = Discuz.Config.GeneralConfigs.GetConfig();
int uid = Users.GetUserID(username);
if (uid == -1 || !Users.Exists(uid))
{
Regedit(username, password);
uid = Users.GetUserID(username);
}
//删除之前的错误登录信息
LoginLogs.DeleteLoginLog(DNTRequest.GetIP());
//根据积分公式刷新用户总积分
UserCredits.UpdateUserCredits(uid);
//写入用户登录后的cookie
ForumUtils.WriteUserCookie(uid, Utils.StrToInt(DNTRequest.GetString("expires"), -1), config.Passwordkey, DNTRequest.GetInt("templateid", 0), DNTRequest.GetInt("loginmode", -1));
//更新用户最后动作,如不需要可不执行
//OnlineUsers.UpdateAction(olid, UserAction.Login.ActionID, 0, config.Onlinetimeout);
//更新该用户最后访问时间
Users.UpdateUserLastvisit(uid, DNTRequest.GetIP());
}
catch
{
}
}
using System.Collections.Generic;
using System.Text;
using Discuz.Common;
using Discuz.Forum;
using Discuz.Config;
using Discuz.Entity;
public static void Login(string username, string password)
{
try
{
Discuz.Config.GeneralConfigInfo config = Discuz.Config.GeneralConfigs.GetConfig();
int uid = Users.GetUserID(username);
if (uid == -1 || !Users.Exists(uid))
{
Regedit(username, password);
uid = Users.GetUserID(username);
}
//删除之前的错误登录信息
LoginLogs.DeleteLoginLog(DNTRequest.GetIP());
//根据积分公式刷新用户总积分
UserCredits.UpdateUserCredits(uid);
//写入用户登录后的cookie
ForumUtils.WriteUserCookie(uid, Utils.StrToInt(DNTRequest.GetString("expires"), -1), config.Passwordkey, DNTRequest.GetInt("templateid", 0), DNTRequest.GetInt("loginmode", -1));
//更新用户最后动作,如不需要可不执行
//OnlineUsers.UpdateAction(olid, UserAction.Login.ActionID, 0, config.Onlinetimeout);
//更新该用户最后访问时间
Users.UpdateUserLastvisit(uid, DNTRequest.GetIP());
}
catch
{
}
}