📄 data.asp
字号:
<!--#include file="check.asp"-->
<!--#include file="../inc/page_cls.asp"-->
<!--#include file="../inc/ubb_cls.asp"-->
<%
dim action
server.scripttimeout =999999
const topicfile="../uploadfile/topicfile/"
const del="../uploadfile/del/"'移动文件的目录
response.write("<body>")
action=request.querystring("action")
select case action
case"saveautesqltable"
response.flush
saveautesqltable
case"saveaddsqltable"
response.flush
saveaddsqltable
case"delsqltable"
response.flush
delsqltable
case"compressdata2"
compressdata2
case"executesql"
executesql
case"delessay"
delessay
case"exedelessay"
exedelessay
case"exemoveessay"
exemoveessay
case"delsms"
delsms
case"exedelsms"
exedelsms
case"allsms"
allsms
case"exeallsms"
exeallsms
case"uploadfile"
uploadhead
uploadfile
case"delnouse"
notfso
uploadhead
delnouse
case"delnovisit"
notfso
uploadhead
delnovisit
case"deluphalfyear"
notfso
uploadhead
deluphalfyear
case"deloptfile"
notfso
uploadhead
deloptfile
case"delall"
notfso
uploadhead
delall
case "recycle"
recycle()
case "seerecycle"
seerecycle()
case "tbinfo"
tbinfo()
case "delrecycle"
delrecycle()
case "submit"
submit()
case "giveback"
giveback()
case "recycledelall"
recycledelall()
case "allmail"
allmail()
case else
sqltable
end select
adminfooter()
sub sqltable
dim alltable,i
%>
<div class="ta">
<div class="th jz">数据表管理</div>
<div class="td w772"><b>说明:</b><br />
默认选中的为当前论坛所使用来保存帖子数据的表,<br />删除数据表将同时全部删除该数据表的所有帖子,请注意!!!<br />
一般帖子数量超过4万左右,请再添加一个数据表,这样您会发现论坛会快很多。</div><div style='clear: both;'></div> </div>
<br />
<form method=post name=form style='margin:0' action=?action=saveautesqltable>
<div class="ta">
<div class="th jz">设置默认数据表</div>
<div class="td3 w219">数据</div>
<div class="td3 w87">帖数</div>
<div class="td3 w219">默认</div>
<div class="td3 w219" >操作</div>
<%alltable=split(yxbbs.bbstable(0),",")
for i=0 to ubound(alltable)
response.write"<div class=""td3 h20 w219"">yx_bbs"&alltable(i)&"</div><div class=""td3 h20 w87"">"&yxbbs.execute("select count(bbsid) from[yx_bbs"&alltable(i)&"]")(0)&"</div><div class=""td3 h20 w219""><input name='aute' type='radio' value='"&alltable(i)&"'"
if yxbbs.bbstable(1)=alltable(i) then
response.write" checked=""true""></div><a onclick=alert('该数据表为默认数据表,不能删除默认的数据表!') href='#'>"
else
response.write"></div><a onclick=checkclick('注意!删除将包括数据表的所有帖子!\n\n删除后将不能恢复!您确定要删除吗?') href='?action=delsqltable&id="&alltable(i)&"'>"
end if
response.write"<div class=""td3 h20 w219""><img src='../images/del.gif' width='15' height='15' border='0' align='absmiddle' /> 删除</a></div>"
next
%>
<div style="clear: both;"></div><div class="tf jz"><input type="submit" value=" 提 交 "> <input type="reset" value=" 重 置 "></div><div style='clear: both;'></div> </div></form><br />
<form method=post name=form style='margin:0' action=?action=saveaddsqltable>
<div class="ta">
<div class="th jz">增加数据表</div>
<div class="td w772">新数据表名称:yx_bbs
<input type="text" name="tablename" size="2" value="<%=int(ubound(alltable)+2)%>" onkeypress='event.returnvalue=(event.keycode >= 48) && (event.keycode <= 57);'> (只填写数字,不能和现有的数据表相同。)</div>
<div style="clear: both;"></div><div class="tf jz"><input type="submit" value=" 提 交 "> <input type="reset" value=" 重 置 "></div>
<div style='clear: both;'></div> </div></form>
<%
end sub
sub saveautesqltable
dim aute,temp,alltable,i
aute=yxbbs.fun.getstr("aute")
alltable=split(yxbbs.bbstable(0),",")
temp=""
for i=0 to ubound(alltable)
if aute=alltable(i) then temp="yes"
next
if temp="" then
call goback("系统出错","无效的数据表名称!"):exit sub
end if
if int(aute)<>int(yxbbs.bbstable(1)) then
temp=yxbbs.bbstable(0)&"|"&int(aute)
yxbbs.execute("update [yx_config] set bbstable='"&temp&"' ")
end if
cache.name="config"
cache.clean()
call suc("","更改论坛默认数据表成功!","?action=sqltable")
end sub
sub saveaddsqltable
dim tablename,alltable,i,temp
tablename=yxbbs.fun.getstr("tablename")
if not yxbbs.fun.isinteger(tablename) then
call goback("","请用正整数的数字填写!")
exit sub
end if
if int(tablename)=0 then
call goback("","数据表名不能为0")
exit sub
end if
alltable=split(yxbbs.bbstable(0),",")
for i=0 to ubound(alltable)
if int(tablename)=int(alltable(i)) then
call goback("","数据表名已经存在!")
exit sub
end if
next
temp=yxbbs.bbstable(0)&","&tablename&"|"&yxbbs.bbstable(1)
yxbbs.execute("update [yx_config] set bbstable='"&temp&"'")
yxbbs.execute("create table [yx_bbs"&tablename&"](bbsid int identity (1, 1) not null constraint primarykey primary key,topicid int default 0,replytopicid int default 0,boardid int default 0,name varchar(20),caption varchar(255),content text,face int default 0,addtime datetime,lasttime datetime,isdel bit,buyer text,ip varchar(40),ubbstring varchar(255))")
yxbbs.execute("create index topicid on [yx_bbs"&tablename&"] (topicid)")
yxbbs.execute("create index boardid on [yx_bbs"&tablename&"] (boardid)")
yxbbs.execute("create index replytopicid on [yx_bbs"&tablename&"] (replytopicid)")
cache.name="config"
cache.clean()
call suc("","成功的添加了 yx_bbs"&tablename&" 数据表!","?action=sqltable")
end sub
sub delsqltable
dim id,temp,alltable,i
id=request.querystring("id")
if int(id)=int(yxbbs.bbstable(1)) then
call goback("","该表被设定为默认使用表,不能删除!")
exit sub
end if
alltable=split(yxbbs.bbstable(0),",")
temp=""
for i=0 to ubound(alltable)
if int(id)=int(alltable(i)) then temp="yes"
next
if temp="" then
call goback("系统出错","无效的数据表名称!"):exit sub
end if
temp=""
for i=0 to ubound(alltable)
if int(id)<>int(alltable(i)) then
temp=temp&alltable(i)&","
end if
next
temp=left(temp,len(temp)-1)
temp=temp&"|"&yxbbs.bbstable(1)
yxbbs.execute("update [yx_config] set bbstable='"&temp&"'")
yxbbs.execute("drop table [yx_bbs"&id&"]")
yxbbs.execute("delete*from [yx_topic] where sqltableid="&id&"")
cache.name="config"
cache.clean()
call suc("","成功的删除名称为 yx_bbs"&id&" 的数据表及该数据表的所有帖子!","?action=sqltable")
end sub
sub compressdata2()
dim dbpath,boolis97,caption,content,fso,dbpath1,bkfolder,bkdbname,dbpath2,backpath
caption="压缩数据库"
content="<b>注意:</b>输入数据库所在相对路径,并且输入数据库名称(如果正在使用中数据库不能压缩,请选择备份数据库进行压缩操作)<hr size=1>"&_
"<form style='margin:0' method='post'action='?action=compressdata2&go=start'>压缩数据库:<input type='text' name='dbpath' value='请输入数据库路径'> <input type='submit' value='开始压缩'><br /></form>"&_
"<input type='checkbox' name='boolis97' value='true'>如果使用 access 97 数据库请选择(默认为 access 2000 数据库)"
call showtable(caption,content)
if request("go")="start" then
response.flush
dbpath = request("dbpath")
boolis97 = request("boolis97")
if dbpath <> "" then
if session(yxbbs.cachename&"fso")="no" then
call goback("","空间不支持fso,无法使用此功能!")
exit sub
end if
dbpath = server.mappath(dbpath)
content=compactdb(dbpath,boolis97)
call showtable(caption,content)
end if
end if
caption="备份论坛数据"
content="<b>注意:</b>为保证您的数据安全,备份时请不要用默认名称来命名备份数据库。<hr size=1>"&_
"<form style='margin:0' method='post' action='?action=compressdata2&go=starta'>当前数据库路径(相对路径):<input type=text size=15 name=dbpath1 value='请输入数据库路径'><br />"&_
"备份数据库目录(相对路径):<input type=text size='15' name='bkfolder' value='databak'> 如目录不存在,程序将自动创建<br />"&_
"备份数据库名称(填写名称):<input type=text size=15 name=bkdbname value='"&formatdatetime(now(),2)&".asp'> 如备份目录有该文件,将覆盖,如没有,将自动创建<br />"&_
"<input type=submit value=' 开始备份 '></form>"
call showtable(caption,content)
if request("go")="starta" then
if session(yxbbs.cachename&"fso")="no" then
call goback("","空间不支持fso,无法使用此功能!")
exit sub
end if
dbpath1=yxbbs.fun.getstr("dbpath1")
dbpath1=server.mappath(dbpath1)
bkfolder=yxbbs.fun.getstr("bkfolder")
bkdbname=yxbbs.fun.getstr("bkdbname")
set fso=server.createobject("scripting.filesystemobject")
if fso.fileexists(dbpath1) then
if checkdir(bkfolder) = true then
fso.copyfile dbpath1,bkfolder& "\"& bkdbname
else
makenewsdir bkfolder
fso.copyfile dbpath1,bkfolder& "\"& bkdbname
end if
caption="备份成功":content="备份数据库成功!您备份的数据库路径为 " &bkfolder& "\"& bkdbname
else
caption="错误信息":content="找不到您所需要备份的文件。"
end if
call showtable(caption,content)
end if
caption="恢复论坛数据"
content="<b>注意:</b>恢复数据库 一般是用来恢复(数据丢失或被破坏)的当前使用数据库。<hr size=1>"&_
"<form method='post' style='margin:0' action='?action=compressdata2&go=starth'>备份数据库(相对路径):<input type='text' size='30' name='backpath' value='databak/"&formatdatetime(now(),2)&".asp'> 请填写用来恢复的备份文件<br />"&_
"当前数据库(相对路径):<input type='text' size='30' name='dbpath2' value='请输入数据库路径'> 填写您当前使用的数据库<br /><input onclick=checkclick('您确定要用备份的数据库覆盖当然使用的数据库吗!?') type=submit value=' 恢复数据 '></form> "
call showtable(caption,content)
if request("go")="start" then
if session(yxbbs.cachename&"fso")="no" then
call goback("","空间不支持fso,无法使用此功能!")
exit sub
end if
if request("go")="starth" then
caption="错误信息"
dbpath2=yxbbs.fun.getstr("dbpath2")
backpath=yxbbs.fun.getstr("backpath")
if backpath="" or dbpath2="" then
content="请把全名填写完整!"
else
dbpath2=server.mappath(dbpath2)
backpath2=server.mappath(backpath2)
set fso=server.createobject("scripting.filesystemobject")
if fso.fileexists(dbpath2) then
on error resume next
fso.copyfile backpath,dbpath2
if err.number=0 then
caption="恢复成功":content="成功的恢复数据库!"
else
caption="错误信息":content="不是当前使用的数据库全名"
err.clear
end if
else
content= "备份目录下并无您的备份文件!"
end if
end if
call showtable(caption,content)
end if
end if
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -