Discuz!NT forum integrates the ASP program forum implementation code. Copy the code code as follows:
Record cookies page code when logging in
<!--#include file=md5.asp--> //32-bit md5 encrypted file must be called. This file is available everywhere, so I will not provide it.
<%
dim Username,Password,Question,Answer,Expires,Verify
Username=replace(trim(Request.form(Username)),','') //Username
Password=replace(trim(Request.form(Password)),','') //User password
Question=replace(trim(Request.form(Question)),','') //Password question
Answer=replace(trim(Request.form(Answer)),','') //Password answer
Expires=replace(trim(Request.form(Expires)),','') //cookies recording duration
Verify=replace(trim(Request.form(Verify)),','') //Verification code
//Add submission verification here, such as xxx cannot be empty or field length, etc.
sql=select * from [dnt_users] where username='&Username' //For convenience, I will not add the filter function here. If you use it, be sure to add it, otherwise it will be injected.
set rs=conn.execute(sql)
if rs.eof then
Response.Write (<script>alert('Prompt!/n/nUser account error!');history.back();</script>)
Response.end
else
if rs(password)<>md5(Password) then
Response.Write (<script>alert('Prompt!/n/nUser password is incorrect!');history.back();</script>)
Response.end
else
if rs(secques)<>Answer then
Response.Write (<script>alert('Prompt!/n/nSafe answer is wrong!');history.back();</script>)
Response.end
else
Dim DES,DESCode
Set DES=Server.CreateObject(DiscuzNT.DES)
DESCode=DES.Encode(&rs(password),Z143D2VBML) //Z143D2VBML is your DES encryption key. Please use Notepad to open the general.config file in the CONFIG directory and find the line <Passwordkey>Z846D4VVZL</Passwordkey>. The English between <Passwordkey> and </Passwordkey> is you The key, change the key to your file
Set DES=Nothing
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) = Expires
if Expires<>0 then
Response.Cookies(dnt).Expires = DateAdd(N, Expires, Now())
end if
Response.Cookies(dnt).Domain = .xxx.com //Change to your domain name, note the . (dot) in front of it
Response.Cookies(dnt).Secure = False
end if
end if
end if
rs.close
set rs=nothing
//Add here to redirect or perform other operations after logging in. It’s up to you to decide.
%>
================================================== =========================================
Registration page code (login status after registration)
<!--#include file=md5.asp--> //32 is the md5 encrypted file, which must be called. This file is available everywhere, so I will not provide it.
<%
dim Username,Password,CheckPassword,Email,Question,Answer,Verify
Username=replace(trim(Request.form(Username)),','') //Username
Password=replace(trim(Request.form(Password)),','') //User password
CheckPassword=replace(trim(Request.form(CheckPassword)),','') //Password verification
Question=replace(trim(Request.form(Question)),','') //Password question
Answer=replace(trim(Request.form(Answer)),','') //Password answer
Expires=replace(trim(Request.form(Expires)),','') //cookies recording duration
Verify=replace(trim(Request.form(Verify)),','') //Verification code
//Add submission verification here, such as xxx cannot be empty or field length, etc.
sql=select * from [dnt_users] where username='&Username' //For convenience, I will not add the filter function here. If you use it, be sure to add it, otherwise it will be injected.
set rs=conn.execute(sql)
if not rs.eof then
Response.Write (<script>alert('Prompt!/n/n user account has been registered!');history.back();</script>)
Response.end
end if
rs.close
set rs=nothing
sql=select * from [dnt_users] where Email='&Email' //For convenience, I will not add the filter function here. If you use it, be sure to add it, otherwise it will be injected.
set rs=conn.execute(sql)
if not rs.eof then
Response.Write (<script>alert('Prompt!/n/n email address has been registered!');history.back();</script>)
Response.end
end if
rs.close
set rs=nothing
ip = request.servervariables(http_x_forwarded_for)
if ip = then ip = request.servervariables(remote_addr)
sql=insert into [dnt_users] (username,nickname,password,secques,gender,adminid,groupid,groupexpiry,extgroupids,regip,joindate,lastip,lastvisit,lastactivity,lastpost,lastpostid,lastposttitle,posts,digestposts,oltime,pageviews,credits,extcredits1, extcredits2,extcredits3,extcredits4,extcredits5,extcredits6,extcredits7,extcredits8,avatarshowid,email,bday,sigstatus,tpp,ppp,templateid,pmsound,showemail,newsletter,invisible,newpm,newpmcount,accessmasks,onlinestate) values ('&Username',' ','&MD5(Password)','&Answer',0,0,10,0,' ','&ip','&now()','&ip','&now()' ,'&now()','&now()',0,' ',0,0,0,0,0,'0.00','0.00','0.00','0.00','0.00','0.00','0.00','0.00',0,'&Email', ' ',1,0,0,0,1,1,1,0,1,1,0,1)
set rs=conn.execute(sql)
sql=select uid from [dnt_users] where username='&Username' //For convenience, I will not add the filter function here. If you use it, be sure to add it, otherwise it will be injected.
set rs=conn.execute(sql)
Uid=rs(0)
sql=insert into [dnt_userfields] (uid,avatar,avatarwidth,avatarheight,authtime,authflag) values ('&Uid','avatars/common/0.gif',0,0,'&now()',0)
set rs=conn.execute(sql)
sql=update [dnt_statistics] set totalusers=totalusers+1,lastusername='&Username',lastuserid='&Uid'
set rs=conn.execute(sql)
sql=select * from [dnt_users] where username='&Username' //For convenience, I will not add the filter function here. If you use it, be sure to add it, otherwise it will be injected.
set rs=conn.execute(sql)
if rs.eof then
Response.Write (<script>alert('Prompt!/n/nUser account error!');history.back();</script>)
Response.end
else
if rs(password)<>md5(Password) then
Response.Write (<script>alert('Prompt!/n/nUser password is incorrect!');history.back();</script>)
Response.end
else
Dim DES,DESCode
Set DES=Server.CreateObject(DiscuzNT.DES)
DESCode=DES.Encode(&rs(password),Z143D2VBML) //Z143D2VBML is your DES encryption key. Please use Notepad to open the general.config file in the CONFIG directory and find the line <Passwordkey>Z846D4VVZL</Passwordkey>. The English between <Passwordkey> and </Passwordkey> is you The key, change the key to your file
Set DES=Nothing
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 = .xxx.com //Change to your domain name, note the . (dot) in front of it
Response.Cookies(dnt).Secure = False
end if
end if
rs.close
set rs=nothing
//Add post-registration redirection here or add synchronized user data to another user table. You can figure it out yourself.
%>
================================================== =========================================
Edit page code (no need to log in again after editing password)
<!--#include file=md5.asp--> //32 is the md5 encrypted file, which must be called. This file is available everywhere, so I will not provide it.
<%
dim Username,Password,CheckPassword,Email,Question,Answer,Verify
Username=replace(trim(Request.form(Username)),','') //Username
Password=replace(trim(Request.form(Password)),','') //User password
CheckPassword=replace(trim(Request.form(CheckPassword)),','') //Password verification
Question=replace(trim(Request.form(Question)),','') //Password question
Answer=replace(trim(Request.form(Answer)),','') //Password answer
Expires=replace(trim(Request.form(Expires)),','') //cookies recording duration
Verify=replace(trim(Request.form(Verify)),','') //Verification code
//Add submission verification here, such as xxx cannot be empty or field length, etc.
if Password<> then
if Password<>CheckPassword then
Response.Write (<script>alert('Prompt!/n/nThe verification password is different from the user password!');history.back();</script>)
Response.end
end if
Password=MD5(Password)
else
Password=U_Password //U_Password is your 32-bit MD5 encrypted password, which is read out during verification and used for verification here.
end if
if AnswerTrue=true then
if Question<>0 then
Answer=mid(MD5(Answer+MD5(Question)),16,8)
else
Answer=
end if
else
Answer=U_Secques //U_Secques is your password answer, which is read out during verification and used for verification here.
end if
ip = request.servervariables(http_x_forwarded_for)
if ip = then ip = request.servervariables(remote_addr)
sql=select * from [dnt_users] where username='&Username' //For convenience, I will not add the filter function here. If you use it, be sure to add it, otherwise it will be injected.
set rs=Conn.execute(Sql)
If Rs.eof then
Response.Write (<script>alert('Prompt!/n/nUser account error!');history.back();</script>)
Response.end
else
sql=select * from [dnt_users] where email='&Email' and username<>'&Username' //For convenience, I will not add the filter function here. If you use it, you must add it, otherwise it will be injected.
set rs=conn.execute(sql)
if not rs.eof then
response.write (<script>alert('Friendly reminder!/n/n mailbox has been used!');history.back();</script>)
response.end
else
sql=update [dnt_users] set password='&Password',secques='&Answer',email='&Email' where username='&Username' //For convenience, I will not add the filter function here, if you use it, be sure plus, otherwise injected
set rs=conn.execute(sql)
Set DES=Server.CreateObject(DiscuzNT.DES)
DESCode=DES.Encode(&Password,Z143D2VBML) //Z143D2VBML is your DES encryption key. Please use Notepad to open the general.config file in the CONFIG directory and find the line <Passwordkey>Z846D4VVZL</Passwordkey>, <Passwordkey> The English between </Passwordkey> is your key, change the key to the one of your file
Set DES=Nothing
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 //Change to your domain name, pay attention to the leading part. (dot)
Response.Cookies(dnt).Secure = False
end if
end if
rs.close
set rs=nothing
//Add edit here and then redirect or add synchronized user data to another user table. You can figure it out yourself.
%>
================================================== ===========================================
Exit verification cookies page code
<%
Response.Cookies(dnt)(userid) =
Response.Cookies(dnt)(password) =
Response.Cookies(dnt)(tpp) =
Response.Cookies(dnt)(ppp) =
Response.Cookies(dnt)(pmsound) =
Response.Cookies(dnt)(invisible) =
Response.Cookies(dnt)(referer) =
Response.Cookies(dnt)(sigstatus) =
Response.Cookies(dnt)(expires) =
Response.Cookies(dnt).Expires =
Response.Cookies(dnt).Domain = .xxx.com
Response.Cookies(dnt).Secure = False
Response.Write (<script>alert('Prompt! User/n/n has logged out and logged in!');self.opener.location.reload();window.close();</script>)
Response.end
%>
================================================== ============================================
Verify the cookie page code. This is a piece of verification code I wrote for simplicity. They are basically the same. You can modify it according to your asp program verification file.
%>
Dim DES,DESCode
Set DES=Server.CreateObject(DiscuzNT.DES)
DESCode=DES.Decode(&request.cookies(dnt)(password),Z143D2VBML) //Z143D2VBML is your DES encryption key. Please use Notepad to open the general.config file in the CONFIG directory and find the line <Passwordkey>Z846D4VVZL</Passwordkey>. The English between <Passwordkey> and </Passwordkey> is you The key, change the key to your file
Set DES=Nothing
//The following is to read the database to verify whether your cookies are correct
dim U_UId,U_UserName,U_Password,U_Secques,U_Email
Sql=select uid,username,password,secques,email from [dnt_users] where uid='&request.cookies(dnt)(userid)' and password='&DESCode' //For convenience, I will not filter cookies users and passwords Function, if you use it, be sure to add it, otherwise it will be injected, just filter out some single quotes and some more sensitive ones.
Set Rs=Conn.execute(Sql)
if not rs.eof then
founduser = true
U_UId = Rs(0)
U_UserName = Rs(1)
U_Password = Rs(2)
U_Secques = Rs(3)
U_Email = Rs(4)
else
founduser = false
end if
rs.close
set rs=nothing
%>