=======================
检测上页是否从本站提交
返回:true,false
=======================
function isselfrefer()
dim shttp_referer, sserver_name
shttp_referer = cstr(request.servervariables("http_referer"))
sserver_name = cstr(request.servervariables("server_name"))
if mid(shttp_referer, 8, len(sserver_name)) = sserver_name then
isselfrefer = true
else
isselfrefer = false
end if
end function
*****************************
创建文件目录
*****************************
dim fs,newpath,delpath,fpath,delfpath
function fsfolder(tname)
newpath=server.mappath(""&tname&"")
set fs=server.createobject("scripting.filesystemobject")
if fs.folderexists(newpath)=true then
response.write "<script language=javascript>"&_
"alert(有此文件夹名请重新命名);"&_
"history.go(-1);"&_
"</script>"
response.end
else
fs.createfolder(newpath)
set fs=nothing
end if
end function
*****************************
删除文件目录
*****************************
function delfolder(tname)
delpath=server.mappath(""&tname&"")
set fs=server.createobject("scripting.filesystemobject")
if fs.folderexists(delpath)=true then
fs.deletefolder delpath,true
end if
set fs=nothing
end function
***************************************
创建文件
***************************************
function createfile(fname,strfile)
dim fpath,os,fs
fpath=server.mappath(""&fname&"")
set fs=server.createobject("scripting.filesystemobject")
set os=fs.createtextfile(fpath,true,false)
os.write strfile
os.close
set os=nothing
set fs=nothing
end function
***************************************
删除文件
***************************************
function delfile(fname)
set fs=server.createobject("scripting.filesystemobject")
fname=server.mappath(fname)
response.write fname
if fs.fileexists(fname)=false then
exit function
else
fs.deletefile fname,true
end if
set fs=nothing
end function
*****************************
读取文件
*****************************
function readfile(fname)
dim strfile,fs,os
set fs=server.createobject("scripting.filesystemobject")
fname=server.mappath(fname)
if fs.fileexists(fname)=false then
readfile=""
exit function
else
set os=fs.opentextfile(fname,1,false,false)
strfile=os.readall
os.close
set os=nothing
response.write strfile
readfile=strfile
end if
set fs=nothing
end function
***——分页开始——
function urlstr(fieldname,fieldvalue)
dim i
if not isarray(fieldname) then exit function
for i=0 to ubound(fieldname)
urlstr=urlstr&"&"&cstr(fieldname(i))&"="&cstr(fieldvalue(i))
next
end function
function pagelist (ipagevalue,iretcount,icurrentpage,fieldname,fieldvalue)
dim url
dim pagecount 页总数
dim pageroot 页列表头
dim pagefoot 页列表尾
dim outstr
url=urlstr(fieldname,fieldvalue)
if (iretcount mod ipagevalue)=0 then
pagecount= iretcount \ ipagevalue
else
pagecount= (iretcount \ ipagevalue)+1
end if
if icurrentpage-4<=1 then
pageroot=1
else
pageroot=icurrentpage-4
end if
if icurrentpage+4>=pagecount then
pagefoot=pagecount
else
pagefoot=icurrentpage+4
end if
outstr="分页:"&icurrentpage&"/"&pagecount&"页 共"&iretcount&"条 "
if pageroot=1 then
if icurrentpage=1 then
outstr=outstr&"9"
outstr=outstr&"7 "
else
outstr=outstr&"<a href=?page=1"
outstr=outstr&url
outstr=outstr&" title=""首页"">9"
outstr=outstr&"<a href=?page="&icurrentpage-1
outstr=outstr&url
outstr=outstr&" title=""上页"">7 "
end if
else
outstr=outstr&"<a href=?page=1"
outstr=outstr&url
outstr=outstr&" title=""首页"">9"
outstr=outstr&"<a href=?page="&icurrentpage-1
outstr=outstr&url
outstr=outstr&" title=""上页"">7…"
end if
for i=pageroot to pagefoot
if i=cint(icurrentpage) then
outstr=outstr&"["+cstr(i)+"] "
else
outstr=outstr&"<a href=?page="&cstr(i)
outstr=outstr&url
outstr=outstr&">["+cstr(i)+"] "
end if
if i=pagecount then exit for
next
if pagefoot=pagecount then
if cint(icurrentpage)=cint(pagecount) then
outstr=outstr&"8"
outstr=outstr&":"
else
outstr=outstr&"<a href=?page="&icurrentpage+1
outstr=outstr&url
outstr=outstr&" title=""下页"">8"
outstr=outstr&"<a href=?page="&pagecount
outstr=outstr&url
outstr=outstr&" title=""尾页"">:"
end if
else
outstr=outstr&"… <a href=?page="&icurrentpage+1
outstr=outstr&url
outstr=outstr&" title=""下页"">8"
outstr=outstr&"<a href=?page="&pagecount
outstr=outstr&url
outstr=outstr&" title=""尾页"">:"
end if
outstr=outstr&" <input type=text class=in size=3 value="&icurrentpage&" onmouseover=this.focus();this.select() name=pgnumber> <input type=button id=button1 name=button1 class=bot value= go onclick="&""""&"if(document.all.pgnumber.value>0 && document.all.pgnumber.value<="&pagecount&"){window.location=?page=+document.all.pgnumber.value+"&url&"}"&""""&" onmouseover=this.focus() onfocus=this.blur() >"
pagelist=outstr
end function
