%
Dim Conn, ConnStr, db, PE_True, PE_False, PE_Now
Dim SqlDatabaseName, SqlPassword, SqlUsername, SqlHostIP
Dim SiteName, SiteTitle, SiteUrl, InstallDir, LogoUrl, WebmasterName, WebmasterEmail, SiteKey
Dim AdminDir, ShowSiteChannel, objName_FSO, FileExt_SiteIndex, FileExt_SiteSpecial
Dim PresentExpPerLogin
Dim EnableUserReg, RegFields_MustFill, EnableCheckCodeOfLogin
Dim RssCodeType
Dim LockIP, LockIPType
Dim UserTrueIP
Dim AllModules, PointName, PointUnit
Const CMS_Edition = 0 '0--普及版 1--标准版 2--专业版 3--企业版
Const eShop_Edition = 0 '0--普及版 1--标准版 2--专业版 3--企业版
Const CRM_Edition = 0 '0--普及版 1--标准版 2--专业版 3--企业版
Const SystemDatabaseType = "ACCESS" '系统数据库类型,"SQL"为MS SQL2000数据库,"ACCESS"为MS ACCESS 2000数据库,免费版只能使用ACCESS数据库
'如果是ACCESS数据库,请认真修改好下面的数据库的文件名
db = "/data/left2005.mdb" 'ACCESS数据库的文件名,请使用相对于网站根目录的的绝对路径
'如果是安装在网站根目录,直接修改文件名即可。如果是安装在网站某一目录下,则在前面加上此目录,
'例如,系统安装在“http://www.powereasy.net/PE2006/”目录下(PE2006为安装目录),则这里应该修改为:db="\PE2006\database\PowerEasy2006.mdb"
'如果是SQL数据库,请认真修改好以下数据库选项
SqlUsername = "PowerEasy" 'SQL数据库用户名
SqlPassword = "PowerEasy*9988" 'SQL数据库用户密码
SqlDatabaseName = "PowerEasy2006" 'SQL数据库名
SqlHostIP = "(local)" 'SQL主机IP地址(本地可用“127.0.0.1”或“(local)”,非本机请用真实IP)
Call OpenConn
Call GetSiteConfig
Call IsIPlock
Sub OpenConn()
On Error Resume Next
If SystemDatabaseType = "SQL" Then
ConnStr = "Provider = Sqloledb; User ID = " & SqlUsername & "; Password = " & SqlPassword & "; Initial Catalog = " & SqlDatabaseName & "; Data Source = " & SqlHostIP & ";"
Else
ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(db)
End If
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.open ConnStr
If Err Then
Err.Clear
Set Conn = Nothing
Response.Write "数据库连接出错,请检查Conn.asp文件中的数据库参数设置。"
Response.End
End If
If SystemDatabaseType = "SQL" Then
PE_True = "1"
PE_False = "0"
PE_Now = "getdate()"
Else
PE_True = "True"
PE_False = "False"
PE_Now = "Now()"
End If
End Sub
Sub CloseConn()
On Error Resume Next
If IsObject(Conn) Then
Conn.Close
Set Conn = Nothing
End If
End Sub
Sub GetSiteConfig()
Dim rsConfig
Set rsConfig = Conn.Execute("select * from PE_Config")
If rsConfig.BOF And rsConfig.EOF Then
rsConfig.Close
Set rsConfig = Nothing
Response.Write "网站配置数据丢失!系统无法正常运行!"
Response.End
Else
SiteName = rsConfig("SiteName")
SiteTitle = rsConfig("SiteTitle")
SiteUrl = rsConfig("SiteUrl")
InstallDir = rsConfig("InstallDir")
LogoUrl = rsConfig("LogoUrl")
WebmasterName = rsConfig("WebmasterName")
WebmasterEmail = rsConfig("WebmasterEmail")
SiteKey = rsConfig("SiteKey")
AdminDir = rsConfig("AdminDir")
ShowSiteChannel = rsConfig("ShowSiteChannel")
objName_FSO = rsConfig("objName_FSO")
FileExt_SiteIndex = rsConfig("FileExt_SiteIndex")
FileExt_SiteSpecial = rsConfig("FileExt_SiteSpecial")
EnableUserReg = rsConfig("EnableUserReg")
RegFields_MustFill = rsConfig("RegFields_MustFill")
AllModules = rsConfig("Modules")
PointName = rsConfig("PointName")
PointUnit = rsConfig("PointUnit")
RssCodeType = rsConfig("RssCodeType")
LockIP = rsConfig("LockIP")
LockIPType = rsConfig("LockIPType")
EnableCheckCodeOfLogin = rsConfig("EnableCheckCodeOfLogin")
PresentExpPerLogin = rsConfig("PresentExpPerLogin")
End If
rsConfig.Close
Set rsConfig = Nothing
Application("SiteKey") = SiteKey
Application("objName_FSO") = objName_FSO
End Sub
Sub IsIPlock()
UserTrueIP = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
If UserTrueIP = "" Then UserTrueIP = Request.ServerVariables("REMOTE_ADDR")
If session("IPlock") = "" Then
session("IPlock") = ChecKIPlock(LockIPType, LockIP, UserTrueIP)
End If
If session("IPlock") = True Then
Response.Write "对不起!您的IP(" & UserTrueIP & ")被系统限定。您可以和站长联系。"
Response.End
End If
End Sub
Function EncodeIP(Sip)
Dim strIP
strIP = Split(Sip, ".")
If UBound(strIP) < 3 Then
EncodeIP = 0
Exit Function
End If
If IsNumeric(strIP(0)) = 0 Or IsNumeric(strIP(1)) = 0 Or IsNumeric(strIP(2)) = 0 Or IsNumeric(strIP(3)) = 0 Then
Sip = 0
Else
Sip = CInt(strIP(0)) * 256 * 256 * 256 + CInt(strIP(1)) * 256 * 256 + CInt(strIP(2)) * 256 + CInt(strIP(3)) - 1
End If
EncodeIP = Sip
End Function
'白名单的端点可以访问和黑名单的端点将不允许访问。
Function ChecKIPlock(ByVal sLockType, ByVal sLockList, ByVal sUserIP)
Dim IPlock, rsLockIP
Dim arrLockIPW, arrLockIPB, arrLockIPWCut, arrLockIPBCut
IPlock = False
ChecKIPlock = IPlock
Dim i, sKillIP
If sLockType = "" Or IsNull(sLockType) Then Exit Function
If sLockList = "" Or IsNull(sLockList) Then Exit Function
If sUserIP = "" Or IsNull(sUserIP) Then Exit Function
sUserIP = CDbl(EncodeIP(sUserIP))
rsLockIP = Split(sLockList, "|||")
If sLockType = 4 Then
arrLockIPB = Split(Trim(rsLockIP(1)), "$$$")
For i = 0 To UBound(arrLockIPB)
If arrLockIPB(i) <> "" Then
arrLockIPBCut = Split(Trim(arrLockIPB(i)), "----")
IPlock = True
If CDbl(arrLockIPBCut(0)) > sUserIP Or sUserIP > CDbl(arrLockIPBCut(1)) Then IPlock = False
If IPlock Then Exit For
End If
Next
If IPlock = True Then
arrLockIPW = Split(Trim(rsLockIP(0)), "$$$")
For i = 0 To UBound(arrLockIPW)
If arrLockIPW(i) <> "" Then
arrLockIPWCut = Split(Trim(arrLockIPW(i)), "----")
IPlock = True
If CDbl(arrLockIPWCut(0)) <= sUserIP And sUserIP <= CDbl(arrLockIPWCut(1)) Then IPlock = False
If IPlock Then Exit For
End If
Next
End If
Else
If sLockType = 1 Or sLockType = 3 Then
arrLockIPW = Split(Trim(rsLockIP(0)), "$$$")
For i = 0 To UBound(arrLockIPW)
If arrLockIPW(i) <> "" Then
arrLockIPWCut = Split(Trim(arrLockIPW(i)), "----")
IPlock = True
If CDbl(arrLockIPWCut(0)) <= sUserIP And sUserIP <= CDbl(arrLockIPWCut(1)) Then IPlock = False
If IPlock Then Exit For
End If
Next
End If
If IPlock = False And (sLockType = 2 Or sLockType = 3) Then
arrLockIPB = Split(Trim(rsLockIP(1)), "$$$")
For i = 0 To UBound(arrLockIPB)
If arrLockIPB(i) <> "" Then
arrLockIPBCut = Split(Trim(arrLockIPB(i)), "----")
IPlock = True
If CDbl(arrLockIPBCut(0)) > sUserIP Or sUserIP > CDbl(arrLockIPBCut(1)) Then IPlock = False
If IPlock Then Exit For
End If
Next
End If
End If
ChecKIPlock = IPlock
End Function
%>
<%
dim Conn_User,db_User,db_User_Table,db_Message_Table,PE_True_User,PE_False_User,PE_Now_User
Dim SqlDatabaseName_User,SqlPassword_User,SqlUsername_User,SqlHostIP_User
const UserDatabaseType="ACCESS" '用户数据库类型,"SQL"为MS SQL2000数据库,"ACCESS"为MS ACCESS 2000数据库
const UserTableType = "MyPower" ' "Dvbbs6.0" --- 整合动网论坛6.0
' "Dvbbs7.0" --- 整合动网论坛7.0
' "MyPower" --- 不整合论坛
const Forum_dir="bbs/" '论坛所在目录,请使用相对路径
'如果是ACCESS数据库,请认真修改好下面的数据库的文件名。如果整合论坛,则此处应该为论坛的数据库文件名。
db_User="\leftnews\database\lefts.mdb" 'ACCESS数据库的文件名,请使用相对于网站根目录的的绝对路径
'如果是安装在网站根目录,直接修改文件名即可。如果是安装在网站某一目录下,则在前面加上此目录,
'例如,系统安装在“http://www.asp163.net/PE4/”目录下(PE4为安装目录),则这里应该修改为:db="\PE4\database\PowerEasy4.mdb"
'如果是SQL数据库,请认真修改好以下数据库选项。如果整合论坛,则此处应该为论坛的数据库选项。
SqlUsername_User = "PowerEasy" 'SQL数据库用户名
SqlPassword_User = "PowerEasy*9988" 'SQL数据库用户密码
SqlDatabaseName_User = "PowerEasy40" 'SQL数据库名
SqlHostIP_User = "127.0.0.1" 'SQL主机IP地址(本地可用“127.0.0.1”或“(local)”,非本机请用真实IP)
'*************************************************
'以下部分不用修改了。
'*************************************************
select case UserTableType
case "Dvbbs7.0"
db_User_Table="Dv_User"
db_Message_Table="Dv_Message"
case "Dvbbs6.0"
db_User_Table="[User]"
db_Message_Table="Message"
case else
db_User_Table="PE_User"
db_Message_Table="PE_Message"
End select
call OpenConn_User()
sub OpenConn_User()
On Error Resume Next
dim ConnStr
if UserDatabaseType="SQL" then
ConnStr = "Provider = Sqloledb; User ID = " & SqlUsername_User & "; Password = " & SqlPassword_User & "; Initial Catalog = " & SqlDatabaseName_User & "; Data Source = " & SqlHostIP_User & ";"
else
ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(db_User)
end if
Set conn_User = Server.CreateObject("ADODB.Connection")
conn_User.Open connstr
If Err Then
err.Clear
Set Conn = Nothing
Response.Write "用户数据库连接出错,请检查Conn_User.asp文件中的数据库参数设置。"
Response.End
End If
Application("ConnStr_User")=ConnStr
Application("UserDatabaseType")=UserDatabaseType
if UserDatabaseType="SQL" then
PE_True_User="1"
PE_False_User="0"
PE_Now_User="getdate()"
else
PE_True_User="True"
PE_False_User="False"
PE_Now_User="Now()"
end if
end sub
sub CloseConn_User()
On Error Resume Next
If IsObject(Conn_User) Then
Conn_User.close
set Conn_User=nothing
end if
end sub
dim db_User_ID,db_User_Name,db_User_Sex,db_User_Email,db_User_Homepage,db_User_QQ,db_User_Icq,db_User_Msn
dim db_User_Password,db_User_Question,db_User_Answer,db_User_Sign,db_User_Face,db_User_FaceWidth,db_User_FaceHeight
dim db_User_RegDate,db_User_LoginTimes,db_User_LastLoginTime,db_User_LastLoginIP,db_User_UserClass
'MY动力的用户字段名
db_User_ID="UserID" '用户ID
db_User_Name="UserName" '用户名
db_User_Password="UserPassword" '密码
select case UserTableType
case "Dvbbs7.0"
db_User_Sex="UserSex" '性别
db_User_Question="UserQuesion" '忘记密码的提示问题
db_User_Answer="UserAnswer" '问题答案
db_User_Sign="UserSign" '签名
db_User_Face="UserFace" '头像
db_User_FaceWidth="UserWidth" '头像宽度
db_User_FaceHeight="UserHeight" '头像高度
db_User_RegDate="JoinDate" '注册日期
db_User_LoginTimes="UserLogins" '登录次数
db_User_LastLoginTime="lastlogin" '最后登录时间
db_User_LastLoginIP="UserLastIP" '最后登录IP
case "Dvbbs6.0"
db_User_Sex="Sex" '性别
db_User_Question="Quesion" '忘记密码的提示问题
db_User_Answer="Answer" '问题答案
db_User_Sign="Sign" '签名
db_User_Face="Face" '头像
db_User_FaceWidth="Width" '头像宽度
db_User_FaceHeight="Height" '头像高度
db_User_RegDate="addDate" '注册日期
db_User_LoginTimes="Logins" '登录次数
db_User_LastLoginTime="logintime" '最后登录时间
db_User_LastLoginIP="UserLastIP" '最后登录IP
case "MyPower"
db_User_Sex="Sex" '性别
db_User_Question="Question" '忘记密码的提示问题
db_User_Answer="Answer" '问题答案
db_User_Sign="Sign" '签名
db_User_Face="UserFace" '头像
db_User_FaceWidth="FaceWidth" '头像宽度
db_User_FaceHeight="FaceHeight" '头像高度
db_User_RegDate="AddDate" '注册日期
db_User_LoginTimes="LoginTimes" '登录次数
db_User_LastLoginTime="LastLoginTime" '最后登录时间
db_User_LastLoginIP="LastLoginIP" '最后登录IP
case else
db_User_Sex="Sex" '性别
db_User_Question="Question" '忘记密码的提示问题
db_User_Answer="Answer" '问题答案
db_User_Sign="Sign" '签名
db_User_Face="UserFace" '头像
db_User_FaceWidth="FaceWidth" '头像宽度
db_User_FaceHeight="FaceHeight" '头像高度
db_User_RegDate="AddDate" '注册日期
db_User_LoginTimes="LoginTimes" '登录次数
db_User_LastLoginTime="LastLoginTime" '最后登录时间
db_User_LastLoginIP="LastLoginIP" '最后登录IP
End select
db_User_Email="UserEmail" 'Email地址
db_User_Homepage="Homepage" '主页
db_User_QQ="Oicq" 'QQ
db_User_Icq="Icq" 'Icq
db_User_Msn="Msn" 'Msn
db_User_UserClass="UserClass" '论坛用户等级(登录时用到)
dim db_User_CheckNum,db_User_LockUser,db_User_ArticleCount,db_User_ArticleChecked,db_User_UserLevel,db_User_UserPoint,db_User_ChargeType,db_User_BeginDate,db_User_Valid_Num,db_User_Valid_Unit,db_User_UserState,db_User_ArticlesReceive
db_User_CheckNum="CheckNum" '验证码
db_User_LockUser="LockUser" '是否锁定用户
db_User_ArticleCount="ArticleCount" '发表文章数
db_User_ArticleChecked="ArticleChecked" '已审核文章数
db_User_UserLevel="UserLevel" '用户等级(权限)
db_User_UserPoint="UserPoint" '用户点数
db_User_ChargeType="ChargeType" '计费方式
db_User_BeginDate="BeginDate" '开始日期
db_User_Valid_Num="Valid_Num" '有效期数值
db_User_Valid_Unit="Valid_Unit" '有效期单位
db_User_UserState="UserState" 'UserState
db_User_ArticlesReceive="ArticlesReceive" 'ArticlesReceive
dim db_User_BbsType,db_User_Article,db_User_UserGroup,db_User_UserWealth,db_User_UserEP,db_User_UserCP
dim db_User_Title,db_User_Showre,db_User_Reann,db_User_UserCookies,db_User_Birthday,db_User_UserPhoto
dim db_User_UserPower,db_User_UserDel,db_User_UserIsBest,db_User_UserInfo,db_User_UserSetting,db_User_UserGroupID,db_User_TitlePic
'动网论坛使用的用户字段名
db_User_BbsType="bbstype"
db_User_Article="UserTopic"
db_User_UserGroup="UserGroup"
db_User_UserWealth="userWealth"
db_User_UserEP="userEP"
db_User_UserCP="userCP"
If UserTableType = "Dvbbs7.0" then
db_User_Title="UserTitle"
else
db_User_Title="Title"
End if
db_User_Showre="showre"
db_User_Reann="reann"
db_User_UserCookies="usercookies"
db_User_Birthday="Userbirthday"
db_User_UserPhoto="UserPhoto"
db_User_UserPower="UserPower"
db_User_UserDel="UserDel"
db_User_UserIsBest="UserIsBest"
db_User_UserInfo="UserInfo"
db_User_UserSetting="UserSetting"
db_User_UserGroupID="UserGroupID"
db_User_TitlePic="TitlePic"
Application("db_User_Table")=db_User_Table
Application("db_User_ID")=db_User_ID
Application("db_User_Name")=db_User_Name
Application("db_User_Password")=db_User_Password
%>
<%
function UBBCode(Byval strContent)
dim ImagePath
dim emotImagePath
ImagePath=strInstallDir & "images/"
emotImagePath=strInstallDir & "guestbook/images/emot/"
strContent= FilterJS(strContent)
dim re
dim po,ii
dim reContent
Set re=new RegExp
re.IgnoreCase =true
re.Global=True
po=0
ii=0
re.Pattern="\[IMG\](.)\[\/IMG\]"
strContent=re.Replace(strContent,"")
re.Pattern="\[IMG\](http|https|ftp):\/\/(.[^\[]*)\[\/IMG\]"
strContent=re.Replace(strContent,"
screen.width-333)this.width=screen.width-333"">")
re.Pattern="\[UPLOAD=(gif|jpg|jpeg|bmp|png)\](.[^\[]*)(gif|jpg|jpeg|bmp|png)\[\/UPLOAD\]"
strContent= re.Replace(strContent,"
此主题相关图片如下:
screen.width-333)this.width=screen.width-333"">")
re.Pattern="\[UPLOAD=(.[^\[]*)\](.[^\[]*)\[\/UPLOAD\]"
strContent= re.Replace(strContent,"
点击浏览该文件")
re.Pattern="\[DIR=*([0-9]*),*([0-9]*)\](.[^\[]*)\[\/DIR]"
strContent=re.Replace(strContent,"")
re.Pattern="\[QT=*([0-9]*),*([0-9]*)\](.[^\[]*)\[\/QT]"
strContent=re.Replace(strContent,"
")
fString = Replace(fString, CHR(10), "
")
dvHTMLEncode = fString
end function
function dvHTMLCode(byval fString)
if isnull(fString) or trim(fString)="" then
dvHTMLCode=""
exit function
end if
fString = replace(fString, ">", ">")
fString = replace(fString, "<", "<")
fString = Replace(fString, " "," ")
fString = Replace(fString, """, CHR(34))
fString = Replace(fString, "'", CHR(39))
fString = Replace(fString, "
",CHR(10) & CHR(10))
fString = Replace(fString, "
", CHR(10))
dvHTMLCode = fString
end function
function nohtml(byval str)
if isnull(str) or trim(str)="" then
nohtml=""
exit function
end if
dim re
Set re=new RegExp
re.IgnoreCase =true
re.Global=True
re.Pattern="(\<.[^\<]*\>)"
str=re.replace(str," ")
re.Pattern="(\<\/[^\<]*\>)"
str=re.replace(str," ")
set re=nothing
str=replace(str,chr(34),"")
str=replace(str,"'","")
nohtml=str
end function
%>
<%
Private Const BITS_TO_A_BYTE = 8
Private Const BYTES_TO_A_WORD = 4
Private Const BITS_TO_A_WORD = 32
Private m_lOnBits(30)
Private m_l2Power(30)
Dim Md5OLD
Md5OLD = 1
Private Function LShift(lValue, iShiftBits)
If iShiftBits = 0 Then
LShift = lValue
Exit Function
ElseIf iShiftBits = 31 Then
If lValue And 1 Then
LShift = &H80000000
Else
LShift = 0
End If
Exit Function
ElseIf iShiftBits < 0 Or iShiftBits > 31 Then
Err.Raise 6
End If
If (lValue And m_l2Power(31 - iShiftBits)) Then
LShift = ((lValue And m_lOnBits(31 - (iShiftBits + 1))) * m_l2Power(iShiftBits)) Or &H80000000
Else
LShift = ((lValue And m_lOnBits(31 - iShiftBits)) * m_l2Power(iShiftBits))
End If
End Function
Private Function str2bin(varstr)
Dim varasc
Dim i
Dim varchar
Dim varlow
Dim varhigh
str2bin=""
For i=1 To Len(varstr)
varchar=mid(varstr,i,1)
varasc = Asc(varchar)
If varasc<0 Then
varasc = varasc + 65535
End If
If varasc>255 Then
varlow = Left(Hex(Asc(varchar)),2)
varhigh = right(Hex(Asc(varchar)),2)
str2bin = str2bin & chrB("&H" & varlow) & chrB("&H" & varhigh)
Else
str2bin = str2bin & chrB(AscB(varchar))
End If
Next
End Function
Private Function RShift(lValue, iShiftBits)
If iShiftBits = 0 Then
RShift = lValue
Exit Function
ElseIf iShiftBits = 31 Then
If lValue And &H80000000 Then
RShift = 1
Else
RShift = 0
End If
Exit Function
ElseIf iShiftBits < 0 Or iShiftBits > 31 Then
Err.Raise 6
End If
RShift = (lValue And &H7FFFFFFE) \ m_l2Power(iShiftBits)
If (lValue And &H80000000) Then
RShift = (RShift Or (&H40000000 \ m_l2Power(iShiftBits - 1)))
End If
End Function
Private Function RotateLeft(lValue, iShiftBits)
RotateLeft = LShift(lValue, iShiftBits) Or RShift(lValue, (32 - iShiftBits))
End Function
Private Function AddUnsigned(lX, lY)
Dim lX4
Dim lY4
Dim lX8
Dim lY8
Dim lResult
lX8 = lX And &H80000000
lY8 = lY And &H80000000
lX4 = lX And &H40000000
lY4 = lY And &H40000000
lResult = (lX And &H3FFFFFFF) + (lY And &H3FFFFFFF)
If lX4 And lY4 Then
lResult = lResult Xor &H80000000 Xor lX8 Xor lY8
ElseIf lX4 Or lY4 Then
If lResult And &H40000000 Then
lResult = lResult Xor &HC0000000 Xor lX8 Xor lY8
Else
lResult = lResult Xor &H40000000 Xor lX8 Xor lY8
End If
Else
lResult = lResult Xor lX8 Xor lY8
End If
AddUnsigned = lResult
End Function
Private Function md5_F(x, y, z)
md5_F = (x And y) Or ((Not x) And z)
End Function
Private Function md5_G(x, y, z)
md5_G = (x And z) Or (y And (Not z))
End Function
Private Function md5_H(x, y, z)
md5_H = (x Xor y Xor z)
End Function
Private Function md5_I(x, y, z)
md5_I = (y Xor (x Or (Not z)))
End Function
Private Sub md5_FF(a, b, c, d, x, s, ac)
a = AddUnsigned(a, AddUnsigned(AddUnsigned(md5_F(b, c, d), x), ac))
a = RotateLeft(a, s)
a = AddUnsigned(a, b)
End Sub
Private Sub md5_GG(a, b, c, d, x, s, ac)
a = AddUnsigned(a, AddUnsigned(AddUnsigned(md5_G(b, c, d), x), ac))
a = RotateLeft(a, s)
a = AddUnsigned(a, b)
End Sub
Private Sub md5_HH(a, b, c, d, x, s, ac)
a = AddUnsigned(a, AddUnsigned(AddUnsigned(md5_H(b, c, d), x), ac))
a = RotateLeft(a, s)
a = AddUnsigned(a, b)
End Sub
Private Sub md5_II(a, b, c, d, x, s, ac)
a = AddUnsigned(a, AddUnsigned(AddUnsigned(md5_I(b, c, d), x), ac))
a = RotateLeft(a, s)
a = AddUnsigned(a, b)
End Sub
Private Function ConvertToWordArray(sMessage)
Dim lMessageLength
Dim lNumberOfWords
Dim lWordArray()
Dim lBytePosition
Dim lByteCount
Dim lWordCount
Const MODULUS_BITS = 512
Const CONGRUENT_BITS = 448
If Md5OLD = 1 Then
lMessageLength = Len(sMessage)
Else
lMessageLength = LenB(sMessage)
End If
lNumberOfWords = (((lMessageLength + ((MODULUS_BITS - CONGRUENT_BITS) \ BITS_TO_A_BYTE)) \ (MODULUS_BITS \ BITS_TO_A_BYTE)) + 1) * (MODULUS_BITS \ BITS_TO_A_WORD)
ReDim lWordArray(lNumberOfWords - 1)
lBytePosition = 0
lByteCount = 0
Do Until lByteCount >= lMessageLength
lWordCount = lByteCount \ BYTES_TO_A_WORD
lBytePosition = (lByteCount Mod BYTES_TO_A_WORD) * BITS_TO_A_BYTE
If Md5OLD = 1 Then
lWordArray(lWordCount) = lWordArray(lWordCount) Or LShift(Asc(Mid(sMessage, lByteCount + 1, 1)), lBytePosition)
Else
lWordArray(lWordCount) = lWordArray(lWordCount) Or LShift(AscB(MidB(sMessage, lByteCount + 1, 1)), lBytePosition)
End If
lByteCount = lByteCount + 1
Loop
lWordCount = lByteCount \ BYTES_TO_A_WORD
lBytePosition = (lByteCount Mod BYTES_TO_A_WORD) * BITS_TO_A_BYTE
lWordArray(lWordCount) = lWordArray(lWordCount) Or LShift(&H80, lBytePosition)
lWordArray(lNumberOfWords - 2) = LShift(lMessageLength, 3)
lWordArray(lNumberOfWords - 1) = RShift(lMessageLength, 29)
ConvertToWordArray = lWordArray
End Function
Private Function WordToHex(lValue)
Dim lByte
Dim lCount
For lCount = 0 To 3
lByte = RShift(lValue, lCount * BITS_TO_A_BYTE) And m_lOnBits(BITS_TO_A_BYTE - 1)
WordToHex = WordToHex & Right("0" & Hex(lByte), 2)
Next
End Function
Public Function MD5(sMessage,stype)
m_lOnBits(0) = CLng(1)
m_lOnBits(1) = CLng(3)
m_lOnBits(2) = CLng(7)
m_lOnBits(3) = CLng(15)
m_lOnBits(4) = CLng(31)
m_lOnBits(5) = CLng(63)
m_lOnBits(6) = CLng(127)
m_lOnBits(7) = CLng(255)
m_lOnBits(8) = CLng(511)
m_lOnBits(9) = CLng(1023)
m_lOnBits(10) = CLng(2047)
m_lOnBits(11) = CLng(4095)
m_lOnBits(12) = CLng(8191)
m_lOnBits(13) = CLng(16383)
m_lOnBits(14) = CLng(32767)
m_lOnBits(15) = CLng(65535)
m_lOnBits(16) = CLng(131071)
m_lOnBits(17) = CLng(262143)
m_lOnBits(18) = CLng(524287)
m_lOnBits(19) = CLng(1048575)
m_lOnBits(20) = CLng(2097151)
m_lOnBits(21) = CLng(4194303)
m_lOnBits(22) = CLng(8388607)
m_lOnBits(23) = CLng(16777215)
m_lOnBits(24) = CLng(33554431)
m_lOnBits(25) = CLng(67108863)
m_lOnBits(26) = CLng(134217727)
m_lOnBits(27) = CLng(268435455)
m_lOnBits(28) = CLng(536870911)
m_lOnBits(29) = CLng(1073741823)
m_lOnBits(30) = CLng(2147483647)
m_l2Power(0) = CLng(1)
m_l2Power(1) = CLng(2)
m_l2Power(2) = CLng(4)
m_l2Power(3) = CLng(8)
m_l2Power(4) = CLng(16)
m_l2Power(5) = CLng(32)
m_l2Power(6) = CLng(64)
m_l2Power(7) = CLng(128)
m_l2Power(8) = CLng(256)
m_l2Power(9) = CLng(512)
m_l2Power(10) = CLng(1024)
m_l2Power(11) = CLng(2048)
m_l2Power(12) = CLng(4096)
m_l2Power(13) = CLng(8192)
m_l2Power(14) = CLng(16384)
m_l2Power(15) = CLng(32768)
m_l2Power(16) = CLng(65536)
m_l2Power(17) = CLng(131072)
m_l2Power(18) = CLng(262144)
m_l2Power(19) = CLng(524288)
m_l2Power(20) = CLng(1048576)
m_l2Power(21) = CLng(2097152)
m_l2Power(22) = CLng(4194304)
m_l2Power(23) = CLng(8388608)
m_l2Power(24) = CLng(16777216)
m_l2Power(25) = CLng(33554432)
m_l2Power(26) = CLng(67108864)
m_l2Power(27) = CLng(134217728)
m_l2Power(28) = CLng(268435456)
m_l2Power(29) = CLng(536870912)
m_l2Power(30) = CLng(1073741824)
Dim x
Dim k
Dim AA
Dim BB
Dim CC
Dim DD
Dim a
Dim b
Dim c
Dim d
Const S11 = 7
Const S12 = 12
Const S13 = 17
Const S14 = 22
Const S21 = 5
Const S22 = 9
Const S23 = 14
Const S24 = 20
Const S31 = 4
Const S32 = 11
Const S33 = 16
Const S34 = 23
Const S41 = 6
Const S42 = 10
Const S43 = 15
Const S44 = 21
If Md5OLD = 1 Then
x = ConvertToWordArray(sMessage)
Else
x = ConvertToWordArray(str2bin(sMessage))
End If
a = &H67452301
b = &HEFCDAB89
c = &H98BADCFE
d = &H10325476
For k = 0 To UBound(x) Step 16
AA = a
BB = b
CC = c
DD = d
md5_FF a, b, c, d, x(k + 0), S11, &HD76AA478
md5_FF d, a, b, c, x(k + 1), S12, &HE8C7B756
md5_FF c, d, a, b, x(k + 2), S13, &H242070DB
md5_FF b, c, d, a, x(k + 3), S14, &HC1BDCEEE
md5_FF a, b, c, d, x(k + 4), S11, &HF57C0FAF
md5_FF d, a, b, c, x(k + 5), S12, &H4787C62A
md5_FF c, d, a, b, x(k + 6), S13, &HA8304613
md5_FF b, c, d, a, x(k + 7), S14, &HFD469501
md5_FF a, b, c, d, x(k + 8), S11, &H698098D8
md5_FF d, a, b, c, x(k + 9), S12, &H8B44F7AF
md5_FF c, d, a, b, x(k + 10), S13, &HFFFF5BB1
md5_FF b, c, d, a, x(k + 11), S14, &H895CD7BE
md5_FF a, b, c, d, x(k + 12), S11, &H6B901122
md5_FF d, a, b, c, x(k + 13), S12, &HFD987193
md5_FF c, d, a, b, x(k + 14), S13, &HA679438E
md5_FF b, c, d, a, x(k + 15), S14, &H49B40821
md5_GG a, b, c, d, x(k + 1), S21, &HF61E2562
md5_GG d, a, b, c, x(k + 6), S22, &HC040B340
md5_GG c, d, a, b, x(k + 11), S23, &H265E5A51
md5_GG b, c, d, a, x(k + 0), S24, &HE9B6C7AA
md5_GG a, b, c, d, x(k + 5), S21, &HD62F105D
md5_GG d, a, b, c, x(k + 10), S22, &H2441453
md5_GG c, d, a, b, x(k + 15), S23, &HD8A1E681
md5_GG b, c, d, a, x(k + 4), S24, &HE7D3FBC8
md5_GG a, b, c, d, x(k + 9), S21, &H21E1CDE6
md5_GG d, a, b, c, x(k + 14), S22, &HC33707D6
md5_GG c, d, a, b, x(k + 3), S23, &HF4D50D87
md5_GG b, c, d, a, x(k + 8), S24, &H455A14ED
md5_GG a, b, c, d, x(k + 13), S21, &HA9E3E905
md5_GG d, a, b, c, x(k + 2), S22, &HFCEFA3F8
md5_GG c, d, a, b, x(k + 7), S23, &H676F02D9
md5_GG b, c, d, a, x(k + 12), S24, &H8D2A4C8A
md5_HH a, b, c, d, x(k + 5), S31, &HFFFA3942
md5_HH d, a, b, c, x(k + 8), S32, &H8771F681
md5_HH c, d, a, b, x(k + 11), S33, &H6D9D6122
md5_HH b, c, d, a, x(k + 14), S34, &HFDE5380C
md5_HH a, b, c, d, x(k + 1), S31, &HA4BEEA44
md5_HH d, a, b, c, x(k + 4), S32, &H4BDECFA9
md5_HH c, d, a, b, x(k + 7), S33, &HF6BB4B60
md5_HH b, c, d, a, x(k + 10), S34, &HBEBFBC70
md5_HH a, b, c, d, x(k + 13), S31, &H289B7EC6
md5_HH d, a, b, c, x(k + 0), S32, &HEAA127FA
md5_HH c, d, a, b, x(k + 3), S33, &HD4EF3085
md5_HH b, c, d, a, x(k + 6), S34, &H4881D05
md5_HH a, b, c, d, x(k + 9), S31, &HD9D4D039
md5_HH d, a, b, c, x(k + 12), S32, &HE6DB99E5
md5_HH c, d, a, b, x(k + 15), S33, &H1FA27CF8
md5_HH b, c, d, a, x(k + 2), S34, &HC4AC5665
md5_II a, b, c, d, x(k + 0), S41, &HF4292244
md5_II d, a, b, c, x(k + 7), S42, &H432AFF97
md5_II c, d, a, b, x(k + 14), S43, &HAB9423A7
md5_II b, c, d, a, x(k + 5), S44, &HFC93A039
md5_II a, b, c, d, x(k + 12), S41, &H655B59C3
md5_II d, a, b, c, x(k + 3), S42, &H8F0CCC92
md5_II c, d, a, b, x(k + 10), S43, &HFFEFF47D
md5_II b, c, d, a, x(k + 1), S44, &H85845DD1
md5_II a, b, c, d, x(k + 8), S41, &H6FA87E4F
md5_II d, a, b, c, x(k + 15), S42, &HFE2CE6E0
md5_II c, d, a, b, x(k + 6), S43, &HA3014314
md5_II b, c, d, a, x(k + 13), S44, &H4E0811A1
md5_II a, b, c, d, x(k + 4), S41, &HF7537E82
md5_II d, a, b, c, x(k + 11), S42, &HBD3AF235
md5_II c, d, a, b, x(k + 2), S43, &H2AD7D2BB
md5_II b, c, d, a, x(k + 9), S44, &HEB86D391
a = AddUnsigned(a, AA)
b = AddUnsigned(b, BB)
c = AddUnsigned(c, CC)
d = AddUnsigned(d, DD)
Next
if stype=32 then
MD5 = LCase(WordToHex(a) & WordToHex(b) & WordToHex(c) & WordToHex(d))
else
MD5=LCase(WordToHex(b) & WordToHex(c)) 'I crop this to fit 16byte database password :D
end if
End Function
%>
<%
Dim Action, FoundErr, ErrMsg, ComeUrl
Dim strInstallDir
Dim Site_Sn '定义系统识别码
'定义用户相关的变量
Dim UserLogined, GroupID, GroupName, GroupType, Discount_Member, IsOffer, LoginTimes, RegTime, JoinTime, LastLoginTime, LastLoginIP
Dim UserID, ClientID, CompanyID, ContacterID, UserType, UserName, email, Balance, UserPoint, UserExp, ValidNum, ValidDays, SpecialPermission, UserSetting, ChargeType
Dim UnsignedItems, UnreadMsg, arrClass_Input, arrClass_View
Dim DefaultTemplateProjectName
If Request("ComeUrl") = "" Then
ComeUrl = Trim(Request.ServerVariables("HTTP_REFERER"))
Else
ComeUrl = Trim(Request("ComeUrl"))
End If
Action = Trim(Request("Action"))
FoundErr = False
ErrMsg = ""
If Right(InstallDir, 1) <> "/" Then
strInstallDir = InstallDir & "/"
Else
strInstallDir = InstallDir
End If
Site_Sn = Replace(Replace(LCase(Request.ServerVariables("SERVER_NAME") & InstallDir), "/", ""), ".", "")
'**************************************************
'函数名:gotTopic
'作 用:截字符串,汉字一个算两个字符,英文算一个字符
'参 数:str ----原字符串
' strlen ----截取长度
'返回值:截取后的字符串
'**************************************************
Function gotTopic(ByVal str, ByVal strlen)
If str = "" Then
gotTopic = ""
Exit Function
End If
Dim l, t, c, i, strTemp
str = Replace(Replace(Replace(Replace(str, " ", " "), """, Chr(34)), ">", ">"), "<", "<")
l = Len(str)
t = 0
strTemp = str
strlen = CLng(strlen)
For i = 1 To l
c = Abs(Asc(Mid(str, i, 1)))
If c > 255 Then
t = t + 2
Else
t = t + 1
End If
If t >= strlen Then
strTemp = Left(str, i)
Exit For
End If
Next
If strTemp <> str Then
strTemp = strTemp & "…"
End If
gotTopic = Replace(Replace(Replace(Replace(strTemp, " ", " "), Chr(34), """), ">", ">"), "<", "<")
End Function
'**************************************************
'函数名:JoinChar
'作 用:向地址中加入 ? 或 &
'参 数:strUrl ----网址
'返回值:加了 ? 或 & 的网址
'**************************************************
Function JoinChar(ByVal strUrl)
If strUrl = "" Then
JoinChar = ""
Exit Function
End If
If InStr(strUrl, "?") < Len(strUrl) Then
If InStr(strUrl, "?") > 1 Then
If InStr(strUrl, "&") < Len(strUrl) Then
JoinChar = strUrl & "&"
Else
JoinChar = strUrl
End If
Else
JoinChar = strUrl & "?"
End If
Else
JoinChar = strUrl
End If
End Function
'**************************************************
'函数名:ShowPage
'作 用:显示“上一页 下一页”等信息
'参 数:sFileName ----链接地址
' TotalNumber ----总数量
' MaxPerPage ----每页数量
' CurrentPage ----当前页
' ShowTotal ----是否显示总数量
' ShowAllPages ---是否用下拉列表显示所有页面以供跳转。
' strUnit ----计数单位
' ShowMaxPerPage ----是否显示每页信息量选项框
'返回值:“上一页 下一页”等信息的HTML代码
'**************************************************
Function ShowPage(sfilename, totalnumber, MaxPerPage, CurrentPage, ShowTotal, ShowAllPages, strUnit, ShowMaxPerPage)
Dim TotalPage, strTemp, strUrl, i
If totalnumber = 0 Or MaxPerPage = 0 Or IsNull(MaxPerPage) Then
ShowPage = ""
Exit Function
End If
If totalnumber Mod MaxPerPage = 0 Then
TotalPage = totalnumber \ MaxPerPage
Else
TotalPage = totalnumber \ MaxPerPage + 1
End If
If CurrentPage > TotalPage Then CurrentPage = TotalPage
strTemp = "
| " If ShowTotal = True Then strTemp = strTemp & "共 " & totalnumber & " " & strUnit & " " End If If ShowMaxPerPage = True Then strUrl = JoinChar(sfilename) & "MaxPerPage=" & MaxPerPage & "&" Else strUrl = JoinChar(sfilename) End If If CurrentPage = 1 Then strTemp = strTemp & "首页 上一页 " Else strTemp = strTemp & "首页 " strTemp = strTemp & "上一页 " End If If CurrentPage >= TotalPage Then strTemp = strTemp & "下一页 尾页" Else strTemp = strTemp & "下一页 " strTemp = strTemp & "尾页" End If strTemp = strTemp & " 页次:" & CurrentPage & "/" & TotalPage & "页 " If ShowMaxPerPage = True Then strTemp = strTemp & " " & strUnit & "/页" Else strTemp = strTemp & " " & MaxPerPage & "" & strUnit & "/页" End If If ShowAllPages = True Then If TotalPage > 20 Then strTemp = strTemp & " 转到第页" Else strTemp = strTemp & " 转到:" End If End If strTemp = strTemp & " |
| 错误信息 |
| 产生错误的可能原因:" & sErrMsg & " |
| " If sComeUrl <> "" Then strErr = strErr & "<< 返回上一页" Else strErr = strErr & "【关闭】" End If strErr = strErr & " |
| 恭喜你! |
" & sSuccessMsg & " |
| " If sComeUrl <> "" Then strSuccess = strSuccess & "<< 返回上一页" Else strSuccess = strSuccess & "【关闭】" End If strSuccess = strSuccess & " |
"
End If
ShowLogo = strLogo
End Function
'==================================================
'过程名:ShowBanner
'作 用:显示网站Banner
'参 数:无
'==================================================
Function ShowBanner(BannerWidth, BannerHeight)
Dim strBanner
If BannerUrl <> "" Then
If LCase(Right(BannerUrl, 3)) = "swf" Then
If LCase(Left(BannerUrl, 7)) = "http://" Then
strBanner = ""
Else
strBanner = ""
End If
Else
If LCase(Left(BannerUrl, 7)) = "http://" Then
strBanner = "没有公告
" else if ShowType=1 then do while not rsAnnounce.eof strAnnounce=strAnnounce & "| 名次 | 用户名 | 文章数 |
| " & cstr(i) & " | " & rsTopUser(db_User_Name) & " | " & rsTopUser("ArticleChecked") & " |
")
fString = Replace(fString, Chr(10), "
")
PE_HTMLEncode = fString
End Function
%>