discuz! NT3.6 and website Integration (Operation user information) solutions

Source: Internet
Author: User

First, the scenario I need to address is:

Main station http://h31bt.com need to call BBS user information, instead of building a set of user information, forum domain name is bbs.h31bt.com, two not the same file directory of the host, so need to solve cross-domain problems,

I hereby record how to solve this problem.

Here's a workaround for me, without the use of a third-party SDK.

1. Download the compiled forum in the Forum folder on the server, using BBS. Domain name access is OK.

2. Operation of the main station's ASP, introduce 4 DLLs into the project, respectively:

Using discuz.common;using discuz.config;using discuz.entity;using discuz.forum;

You need to copy the corresponding DLL into the bin directory of the Web site, and then add references;

3. The operation obtains some code of the user information:

            Discuz.Config.GeneralConfigInfo Config = Discuz.Config.GeneralConfigs.GetConfig ();            Onlineuserinfo oluserinfo = Discuz.Forum.OnlineUsers.UpdateInfo (config. Passwordkey, CONFIG. Onlinetimeout);            UserID = Oluserinfo. Userid;            if (UserID = =-1)                Response.Redirect ("http://bbs.h31bt.com/index.aspx");            Username = Oluserinfo. Username;            UserInfo US = users.getuserinfo (userid);            Userscore = Users.getuserextcredits (userid, 3);

From the local cookie to read the user's information, if not found, UserID return-1, direct to the forum to let users log in.

4. Update the user's points information, compare users to edit a content, need to reward the user some points or something, need to operate the points information:

UserInfo US = users.getuserinfo (userid); float USS = Users.getuserextcredits (UserID, 3); Users.updateuserextcredits (UserID, 3, 1);//The third point of the Operations forum, increase the points to 1

By userinfo the user information class can operate the user's points, ratings and other information.

5. The above code implementation will also need to set some content to ensure the success of the cross-domain cookies;

Set Config/general.config <CookieDomain/> change to <CookieDomain>domainname.XXX</CookieDomain>

6. Copy the config folder below the forum, dnt.config the file to the directory folder of the master station;

7. Because the download source code using VS2010 compiled into the. net4.0 framework program, resulting in management background if there is an HTML statement will be reported unsafe, direct failure, need to modify the place:

Forum Force requestvalidationmode= "2.0" in the following Web. config

Summarize:

1. The main station can now get the user points information, operation related user class, realize the user login and registration is no problem;

2. Because 3.9 of the original code is not, so there is no way to use the QQ integrated login code, it is a pity;

Problems encountered:

1. Due to the server in the United States, time difference of 13 hours, the discovery of user registration, the main station to obtain user information is always unsuccessful, return 11, but after 13 hours, this user information can be obtained.

Need to analyze the source code for the existence of a time lag problem;

2. If the forum is set up on another server, you need to consider how to invoke the problem, if the database master can not access, then you need to consider other methods.

I hope that you have experience in this area, together to discuss the exchange, thank you.

discuz! NT3.6 and website Integration (Operation user information) solutions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.