Discuz record files for cross-origin Integration

Source: Internet
Author: User

\ Create by ahuinan 2009-6-22
\ Up by ahuian 2009-6-23
\ Up by ahuinan 2009-6-24

1. Convert the MD5 function in the common projectCodeChanged: Copy codeThe Code is as follows: return system. Web. Security. formsauthentication. hashpasswordforstoringinconfigfile (STR, "MD5"). tolower (). substring (8, 16 );

Implements unified encryption for the main site and forum.

2. Change encode and decode in the common project to direct return.

3. If session is used in ASP, determine whether a cookie exists. To exit the master site, you only need to add a clear cookie operation. The code can be as follows:Copy codeCode: Response. Cookies ("DNT") ("userid") = RS ("uid ")
Response. Cookies ("DNT") ("password") = descode
Response. Cookies ("DNT") ("TPP") = RS ("TPP ")
Response. Cookies ("DNT") ("PPP") = RS ("PPP ")
Response. Cookies ("DNT") ("pmsound") = RS ("pmsound ")
Response. Cookies ("DNT") ("invisible") = RS ("invisible ")
Response. Cookies ("DNT") ("Referer") = "index. aspx"
Response. Cookies ("DNT") ("sigstatus") = RS ("sigstatus ")
Response. Cookies ("DNT") ("expires") = 0
Response. Cookies ("DNT"). Domain = ".xxxx.com" // modify it to your domain name. Note that the front section contains. (Click)
Response. Cookies ("DNT"). Secure = false

4. Create a login_in.aspx under the aspx> 1 folder in the DNT forum to process all synchronous login requests. Implement synchronous login under multiple domain names. For example, you can implement login issues under www.a.com and www. B .com.

5. Because the Administrator has modified the encryption and decryption department, the admin/index. aspx. CS file needs to be rewritten and commented out:

Copy code The Code is as follows: // If (context. request. cookies ["dntadmin"] = NULL | context. request. cookies ["dntadmin"] ["key"] = NULL | forumutils. getcookiepassword (context. request. cookies ["dntadmin"] ["key"]. tostring (), config. passwordkey )! = (Oluserinfo. Password + secques + oluserinfo. userid. tostring ()))

Changed:Copy codeThe Code is as follows: if (context. Request. Cookies ["dntadmin"] = NULL | context. Request. Cookies ["dntadmin"] ["key"] = NULL)

In the synchronous login code file, the file name is index. aspx, which is directly copied to OK and copied to admin/index. aspx.

6. the following content is used to solve the cookie loss problem in IE6, because IE6 does not support the p3p protocol.ProgramAdding the protocol to the website is troublesome. Now you can add an HTTP header directly in IIS.

Custom HTTP header name: p3p
Custom HTTP header value: Cp = CaO PSA our
7. Possible integrated files: copy Code the code is as follows: <% @ page Language = "C #" %>
<% @ import namespace = "discuz. forum "%>
<% @ import namespace =" discuz. common "%>

If (UID! =-1)
{< br> loginlogs. deleteloginlog (discuz. common. dntrequest. getip ();
usercredits. updateusercredits (UID);
forumutils. writeusercookie (UID, discuz. common. utils. strtoint (dntrequest. getstring ("expires"), 500), username, dntrequest. getint ("templateid", 0), dntrequest. getint ("loginmode",-1);
users. updateuserlastvisit (UID, discuz. common. dntrequest. getip ();
}< BR >}< br>

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.