📄 powereasy.common.all.asp
字号:
<%
'**************************************************************
' Software name: PowerEasy SiteWeaver
' Web: http://www.powereasy.net
' Copyright (C) 2005-2008 佛山市动易网络科技有限公司 版权所有
'**************************************************************
'判断当前访问者是否已经登录,若已登录,则读取数据并做必要赋值
Function CheckUserLogined()
Dim UserPassword, LastPassword
Dim rsUser, sqlUser
UserID = 0
GroupID = 0
Balance = 0
UserPoint = 0
UserExp = 0
LoginTimes = 0
UserChargeType = 0
CheckUserLogined = False
UserName = ReplaceBadChar(Trim(Request.Cookies(Site_Sn)("UserName")))
UserPassword = ReplaceBadChar(Trim(Request.Cookies(Site_Sn)("UserPassword")))
LastPassword = ReplaceBadChar(Trim(Request.Cookies(Site_Sn)("LastPassword")))
If (UserName = "" Or UserPassword = "" Or LastPassword = "") Then
ReDim UserSetting(50)
CheckUserLogined = False
Exit Function
End If
sqlUser = "SELECT UserID,GroupID,LoginTimes FROM PE_User WHERE UserName='" & UserName & "' AND UserPassword='" & UserPassword & "' AND LastPassword='" & LastPassword & "' and IsLocked=" & PE_False & ""
Set rsUser = Conn.Execute(sqlUser)
If rsUser.BOF And rsUser.EOF Then
ReDim UserSetting(50)
CheckUserLogined = False
Else
CheckUserLogined = True
UserID = rsUser("UserID")
GroupID = rsUser("GroupID")
LoginTimes = rsUser("LoginTimes")
End If
Set rsUser = Nothing
End Function
'给用户的相应变量赋值
Sub GetUser(sUserName)
Dim rsUser, rsGroup
Set rsUser = Conn.Execute("SELECT * FROM PE_User WHERE UserName='" & sUserName & "'")
If Not (rsUser.BOF And rsUser.EOF) Then
UserID = rsUser("UserID")
GroupID = rsUser("GroupID")
UserType = rsUser("UserType")
CompanyID = rsUser("CompanyID")
ContacterID = rsUser("ContacterID")
ClientID = rsUser("ClientID")
Balance = rsUser("Balance")
UserPoint = rsUser("UserPoint")
UserExp = rsUser("UserExp")
ValidNum = rsUser("ValidNum")
ValidUnit = rsUser("ValidUnit")
BeginTime = rsUser("BeginTime")
ValidDays = ChkValidDays(rsUser("ValidNum"), rsUser("ValidUnit"), rsUser("BeginTime"))
email = rsUser("Email")
UnsignedItems = rsUser("UnsignedItems")
If PresentExpPerLogin > 0 Then
If DateDiff("D", rsUser("LastPresentTime"), Now()) > 0 Or IsNull(rsUser("LastPresentTime")) Then
Conn.Execute ("update PE_User set UserExp=UserExp+" & PresentExpPerLogin & ",LastPresentTime=" & PE_Now & " where UserID=" & UserID & "")
End If
End If
If PE_CLng(Session("UserID")) = 0 Then
Conn.Execute ("update PE_User set LastLoginIP='" & UserTrueIP & "',LastLoginTime=" & PE_Now & ",LoginTimes=LoginTimes+1 where UserID=" & UserID & "")
Session("UserID") = UserID
End If
If rsUser("Blog") = True Then
BlogFlag = True
Else
BlogFlag = False
End If
Set rsGroup = Conn.Execute("select * from PE_UserGroup where GroupID=" & rsUser("GroupID") & "")
GroupName = rsGroup("GroupName")
GroupType = rsGroup("GroupType")
If rsUser("SpecialPermission") = True Then
arrClass_Browse = Trim(rsUser("arrClass_Browse"))
arrClass_View = Trim(rsUser("arrClass_View"))
arrClass_Input = Trim(rsUser("arrClass_Input"))
UserSetting = Split(Trim(rsUser("UserSetting")) & ",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0", ",")
Else
arrClass_Browse = Trim(rsGroup("arrClass_Browse"))
arrClass_View = Trim(rsGroup("arrClass_View"))
arrClass_Input = Trim(rsGroup("arrClass_Input"))
UserSetting = Split(Trim(rsGroup("GroupSetting")) & ",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0", ",")
End If
rsGroup.Close
Set rsGroup = Nothing
NeedlessCheck = PE_CLng(UserSetting(1))
EnableModifyDelete = PE_CLng(UserSetting(2))
MaxPerDay = PE_CLng(UserSetting(3))
PresentExpTimes = PE_CDbl(UserSetting(4))
MaxSendNum = PE_CLng(UserSetting(7))
MaxFavorite = PE_CLng(UserSetting(8))
Discount_Member = PE_CDbl(UserSetting(11))
If UserSetting(12) = 1 Then
IsOffer = "是"
Else
IsOffer = "否"
End If
UserChargeType = PE_CLng(UserSetting(14))
Dim Message
Set Message = Conn.Execute("select Count(0) from PE_Message where Incept = '" & UserName & "' and delR=0 and Flag=0 and IsSend=1")
If Message.EOF And Message.Bof Then
UnreadMsg = 0
Else
UnreadMsg = Message(0)
End If
Set Message = Nothing
End If
Set rsUser = Nothing
End Sub
'**************************************************
'函数名:GetSubStr
'作 用:截字符串,汉字一个算两个字符,英文算一个字符
'参 数:str ----原字符串
' strlen ----截取长度
' bShowPoint ---- 是否显示省略号
'返回值:截取后的字符串
'**************************************************
Function GetSubStr(ByVal str, ByVal strlen, bShowPoint)
If str = "" Then
GetSubStr = ""
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 = PE_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
str = Replace(Replace(Replace(Replace(str, " ", " "), Chr(34), """), ">", ">"), "<", "<")
strTemp = Replace(Replace(Replace(Replace(strTemp, " ", " "), Chr(34), """), ">", ">"), "<", "<")
If strTemp <> str And bShowPoint = True Then
strTemp = strTemp & "…"
End If
GetSubStr = strTemp
End Function
'**************************************************
'函数名:GetStrLen
'作 用:求字符串长度。汉字算两个字符,英文算一个字符。
'参 数:str ----要求长度的字符串
'返回值:字符串长度
'**************************************************
Function GetStrLen(str)
On Error Resume Next
Dim WINNT_CHINESE
WINNT_CHINESE = (Len("中国") = 2)
If WINNT_CHINESE Then
Dim l, t, c
Dim i
l = Len(str)
t = l
For i = 1 To l
c = Asc(Mid(str, i, 1))
If c < 0 Then c = c + 65536
If c > 255 Then
t = t + 1
End If
Next
GetStrLen = t
Else
GetStrLen = Len(str)
End If
If Err.Number <> 0 Then Err.Clear
End Function
Function Charlong(ByVal str)
If str = "" Then
Charlong = 0
Exit Function
End If
str = Replace(Replace(Replace(Replace(str, " ", " "), """, Chr(34)), ">", ">"), "<", "<")
Charlong = GetStrLen(str)
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 = "<div class=""show_page"">"
If ShowTotal = True Then
strTemp = strTemp & "共 <b>" & totalnumber & "</b> " & 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 & "<a href='" & strUrl & "page=1'>首页</a> |"
strTemp = strTemp & " <a href='" & strUrl & "page=" & (CurrentPage - 1) & "'>上一页</a> | "
End If
strTemp = strTemp & " "
If ShowAllPages = True Then
Dim Jmaxpages
If (CurrentPage - 4) <= 0 Or TotalPage < 10 Then
Jmaxpages = 1
Do While (Jmaxpages < 10)
If Jmaxpages = CurrentPage Then
strTemp = strTemp & "<font color=""FF0000"">" & Jmaxpages & "</font> "
Else
If strUrl <> "" Then
strTemp = strTemp & "<a href=""" & strUrl & "page=" & Jmaxpages & """>" & Jmaxpages & "</a> "
End If
End If
If Jmaxpages = TotalPage Then Exit Do
Jmaxpages = Jmaxpages + 1
Loop
ElseIf (CurrentPage + 4) >= TotalPage Then
Jmaxpages = TotalPage - 8
Do While (Jmaxpages <= TotalPage)
If Jmaxpages = CurrentPage Then
strTemp = strTemp & "<font color=""FF0000"">" & Jmaxpages & "</font> "
Else
If strUrl <> "" Then
strTemp = strTemp & "<a href=""" & strUrl & "page=" & Jmaxpages & """>" & Jmaxpages & "</a> "
End If
End If
Jmaxpages = Jmaxpages + 1
Loop
Else
Jmaxpages = CurrentPage - 4
Do While (Jmaxpages < CurrentPage + 5)
If Jmaxpages = CurrentPage Then
strTemp = strTemp & "<font color=""FF0000"">" & Jmaxpages & "</font> "
Else
If strUrl <> "" Then
strTemp = strTemp & "<a href=""" & strUrl & "page=" & Jmaxpages & """>" & Jmaxpages & "</a> "
End If
End If
Jmaxpages = Jmaxpages + 1
Loop
End If
End If
If CurrentPage >= TotalPage Then
strTemp = strTemp & "| 下一页 | 尾页"
Else
strTemp = strTemp & " | <a href='" & strUrl & "page=" & (CurrentPage + 1) & "'>下一页</a> |"
strTemp = strTemp & "<a href='" & strUrl & "page=" & TotalPage & "'> 尾页</a>"
End If
If ShowMaxPerPage = True Then
strTemp = strTemp & " <Input type='text' name='MaxPerPage' size='3' maxlength='4' value='" & MaxPerPage & "' onKeyPress=""if (event.keyCode==13) window.location='" & JoinChar(sfilename) & "page=" & CurrentPage & "&MaxPerPage=" & "'+this.value;"">" & strUnit & "/页"
Else
strTemp = strTemp & " <b>" & MaxPerPage & "</b>" & strUnit & "/页"
End If
If ShowAllPages = True Then
strTemp = strTemp & " 转到第<Input type='text' name='page' size='3' maxlength='5' value='" & CurrentPage & "' onKeyPress=""if (event.keyCode==13) window.location='" & strUrl & "page=" & "'+this.value;"">页"
End If
strTemp = strTemp & "</div>"
ShowPage = strTemp
End Function
'**************************************************
'函数名:ShowPage_en
'作 用:显示英文“上一页 下一页”等信息
'参 数:sFileName ----链接地址
' TotalNumber ----总数量
' MaxPerPage ----每页数量
' CurrentPage ----当前页
' ShowTotal ----是否显示总数量
' ShowAllPages ---是否用下拉列表显示所有页面以供跳转。
' strUnit ----计数单位
' ShowMaxPerPage ----是否显示每页信息量选项框
'返回值:“上一页 下一页”等信息的HTML代码
'**************************************************
Function ShowPage_en(sfilename, totalnumber, MaxPerPage, CurrentPage, ShowTotal, ShowAllPages, strUnit, ShowMaxPerPage)
Dim TotalPage, strTemp, strUrl, i
If totalnumber = 0 Or MaxPerPage = 0 Or IsNull(MaxPerPage) Then
ShowPage_en = ""
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 = "<div class=""show_page"">"
If ShowTotal = True Then
strTemp = strTemp & "Total <b>" & totalnumber & "</b> " & strUnit & " "
End If
If ShowMaxPerPage = True Then
strUrl = JoinChar(sfilename) & "MaxPerPage=" & MaxPerPage & "&"
Else
strUrl = JoinChar(sfilename)
End If
If CurrentPage = 1 Then
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -