หากเว็บไซต์ส่วนตัวมีโมดูลการลงทะเบียนสมาชิก + ฟอรัม Dongwang มันจะไม่ใช่เรื่องง่ายที่จะรวมเว็บไซต์เข้ากับระบบ Dongwang Forum เพื่อให้ได้รับการอัปเดตข้อมูลผู้ใช้ การเข้าสู่ระบบ และการดำเนินการอื่น ๆ ระหว่างระบบเว็บที่แตกต่างกัน ถึงแม้ว่า Dongwang จะมีให้ก็ตาม คำแนะนำโดยละเอียดสำหรับนักพัฒนาอินเทอร์เฟซ API ของระบบ Dongwang Forum แต่มือใหม่อย่างฉันไม่สามารถเข้าใจได้สักระยะแล้ว ขออภัย ไม่เต็มใจที่จะยอมแพ้ หลังจากการวิจัยและทดสอบเกี่ยวกับการเข้าสู่ระบบ การยืนยัน และฟังก์ชันอื่นๆ ในที่สุดฉันก็ประสบความสำเร็จเช่นกัน
เวอร์ชันฟอรัมสำหรับการทดสอบนี้คือเวอร์ชัน 7.1.0 Sp1 และเวอร์ชันอื่นๆ ยังไม่ได้ทดสอบ
1. โครงสร้างไฟล์เว็บไซต์
wwwroot
┝index.asp
┝ ตรวจสอบ UserLogin.asp
┕bbs/
2. หลักการบูรณาการ
การนำการอัปเดตแบบซิงโครนัสไปใช้นั้นไม่ใช่เรื่องยาก ปัญหาหลักของการรวมระบบคือการเข้าสู่ระบบแบบซิงโครนัส ดังนั้นเราจะมุ่งเน้นไปที่การหารือถึงวิธีการเข้าสู่ระบบแบบซิงโครนัส วิธีการของฉันคือการรวมตารางผู้ใช้ไซต์หลักเข้ากับตารางผู้ใช้ Dongwang Dv_User (เพื่อหลีกเลี่ยงปัญหาในการอัปเดตสองไลบรารีในอนาคต) คุณสามารถเพิ่มฟิลด์ลงใน Dv_User ได้ตามต้องการ และแก้ไข bbs/login.asp และ bbs/inc ทำการแก้ไขอย่างเหมาะสมใน /Dv_ClsMain.asp; เมื่อเข้าสู่ระบบ ให้ส่งแบบฟอร์มไปที่ bbs/login.asp เพื่อตรวจสอบความถูกต้อง ข้อมูลผู้ใช้
3. เพิ่มไฟล์ที่แก้ไขใหม่
รหัส 1.index.asp:
<html>
<หัว>
<meta http-equiv=เนื้อหาประเภทเนื้อหา=ข้อความ/html; charset=gb2312 />
<title>การบูรณาการเว็บไซต์ส่วนตัวและเครือข่ายแบบไดนามิก (www.mzwu.com)</title>
</หัว>
<ร่างกาย>
<!--#include file=CheckUserLogin.asp -->
-
ถ้า CheckUserLogin แล้ว
Response.write(<a href=bbs/logout.asp?back=1>ออกจากระบบ</a><p></p>)
Response.write (ชื่อผู้ใช้: & คำขอคุกกี้ (ชื่อผู้ใช้) & <br>)
Response.write(เพศ: & คำขอคุกกี้ (เพศ) & <br>)
Response.write (เวลาลงทะเบียน: & Request.Cookies (joindate) & <br>)
Response.write (เข้าสู่ระบบครั้งล่าสุด: & Request.Cookies (lastlogin) & <br>)
Response.write(จำนวนล็อกอิน: & Request.Cookies(userlogins) & <br>)
Response.write (ประเภทเบราว์เซอร์: & Request.Cookies (เบราว์เซอร์) & <br>)
Response.write (เวอร์ชันของเบราว์เซอร์: & Request.Cookies (เวอร์ชัน) & <br>)
Response.write(ระบบปฏิบัติการ: & Request.Cookies(แพลตฟอร์ม) & <br>)
อื่น
-
<form id=form1 name=form1 method=post action=bbs/login.asp?action=chk&back=1>
ชื่อผู้ใช้:
<ชื่ออินพุต=ประเภทชื่อผู้ใช้=ข้อความ id=ขนาดชื่อผู้ใช้=10 />
<br />
รหัสผ่าน:
<ชื่ออินพุต=ประเภทรหัสผ่าน=รหัสผ่าน id=ขนาดรหัสผ่าน=10 />
<ประเภทอินพุต=ชื่อส่ง=ค่าส่ง=เข้าสู่ระบบ/>
</แบบฟอร์ม>
-
จบถ้า
-
<p></p><a href=bbs/>เข้าสู่ฟอรัม</a>
</ร่างกาย>
</html>
2.รหัส CheckUserLogin.asp:
<!--#รวมไฟล์=bbs/inc/Dv_ClsMain.asp-->
-
ฟังก์ชั่น CheckUserLogin()
Dim Dvbbs, UserSession
Const MsxmlVersion=.3.0
ตั้งค่า Dvbbs = Cls_Forum ใหม่
ตั้งค่า UserSession=Server.CreateObject(msxml2.FreeThreadedDOMDocument& MsxmlVersion)
ถ้า UserSession.loadxml(เซสชัน(Dvbbs.CacheName & UserID)&) แล้ว
ถ้า UserSession.documentElement.selectSingleNode(userinfo/@userid).text<>0 จากนั้น
'เข้าสู่ระบบฟอรั่มสำเร็จแล้ว'
CheckUserLogin = จริง
'ต่อไปนี้คือวิธีการรับข้อมูลผู้ใช้บางส่วน คุณสามารถบันทึกไว้ในคุกกี้หรือเซสชันเพื่อให้ใช้งานได้ง่าย:
'รหัสผู้ใช้: UserSession.documentElement.selectSingleNode(userinfo/@userid).text
'ชื่อผู้ใช้: UserSession.documentElement.selectSingleNode(userinfo/@username).text
'วันเกิด: UserSession.documentElement.selectSingleNode(userinfo/@userbirthday).text
'อีเมล: UserSession.documentElement.selectSingleNode(userinfo/@useremail).text
'เพศ: UserSession.documentElement.selectSingleNode(userinfo/@usersex).text '0 เป็นเพศหญิง 1 เป็นชาย
'เวลาลงทะเบียน: UserSession.documentElement.selectSingleNode(userinfo/@joindate).text
'เข้าสู่ระบบครั้งล่าสุด: UserSession.documentElement.selectSingleNode(userinfo/@lastlogin).text
'จำนวนการเข้าสู่ระบบ: UserSession.documentElement.selectSingleNode(userinfo/@userlogins).text
'เงิน: UserSession.documentElement.selectSingleNode(userinfo/@userwealth).text
'คะแนน: UserSession.documentElement.selectSingleNode(userinfo/@userep).text
'เสน่ห์: UserSession.documentElement.selectSingleNode(userinfo/@usercp).text
'IP เข้าสู่ระบบล่าสุด: UserSession.documentElement.selectSingleNode(userinfo/@userlastip).text
'ประเภทเบราว์เซอร์: UserSession.documentElement.selectSingleNode(agent/@browser).text
'เวอร์ชันของเบราว์เซอร์: UserSession.documentElement.selectSingleNode(agent/@version).text
'ระบบปฏิบัติการ: UserSession.documentElement.selectSingleNode(agent/@platform).text
'การเยี่ยมชม IP: UserSession.documentElement.selectSingleNode(agent/@ip).text
'ตัวอย่างการใช้งาน:
Response.Cookies(ชื่อผู้ใช้) = UserSession.documentElement.selectSingleNode(userinfo/@username).text
Response.Cookies(joindate) = UserSession.documentElement.selectSingleNode(userinfo/@joindate).text
ถ้า UserSession.documentElement.selectSingleNode(userinfo/@usersex).text=0 จากนั้น
Response.Cookies(sex) = สาวสวย
อื่น
Response.Cookies(sex) = พี่ชายสุดเท่
จบถ้า
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
อื่น
'ได้เยี่ยมชมฟอรั่มแต่ยังไม่ได้เข้าสู่ระบบ สถานะแขก'
CheckUserLogin = เท็จ
จบถ้า
อื่น
'ยังไม่ได้เยี่ยมชมฟอรั่ม
CheckUserLogin = เท็จ
จบถ้า
ตั้งค่า UserSession = ไม่มีเลย
ตั้ง Dvbbs = ไม่มีเลย
ฟังก์ชันสิ้นสุด
-
3. ส่วนสีแดงใหม่จะถูกเพิ่มใน bbs/login.asp เพื่อให้คุณยังสามารถกลับไปยังหน้าแรกได้หลังจากเข้าสู่ระบบหน้าแรกของเว็บไซต์ได้สำเร็จ:
ชื่อมาติ่มซำ
ถ้า instr(lcase(request(comeurl)),reg.asp)>0 หรือ instr(lcase(request(comeurl)),login.asp)>0 หรือ trim(request(comeurl))= จากนั้น
มาurlname=
comeurl=index.asp
อื่น
comeurl=คำขอ(comeurl)
comeurlname=<li><a href=&request(comeurl)&>&request(comeurl)&</a></li>
สิ้นสุดถ้า
ถ้า request(back)=1 แล้ว
การตอบสนองการเปลี่ยนเส้นทาง (../index.asp)
สิ้นสุดถ้า
Dim TempStr
TempStr = template.html(2)
'ถ้า Dvbbs.Forum_ChanSetting(0)=1 และ Dvbbs.Forum_ChanSetting(10)=1 และ Dvbbs.Forum_ChanSetting(12)=1 แล้ว
' TempStr = แทนที่(TempStr,{$ray_logininfo},template.html(3))
'อื่น
' TempStr = แทนที่(TempStr,{$ray_logininfo},)
'สิ้นสุดถ้า
'------------------------------------------------ - ---------------
'การรวมระบบ
'------------------------------------------------ - ---------------
ถ้า DvApi_Enable แล้ว
ตอบกลับเขียน DvApi_SaveCookie
การตอบสนองฟลัช
สิ้นสุดถ้า
'------------------------------------------------ - ---------------
TempStr = แทนที่(TempStr,{$ray_logininfo},)
TempStr = แทนที่(TempStr,{$comeurl},comeurl)
TempStr = แทนที่(TempStr,{$comeurlinfo},comeurlname)
TempStr = แทนที่(TempStr,{$forumname},Dvbbs.Forum_Info(0))
การตอบสนองเขียน TempStr
TempStr=
ฟังก์ชันสิ้นสุด
4. มีการเพิ่มส่วนสีแดงใหม่ลงใน bbs/logout.asp เพื่อให้คุณยังสามารถกลับไปยังหน้าแรกได้หลังจากคลิกออกจากระบบบนหน้าแรกของเว็บไซต์:
'------------------------------------------------ - ---------------
'การรวมระบบ
'------------------------------------------------ - ---------------
หรี่ DvApi_Obj, DvApi_SaveCookie, SysKey
ถ้า DvApi_Enable แล้ว
MD5OLD = 1
SysKey = Md5 (Dvbbs. MemberName & DvApi_SysKey,16)
MD5OLD = 0
ตั้งค่า DvApi_Obj = DvApi ใหม่
DvApi_SaveCookie = DvApi_Obj.SetCookie(SysKey,Dvbbs.MemberName,,)
ตั้งค่า DvApi_Obj = ไม่มีเลย
ตอบกลับเขียน DvApi_SaveCookie
การตอบสนองฟลัช
สิ้นสุดถ้า
ถ้า request(back)=1 แล้ว
การตอบสนองการเปลี่ยนเส้นทาง (../index.asp)
สิ้นสุดถ้า
'------------------------------------------------ - ---------------
'การตอบสนองการเปลี่ยนเส้นทาง Dvbbs.Forum_Info (11)
response.write<script language=JavaScript>
response.writesetTimeout(window.location='&Dvbbs.Forum_Info(11)&',1000);
response.write</script>
4. การตั้งค่า Dongwang: ลบรหัสยืนยันการเข้าสู่ระบบ ตกลง การรวมระบบเสร็จสมบูรณ์
5. ส่วนขยาย:
ฟิลด์ในตาราง Dv_User เริ่มต้นบางครั้งไม่สามารถตอบสนองความต้องการที่แท้จริงของเราได้ เราจำเป็นต้องเพิ่มฟิลด์ใหม่เพื่อขยาย เรามาเริ่มกันเลย:
1. เปิดตาราง Dv_User และเพิ่มฟิลด์ประเภทข้อความ info_1
2. ในฟังก์ชัน ChkUserLogin ของ bbs/login.asp
Sql=เลือก UserID, UserName, UserPassword, UserEmail, UserPost, UserTopic, UserSex, UserFace, UserWidth, UserHeight, JoinDate, LastLogin, Lastlogin ตามเวลาที่กำหนด, LastLogin เป็น เวลาใช้งาน, UserLogins, Lockuser, Userclass, UserGroupID, UserGroup, userWealth, userEP, userCP, UserPower, UserBirthday, UserLastIP, UserDel, UserIsBest, Use rHidden, UserMsg, IsChallenge, UserMobile, TitlePic, ชื่อผู้ใช้, TruePassWord, UserToday, UserMoney, UserTicket, FollowMsgID, Vip_StarTime, Vip_EndTime, userid เป็นคณะกรรมการ
แก้ไขเป็น:
Sql=เลือก UserID, UserName, UserPassword, UserEmail, UserPost, UserTopic, UserSex, UserFace, UserWidth, UserHeight, JoinDate, LastLogin, Lastlogin ตามเวลาที่กำหนด, LastLogin เป็น เวลาใช้งาน, UserLogins, Lockuser, Userclass, UserGroupID, UserGroup, userWealth, userEP, userCP, UserPower, UserBirthday, UserLastIP, UserDel, UserIsBest, Use rHidden, UserMsg, IsChallenge, UserMobile, TitlePic, ชื่อผู้ใช้, TruePassWord, UserToday, UserMoney, UserTicket, FollowMsgID, Vip_StarTime, Vip_EndTime, userid ในฐานะบอร์ด,info_1
3. ในฟังก์ชัน TrueCheckUserLogin ของ bbs/inc/Dv_ClsMain.asp
Sql=เลือก UserID,UserName,UserPassword,UserEmail,UserPost,UserTopic,UserSex,UserFace,UserWidth,UserHeight,JoinDate,LastLogin as cometime ,LastLogin,LastLogin as เวลาใช้งาน, UserLogins, Lockuser, Userclass, UserGroupID, UserGroup, userWealth, userEP, userCP, UserPower, UserBirthday, UserLastIP, UserDel, UserIsBest, Use rHidden, UserMsg, IsChallenge, UserMobile, TitlePic, ชื่อผู้ใช้, TruePassWord, UserToday, UserMoney, UserTicket, FollowMsgID, Vip_StarTime, Vip_EndTime, userid เป็นคณะกรรมการ
แก้ไขเป็น:
Sql=เลือก UserID,UserName,UserPassword,UserEmail,UserPost,UserTopic,UserSex,UserFace,UserWidth,UserHeight,JoinDate,LastLogin as cometime ,LastLogin,LastLogin as เวลาใช้งาน, UserLogins, Lockuser, Userclass, UserGroupID, UserGroup, userWealth, userEP, userCP, UserPower, UserBirthday, UserLastIP, UserDel, UserIsBest, Use rHidden, UserMsg, IsChallenge, UserMobile, TitlePic, ชื่อผู้ใช้, TruePassWord, UserToday, UserMoney, UserTicket, FollowMsgID, Vip_StarTime, Vip_EndTime, userid ในฐานะบอร์ด,info_1
4.ตรวจสอบ UserLogin.asp
Response.Cookies(platform) = UserSession.documentElement.selectSingleNode(agent/@platform).text
เพิ่มหลังจาก
Response.Cookies(info_1) = UserSession.documentElement.selectSingleNode(userinfo/@info_1).text
5.ดัชนี.asp
Response.write(ระบบปฏิบัติการ: & Request.Cookies(แพลตฟอร์ม) & <br>)
เพิ่มหลังจาก
Response.write (ใหม่: & คำขอคุกกี้ (info_1) & <br>)
6.ตกลง สำเร็จแล้ว