Although the dynamic network has provided a detailed "Dynamic Network Forum system API Interface developer Guide", but such as my rookie 1:30 will be very detailed, Khan. Not reconciled, in its login, validation and other functions of a study to be tested after the end of the small have become, rookie also have rookie way:
The forum version of this test is versioned 7.1.0 Sp1, and no other versions have been tested
I. Website file structure
Wwwroot
┝index.asp
┝checkuserlogin.asp
┕bbs/
Second, the principle of integration
It is not difficult to implement synchronization updates, and the main problem with consolidation is that it is difficult to log on synchronously, so our focus will be on how to implement synchronous logins. My approach is to integrate the Master Station user table into the Dynamic Network user table Dv_user (eliminates the trouble of updating two libraries later), you can add fields to dv_user as needed, and to bbs/login.asp and bbs/inc/dv_ clsmain.asp make appropriate changes, the form to the bbs/login.asp to verify the login, the main station based on the success of the log in the session after the record of the information to determine whether login success, and obtain user information.
Third, the new modification file
1.index.asp Code:
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "/>
<title> personal website and dynamic network integration (www.mzwu.com) </title>
<!--#Include file= "bbs/inc/dv_clsmain.asp"-->
<%
Function Checkuserlogin ()
Dim dvbbs,usersession
Const msxmlversion= ". 3.0"
Set Dvbbs = New cls_forum
Set usersession=server.createobject ("MSXML2. Freethreadeddomdocument "& Msxmlversion)
If Usersession.loadxml (Session (Dvbbs.cachename & "UserID") & "") Then
If UserSession.documentElement.selectSingleNode ("userinfo/@userid") .text<> "0" Then
' Login successfully in forum
Checkuserlogin = True
' Below is a user's access to some information that can be stored on its own cookies or in session for ease of use:
' User ID:UserSession.documentElement.selectSingleNode (' userinfo/@userid '). Text
' Username: UserSession.documentElement.selectSingleNode ("userinfo/@username"). Text
' Birthday: UserSession.documentElement.selectSingleNode ("userinfo/@userbirthday"). Text
' E-mail: UserSession.documentElement.selectSingleNode ("userinfo/@useremail"). Text
' Sex: UserSession.documentElement.selectSingleNode ("userinfo/@usersex"). Text ' 0 is female, 1 is male
' Registration time: UserSession.documentElement.selectSingleNode ("userinfo/@joindate"). Text
' Last Login: UserSession.documentElement.selectSingleNode ("userinfo/@lastlogin"). Text
' Logon times: UserSession.documentElement.selectSingleNode ("userinfo/@userlogins"). Text
' Money: UserSession.documentElement.selectSingleNode ("userinfo/@userwealth"). Text
' Integral: UserSession.documentElement.selectSingleNode ("userinfo/@userep"). Text
' Charm: UserSession.documentElement.selectSingleNode ("userinfo/@usercp"). Text
' Last Login IP:UserSession.documentElement.selectSingleNode (' userinfo/@userlastip '). Text
' Browser type: UserSession.documentElement.selectSingleNode ("agent/@browser"). Text
' Browser version: UserSession.documentElement.selectSingleNode ("agent/@version"). Text
' Operating system: UserSession.documentElement.selectSingleNode ("agent/@platform"). Text
' Visiting IP:UserSession.documentElement.selectSingleNode ("agent/@ip"). Text
' Example application:
Response.Cookies ("username") = UserSession.documentElement.selectSingleNode ("userinfo/@username"). Text
Response.Cookies ("joindate") = UserSession.documentElement.selectSingleNode ("userinfo/@joindate"). Text
If UserSession.documentElement.selectSingleNode ("userinfo/@usersex"). text= "0" Then
Response.Cookies ("sex") = "Beautiful Girl"
Else
Response.Cookies ("sex") = "cool Brother"
End If
Response.Cookies ("lastlogin") = UserSession.documentElement.selectSingleNode ("userinfo/@lastlogin"). Text
Response.Cookies ("userlogins") = UserSession.documentElement.selectSingleNode ("userinfo/@userlogins"). Text
Response.Cookies ("browser") = UserSession.documentElement.selectSingleNode ("agent/@browser"). Text
Response.Cookies ("version") = UserSession.documentElement.selectSingleNode ("agent/@version"). Text
Response.Cookies ("platform") = UserSession.documentElement.selectSingleNode ("agent/@platform"). Text
Else
' Visited forum has not been logged in for guest status
Checkuserlogin = False
End If
Else
' Never visited forum
Checkuserlogin = False
End If
Set usersession = Nothing
Set Dvbbs = Nothing
End Function
%>
3.bbs/login.asp new Red section, so that after the success of the site home login can still return home:
Dim Comeurlname
If InStr (LCase ("Comeurl"), "reg.asp") >0 or InStr (LCase (Request ("Comeurl")), "Login.asp") >0 or trim ( Request ("Comeurl") = "" Then
Comeurlname= ""
Comeurl= "Index.asp"
Else
Comeurl=request ("Comeurl")
Comeurlname= "<li><a href=" &request ("Comeurl") & ">" &request ("Comeurl") & "</a> </li> "
End If
If request ("back") = "1" Then
Response.Redirect (".. /index.asp ")
End If
Dim TempStr
TempStr = template.html (2)
' If dvbbs.forum_chansetting (0) =1 and dvbbs.forum_chansetting (a) =1 and dvbbs.forum_chansetting () =1
' TempStr = Replace (TempStr, ' {$ray _logininfo} ', template.html (3))
' Else
' TempStr = Replace (TempStr, "{$ray _logininfo}", "")
' End If
'-----------------------------------------------------------------
' System integration
'-----------------------------------------------------------------
If dvapi_enable Then
Response.Write Dvapi_savecookie
Response.Flush
End If
'-----------------------------------------------------------------
TempStr = Replace (TempStr, "{$ray _logininfo}", "")
TempStr = Replace (TempStr, "{$comeurl}", Comeurl)
TempStr = Replace (TempStr, "{$comeurlinfo}", Comeurlname)
TempStr = Replace (TempStr, "{$forumname}", Dvbbs.forum_info (0))
Response.Write TempStr
Tempstr= ""
End Function
4.bbs/logout.asp new Red section, so that the home page after the exit login can still return home:
'-----------------------------------------------------------------
' System integration
'-----------------------------------------------------------------
Dim Dvapi_obj,dvapi_savecookie,syskey
If dvapi_enable Then
Md5old = 1
SysKey = Md5 (dvbbs.membername&dvapi_syskey,16)
Md5old = 0
Set dvapi_obj = New Dvapi
Dvapi_savecookie = Dvapi_obj.setcookie (Syskey,dvbbs.membername, "", "")
Set dvapi_obj = Nothing
Response.Write Dvapi_savecookie
Response.Flush
End If
If request ("back") = "1" Then
Response.Redirect (".. /index.asp ")
End If
The default Dv_user the fields in the table sometimes do not meet our actual requirements, we need to add new fields to expand it, do it:
1. Open Dv_user Table new text Type field Info_1
In the Chkuserlogin function of 2.bbs/login.asp
Sql= "Select Userid,username,userpassword,useremail,userpost,usertopic,usersex,userface,userwidth,userheight, Joindate,lastlogin,lastlogin as Cometime, Lastlogin as Activetime,userlogins,lockuser,userclass,usergroupid, Usergroup,userwealth,userep,usercp,userpower,userbirthday,userlastip,userdel,userisbest,userhidden,usermsg, Ischallenge,usermobile,titlepic,usertitle,truepassword,usertoday,usermoney,userticket,followmsgid,vip_startime , Vip_endtime,userid as Boardid "
Modified to:
Sql= "Select Userid,username,userpassword,useremail,userpost,usertopic,usersex,userface,userwidth,userheight, Joindate,lastlogin,lastlogin as Cometime, Lastlogin as Activetime,userlogins,lockuser,userclass,usergroupid, Usergroup,userwealth,userep,usercp,userpower,userbirthday,userlastip,userdel,userisbest,userhidden,usermsg, Ischallenge,usermobile,titlepic,usertitle,truepassword,usertoday,usermoney,userticket,followmsgid,vip_startime , Vip_endtime,userid as Boardid,info_1 "
In the Truecheckuserlogin function of 3.bbs/inc/dv_clsmain.asp
Sql= "Select Userid,username,userpassword,useremail,userpost,usertopic,usersex,userface,userwidth,userheight, Joindate,lastlogin as Cometime, Lastlogin,lastlogin as Activetime,userlogins,lockuser,userclass,usergroupid, Usergroup,userwealth,userep,usercp,userpower,userbirthday,userlastip,userdel,userisbest,userhidden,usermsg, Ischallenge,usermobile,titlepic,usertitle,truepassword,usertoday,usermoney,userticket,followmsgid,vip_startime , Vip_endtime,userid as Boardid "
Modified to:
Sql= "Select Userid,username,userpassword,useremail,userpost,usertopic,usersex,userface,userwidth,userheight, Joindate,lastlogin as Cometime, Lastlogin,lastlogin as Activetime,userlogins,lockuser,userclass,usergroupid, Usergroup,userwealth,userep,usercp,userpower,userbirthday,userlastip,userdel,userisbest,userhidden,usermsg, Ischallenge,usermobile,titlepic,usertitle,truepassword,usertoday,usermoney,userticket,followmsgid,vip_startime , Vip_endtime,userid as Boardid,info_1 "
In 4.checkuserlogin.asp
Response.Cookies ("platform") = UserSession.documentElement.selectSingleNode ("agent/@platform"). Text
Add after
Response.Cookies ("info_1") = UserSession.documentElement.selectSingleNode ("userinfo/@info_1"). Text
In 5.index.asp
Response.Write ("Operating system:" & Request.Cookies ("platform") & "<br>")
Add after
Response.Write ("Add:" & Request.Cookies ("Info_1") & "<br>")
6.OK, successfully completed
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.