惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - 【当耐特】
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Y
Y Combinator Blog
D
DataBreaches.Net
Google DeepMind News
Google DeepMind News
H
Hackread – Cybersecurity News, Data Breaches, AI and More
云风的 BLOG
云风的 BLOG
Recorded Future
Recorded Future
I
InfoQ
L
LangChain Blog
Stack Overflow Blog
Stack Overflow Blog
Recent Announcements
Recent Announcements
宝玉的分享
宝玉的分享
Martin Fowler
Martin Fowler
J
Java Code Geeks
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
A
About on SuperTechFans
人人都是产品经理
人人都是产品经理
G
Google Developers Blog
大猫的无限游戏
大猫的无限游戏
C
Cybersecurity and Infrastructure Security Agency CISA
Know Your Adversary
Know Your Adversary
MongoDB | Blog
MongoDB | Blog
T
Tor Project blog
The Register - Security
The Register - Security
H
Help Net Security
Cisco Talos Blog
Cisco Talos Blog
P
Privacy & Cybersecurity Law Blog
NISL@THU
NISL@THU
P
Palo Alto Networks Blog
B
Blog RSS Feed
Latest news
Latest news
T
Threat Research - Cisco Blogs
The Hacker News
The Hacker News
C
Cisco Blogs
P
Privacy International News Feed
T
The Exploit Database - CXSecurity.com
V
Vulnerabilities – Threatpost
S
Schneier on Security
P
Proofpoint News Feed
Schneier on Security
Schneier on Security
www.infosecurity-magazine.com
www.infosecurity-magazine.com
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
AI
AI
Google Online Security Blog
Google Online Security Blog
H
Hacker News: Front Page
N
News and Events Feed by Topic
W
WeLiveSecurity

博客园 - 分飞

从客户端(FCKeditor1="<p>...")中检测到有潜在危险的 Request.Form 值。 net 试图加载格式不正确的程序。(Exception from HRESULT: 0x8007000B) 在sql中将varchar型转换成int型再进行排序 当一组单选按钮中的一个选中,后文本框为只读属性 选中checkbox后才能填写输入框 ASP.NET中显示农历时间 人生最不值得你去做的事情 改变自己,拥抱生活 PL/SQL Developer 8注册码 在.net 环境下,进行了伪静态页面处理后,后台的Fckeditor就不能正常显示了 奔三的尴尬年纪,你要知道的44件事 断章 mysql下sql语句 update 字段=字段+字符串 oracel 10g 网络服务管理: 主机登录 推荐给女孩子的书:一本本读完 气质必备 像草一样,朝海生长 做个睿智的女人 那一次,我们属于彼此 屏蔽浏览器左下角的js错误提示
discuz !NT 3.5 论坛整合 .net 网站用户登录,退出
分飞 · 2012-04-18 · via 博客园 - 分飞

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls.WebParts;
using System.Data;
using System.Text;
using Discuz.Toolkit;
using System.Text.RegularExpressions;
using System.Security.Cryptography;
using System.Xml.Linq;
using System.IO;
using Discuz.Common;
using Discuz.Forum;
using Discuz.Config;
using Discuz.Entity; 

protected void Page_Load(object sender, EventArgs e)
    {
        
        if (!IsPostBack)
        {
            if (Request.Cookies["dnt"] != null && Request.Cookies["dnt"].Values["userid"] != null)
            { //从cookie中获得UserID 
                int uid = Convert.ToInt32(Request.Cookies["dnt"].Values["userid"].ToString());
                //得到这个用户的全部信息 
                UserInfo a = Discuz.Forum.Users.GetUserInfo(uid);
                //打印出来看看对不对。
                
//Response.Write(a.Username); 
                 
                this.denglu.Visible = false;
                this.tuichu.Visible = true;
                Label1.Text =  a.Username ;
            }
            else
            {

                this.denglu.Visible = true;
                this.tuichu.Visible = false;
            }
        }

//登录 
protected void ImageButton2_Click(object sender, ImageClickEventArgs e)
    {
        string username = txtUserName.Text.Trim();
string password = txtPassWord.Text.Trim();

string apikey = "7c48cc03caede883471b42e5e9b533d8";//有Discuz后台管理扩展->通行证设置获得
string secret = "2ad48b05ac6cf0025011600d4e658db5";//同上
string url = "http://bbs.xxxx.com/";//你的bbs路径
string cookieDomain = "http://xxxx.com/";//你的域名
DiscuzSession ds = new DiscuzSession(apikey, secret, url);
int id = ds.GetUserID(username);//根据用户名获取用户ID
//用户名存在
if (id > 0)
{
//取得用户数据库中的密码
 string dbpassword=ds.GetUserInfo(id).Password;
//判断数据库中的密码和输入的密码是否一致
 if (dbpassword == FormsAuthentication.HashPasswordForStoringInConfigFile(password, "MD5").ToLower())
 {
 //输入密码正确,则登录
     ds.Login(id, password, true10000, cookieDomain);

     Discuz.Config.GeneralConfigInfo config = Discuz.Config.GeneralConfigs.GetConfig();
     
     //删除之前的错误登录信息
     LoginLogs.DeleteLoginLog(DNTRequest.GetIP());
     //根据积分公式刷新用户总积分
     UserCredits.UpdateUserCredits(id);
     //写入用户登录后的cookie
     ForumUtils.WriteUserCookie(id, 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(id, DNTRequest.GetIP());

  this.denglu.Visible = false;
  this.tuichu.Visible = true;
  Label1.Text = ds.GetUserInfo(id).UserName;

 
 }
 else
 {
  //密码输入错误
   Label1.Text = "密码输入错误";
    
 }
}
else
{
    Label1.Text = "用户名不存在";
 }

    }

//退出
 protected void ImageButton3_Click(object sender, ImageClickEventArgs e)
    {
        //string username = txtUserName.Text.Trim();
        
//string password = txtPassWord.Text.Trim();
        if (Request.Cookies["dnt"] != null && Request.Cookies["dnt"].Values["userid"] != null)
        {
            int uid = Convert.ToInt32(Request.Cookies["dnt"].Values["userid"].ToString());
            UserInfo a = Discuz.Forum.Users.GetUserInfo(uid); 

            string apikey = "7c48cc03caede883471b42e5e9b533d8";//有Discuz后台管理扩展->通行证设置获得
            string secret = "2ad48b05ac6cf0025011600d4e658db5";//同上
            string url = "http://bbs.xxxx.com/";//你的bbs路径
            string cookieDomain = "http://xxxx.com/";//你的域名
            DiscuzSession ds = new DiscuzSession(apikey, secret, url);
            ds.Logout(cookieDomain);
            int id = ds.GetUserID(a.Username);
            int olid = OnlineUsers.GetOlidByUid(id);
            OnlineUsers.DeleteRows(olid);
            ForumUtils.ClearUserCookie();
            this.denglu.Visible = true;
            this.tuichu.Visible = false;

        }
    }