class_sys.asp
来自「是个不错的文件代码,希望大家好好用,」· ASP 代码 · 共 1,851 行 · 第 1/5 页
ASP
1,851 行
Response.Write ("没找到该用户,无法建立目录。")
Exit Sub
End If
End Sub
Public Sub ShowOk(Str, url)
url = Trim(url)
If url <> "" and url<>"back" Then
Response.Write "<script language=Javascript>alert(""" & Str & """);window.location='" & url & "'</script>"
Else
If Comeurl = "" or url="back" Then
Response.Write "<script language=Javascript>alert(""" & Str & """);history.go(-1)</script>"
Else
Response.Write "<script language=Javascript>alert(""" & Str & """);window.location='" & Comeurl & "'</script>"
End If
End If
End Sub
Public Function type_city(province, city)
Dim tmpstr
tmpstr = "<select onchange=setcity(); name='province' >"
tmpstr = tmpstr & "<option value=''>----请选择省份----</option>"
tmpstr = tmpstr & "<option "
tmpstr = tmpstr & "value=安徽>安徽</option> <option value=北京>北京</option> "
tmpstr = tmpstr & "<option value=重庆>重庆</option> <option "
tmpstr = tmpstr & "value=福建>福建</option> <option value=甘肃>甘肃</option> "
tmpstr = tmpstr & "<option value=广东>广东</option> <option "
tmpstr = tmpstr & "value=广西>广西</option> <option value=贵州>贵州</option> "
tmpstr = tmpstr & "<option value=海南>海南</option> <option "
tmpstr = tmpstr & "value=河北>河北</option> <option value=黑龙江>黑龙江</option> "
tmpstr = tmpstr & "<option value=河南>河南</option> <option "
tmpstr = tmpstr & "value=香港>香港</option> <option value=湖北>湖北</option> "
tmpstr = tmpstr & "<option value=湖南>湖南</option> <option "
tmpstr = tmpstr & "value=江苏>江苏</option> <option value=江西>江西</option> "
tmpstr = tmpstr & "<option value=吉林>吉林</option> <option "
tmpstr = tmpstr & "value=辽宁>辽宁</option> <option value=澳门>澳门</option>"
tmpstr = tmpstr & "<option value=内蒙古>内蒙古</option> <option "
tmpstr = tmpstr & "value=宁夏>宁夏</option> <option value=青海>青海</option> "
tmpstr = tmpstr & "<option value=山东>山东</option> <option "
tmpstr = tmpstr & "value=上海>上海</option> <option value=山西>山西</option> "
tmpstr = tmpstr & "<option value=陕西>陕西</option> <option "
tmpstr = tmpstr & "value=四川>四川</option> <option value=台湾>台湾</option> "
tmpstr = tmpstr & "<option value=天津>天津</option> <option "
tmpstr = tmpstr & "value=新疆>新疆</option> <option value=西藏>西藏</option> "
tmpstr = tmpstr & "<option value=云南>云南</option> <option "
tmpstr = tmpstr & "value=浙江>浙江</option> <option "
tmpstr = tmpstr & "value=海外>海外</option></select>"
tmpstr = tmpstr & " <select name='city' >"
tmpstr = tmpstr & "</select>"
tmpstr = tmpstr & "<script src=""inc/getcity.js""></script>"
tmpstr = tmpstr & "<script>initprovcity('" & province & "','" & city & "');</script>"
type_city = tmpstr
End Function
Public Sub type_job(job)
Dim tmpstr
tmpstr = "<select name='job' id='job'><option value=''>----请选择职业----<option value='财会/金融'> 财会/金融<option value='工程师' > 工程师<option value='顾问' > 顾问<option value='计算机相关行业(Internet)' > 计算机相关行业 (Internet)<option value='计算机相关行业(其他)' > 计算机相关行业(其他)<option value='家庭主妇' > 家庭主妇<option value='教育/培训' > 教育/培训<option value='客户服务/支持' > 客户服务/支持<option value='零售商/手工工人' > 零售商/手工工人<option value='退休' > 退休<option value='无职业' > 无职业<option value='销售/市场/广告' > 销售/市场/广告<option value='学生' > 学生<option value='研究和开发' > 研究和开发<option value='一般管理' > 一般管理<option value='政府/军队' > 政府/军队<option value='执行官/高级管理' > 执行官/高级管理<option value='制造/生产/操作' > 制造/生产/操作<option value='专业人员(医药、法律等)' > 专业人员(医药、法律等)<option value='自雇/业主' > 自雇/业主<option value='其他' > 其他</select>"
Response.Write (tmpstr)
%>
<script language=javascript>
var jobObject = document.oblogform["job"];
for(var i = 0; i < document.oblogform["job"].options.length; i++) {
if (document.oblogform["job"].options[i].value=="<%=trim(job)%>")
{
document.oblogform["job"].selectedIndex = i;
}
}
</script>
<%
End Sub
Public Sub type_dateselect(addtime, n)
Dim y, m, d, ttime
If addtime = "" Then ttime = ServerDate(Now()) Else ttime = addtime
Response.Write("<select name=selecty"&n&">")&vbcrlf
For y = 2000 To 2010
If Year(ttime) = y Then
Response.Write "<option value="&y&" selected>"&y&"年</option>"&vbcrlf
Else
Response.Write "<option value="&y&">"&y&"年</option>"&vbcrlf
End If
Next
Response.Write "</select><select name=selectm"&n&">"&vbcrlf
For m = 1 To 12
If Month(ttime) = m Then
Response.Write "<option value="&m&" selected>"&m&"月</option>"&vbcrlf
Else
Response.Write "<option value="&m&">"&m&"月</option>"&vbcrlf
End If
Next
Response.Write("</select><select name=selectd"&n&">")&vbcrlf
For d = 1 To 31
If Day(ttime) = d Then
Response.Write "<option value="&d&" selected>"&d&"日</option>"&vbcrlf
Else
Response.Write "<option value="&d&">"&d&"日</option>"&vbcrlf
End If
Next
Response.Write ("</select>") & vbCrLf
End Sub
Public Sub chk_commenttime()
Dim lasttime
'检查服务器端
lasttime = Session("chk_commenttime")
If IsDate(lasttime) Then
If DateDiff("s", lasttime, ServerDate(Now())) < Int(cacheConfig(32)) Then
Response.Write ("<script language=javascript>alert('" & cacheConfig(32) & "秒后才能回复或评论。');window.history.back(-1);</script>")
Response.End
End If
End If
'检查客户端
lasttime = request.Cookies(cookies_name)("LastComment")
If IsDate(lasttime) Then
If DateDiff("s", lasttime, ServerDate(Now())) < Int(cacheConfig(32)) Then
Response.Write ("<script language=javascript>alert('" & cacheConfig(32) & "秒后才能回复或评论。');window.history.back(-1);</script>")
Response.End
End If
End If
End Sub
Public Function filtpath(Str)
If is_relativepath = 1 Then
Dim nurl
nurl = Trim("http://" & request.ServerVariables("SERVER_NAME"))
nurl = nurl & request.ServerVariables("script_NAME")
nurl = Left(nurl, InStrRev(nurl, "/"))
filtpath = Replace(Str, nurl, "")
Else
filtpath = Str
End If
End Function
Public Function showpage(bTotal, bAllPages, sUnit)
Dim n, i, sTmp, strUrl
If G_P_PerMax=0 Then G_P_PerMax=1
If G_P_AllRecords Mod G_P_PerMax = 0 Then
n = G_P_AllRecords \ G_P_PerMax
Else
n = G_P_AllRecords \ G_P_PerMax + 1
End If
sTmp = "<div id=""showpage"">"
If bTotal = True Then
sTmp = sTmp & "共" & G_P_AllRecords & sUnit & " "
End If
strUrl = JoinChar(G_P_FileName)
If G_P_This < 2 Then
sTmp = sTmp & "首页 上一页 "
Else
sTmp = sTmp & "<a href='" & strUrl & "page=1'>首页</a> "
sTmp = sTmp & "<a href='" & strUrl & "page=" & (G_P_This - 1) & "'>上一页</a> "
End If
If n - G_P_This < 1 Then
sTmp = sTmp & "下一页 尾页"
Else
sTmp = sTmp & "<a href='" & strUrl & "page=" & (G_P_This + 1) & "'>下一页</a> "
sTmp = sTmp & "<a href='" & strUrl & "page=" & n & "'>尾页</a>"
End If
sTmp = sTmp & " 页次:" & G_P_This & "/" & n & "页 "
sTmp = sTmp & " " & G_P_PerMax & "" & sUnit & "/页"
If bAllPages = True Then
sTmp = sTmp & " 转到:<select name='page' size='1' onchange=""javascript:window.location='" & strUrl & "page=" & "'+this.options[this.selectedIndex].value;"">"
For i = 1 To n
sTmp = sTmp & "<option value='" & i & "'"
If CInt(G_P_This) = CInt(i) Then sTmp = sTmp & " selected "
sTmp = sTmp & ">" & i & "</option>"
Next
sTmp = sTmp & "</select>"
End If
sTmp = sTmp & "</div>"
showpage = sTmp
End Function
Function MakePageBar(rs,sUnit)
if request("page")<>"" then
G_P_This=cint(request("page"))
else
G_P_This=1
end if
If rs.EOF Then
G_P_Guide = G_P_Guide & " (共有0"&sUnit&")"
response.write " " & G_P_Guide
Else
G_P_AllRecords = rs.recordcount
G_P_Guide = G_P_Guide & " (共有" & G_P_AllRecords & sUnit & ")"
If G_P_This < 1 Then
G_currentPage = 1
End If
If (G_P_This - 1) * G_P_PerMax > G_P_AllRecords Then
If (G_P_AllRecords Mod G_P_PerMax) = 0 Then
G_P_This = G_P_AllRecords \ G_P_PerMax
Else
G_P_This = G_P_AllRecords \ G_P_PerMax + 1
End If
End If
If G_P_This = 1 Then
showContent
response.write oblog.showpage(True, True, sUnit)
Else
If (G_P_This - 1) * G_P_PerMax < G_P_AllRecords Then
rs.Move (G_P_This - 1) * G_P_PerMax
Dim bookmark
bookmark = rs.bookmark
showContent
response.write oblog.showpage(True, True, sUnit)
Else
G_currentPage = 1
showContent
response.write oblog.showpage(True, True, sUnit)
End If
End If
End If
End Function
Public Function JoinChar(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
Public Function htm2js(Str)
If Str = "" Or IsNull(Str) Then Str = " "
htm2js = "document.write('" & Replace(Replace(Replace(Replace(Str, "\", "\\"), "'", "\'"), vbCrLf, "\n"), Chr(13), "") & "');"
End Function
'将htm代码插入div
Public Function htm2js_div(Str, divid)
divid = Trim(divid)
If Str = "" Or IsNull(Str) Then Str = " "
htm2js_div = "if (chkdiv('" & divid & "')) {"
htm2js_div = htm2js_div & "document.getElementById('" & divid & "')" & ".innerHTML='" & Replace(Replace(Replace(Replace(Str, "\", "\\"), "'", "\'"), vbCrLf, "\n"), Chr(13), "") & "';}"
If divid = "subject" Then htm2js_div = htm2js_div & vbCrLf & "if (chkdiv('subject_l')) {document.getElementById('subject_l').innerHTML='" & Replace(Replace(Replace(Replace(Str, "\", "\\"), "'", "\'"), vbCrLf, "\n"), Chr(13), "") & "';}"
End Function
Public Function readfile(mPath, fName)
On Error Resume Next
Dim fs2, f2, fpath
Set fs2 = server.CreateObject(CacheCompont(1))
fpath = server.MapPath(mPath) & "\"
fpath = fpath & fName
Set f2 = fs2.OpenTextFile(fpath, 1, True)
readfile = f2.ReadAll
Set fs2 = Nothing
Set f2 = Nothing
End Function
Public Function showsize(size)
On Error Resume Next
If size = "" Or IsNull(size) Then
showsize = "0Byte"
Exit Function
End If
showsize = size & "Byte"
If size < 0 Then
showsize = "0KB"
Exit Function
End If
If size > 1024 Then
size = (size \ 1024)
showsize = size & "KB"
End If
If size > 1024 Then
size = (size / 1024)
showsize = FormatNumber(size, 2) & "MB"
End If
If size > 1024 Then
size = (size / 1024)
showsize = FormatNumber(size, 2) & "GB"
End If
End Function
Public Function ChkPost()
Dim server_v1, server_v2
ChkPost = False
If true_domain = 1 Then
ChkPost = True
Exit Function
End If
server_v1 = CStr(request.ServerVariables("HTTP_REFERER"))
server_v2 = CStr(request.ServerVariables("SERVER_NAME"))
If Mid(server_v1, 8, Len(server_v2)) = server_v2 Then ChkPost = True
End Function
Public Function filt_badstr(sSql)
If IsNull(sSql) Then Exit Function
sSql = Trim(sSql)
If sSql = "" Then Exit Function
sSql = Replace(sSql, Chr(0), "")
sSql = Replace(sSql, "'", "''")
'sSql=Replace(sSql,"%","%")
'sSql=Replace(sSql,"-","-")
filt_badstr = sSql
End Function
Public Function filt_astr(Str, n)
If IsNull(Str) Then
filt_astr = ""
Exit Function
End If
filt_astr = filt_badword(Str)
filt_astr = InterceptStr(filt_astr, n)
End Function
Public Function filt_html(Str)
On Error Resume Next
If Str = "" Then
filt_html = ""
Else
Str = Replace(Str, ">", ">")
Str = Replace(Str, "<", "<")
Str = Replace(Str, Chr(32), " ")
Str = Replace(Str, Chr(9), " ")
Str = Replace(Str, Chr(34), """)
Str = Replace(Str, Chr(39), "'")
Str = Replace(Str, Chr(13), "")
Str = Replace(Str, Chr(10) & Chr(10), " ")
Str = Replace(Str, Chr(10), " ")
filt_html = Str
End If
End Function
Public Function filt_html_b(fString)
On Error Resume Next
If Not IsNull(fString) And fString<>"" Then
fString = Replace(fString, ">", ">")
fString = Replace(fString, "<", "<")
fString = Replace(fString, Chr(32), " ")
fString = Replace(fString, Chr(9), " ")
fString = Replace(fString, Chr(34), """)
'fString = Replace(fString, CHR(39), "'")
fString = Replace(fString, Chr(13), "")
fString = Replace(fString, Chr(10) & Chr(10), "</p><p> ")
fString = Replace(fString, Chr(10), "<br> ")
filt_html_b = fString
Else
filt_html_b=""
End If
End Function
Public Function strLength(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
strLength = t
Else
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?