北京中华中医药协会:关于一个程序,在线等~谢谢

来源:百度文库 编辑:杭州交通信息网 时间:2024/05/07 06:48:09
下面的源码是我下载的,就是打算安装到论坛数据库,但是不行,谁能帮忙?QQ:33245421 在线等~~谢谢

<!--#include file="Conn.asp"-->
<!--#include file="mir2_conn.asp"-->
<title>论坛传奇插件安装程序</title>
<script language="javascript">
<!--
function checkclick(msg){
if(confirm(msg)){
event.returnValue=true;
}
else{
window.location.href=".";
}
}
checkclick("此安装程序将会修改您的 setup.asp 文件\n\n请先做好备份!否则出了问题我可不负责哦!\n\n如果您之前使用过旧版本(包括和社区同一个数据库),那么旧有数据将全部删除!\n\n您真的要安装吗?")
-->
</script>
%>
SetupFile=Server.MapPath("./setup.asp")
Set FSO=Server.CreateObject("SCRIPTING.FILESYSTEMOBJECT")
Set WF=FSO.OpenTextFile(SetupFile)
FileContent=Replace(WF.ReadAll,"<!--#include file=""conn.asp""-->","")
FileContent=Replace(FileContent,"<!-- #include file=""conn.asp"" -->","")
FileContent=Replace(FileContent,"<!--#include file=""mir2_conn.asp""-->","")
FileContent=Replace(FileContent,VBCRLF&"<!--#include file=""mir2_function.asp""-->"&VBCRLF,"")
FileContent=Replace(FileContent,VBCRLF&VBCRLF&VBCRLF,VBCRLF)
FileContent="<!--#include file=""conn.asp""-->"&VBCRLF&"<!--#include file=""mir2_conn.asp""-->"&VBCRLF&FileContent
Set WF=FSO.CreateTextFile(SetupFile,True)
WF.WriteLine FileContent
WF.Close
Set WF=Nothing
Set FSO=Nothing

Set conn=Server.CreateObject("ADODB.Connection")
conn.open ConnStr

if not conn.execute("select name from [menu] where name like '%传奇%'").eof then
conn.execute("delete from [menu] where name like '%传奇%'")
end if
if not conn.execute("select id from [menu] where name like '%服务%'").eof then
menuid=conn.execute("select id from [menu] where name like '%服务%'")(0)
sortnum=conn.execute("select max(sortnum) from [menu] where followid="&menuid&"")(0)+1
if conn.execute("select name from [menu] where name='热血传奇'").eof then
conn.execute("insert into menu(name,url,followid,sortnum) values ('热血传奇','mir2_index.asp',"&menuid&","&sortnum&")")
end if
else
word="<p align='center'>程序找不到您的数据库菜单列表,请在社区后台为此插件做一个连接!</p>"
end if

'如果以前曾经安装过,那么在导入数据前先将旧有数据删除,防止重复安装造成错误!
mir2_conn.execute("delete from [mir2gbook]")

'先检测用户是否第一次使用本插件
'如果是,则安装结束
'如果否,则删除旧有数据
If Not FirstTimeUse Then
conn.execute("drop table mir2user")
conn.execute("drop table mir2exp")
conn.execute("drop table mir2hp")
conn.execute("drop table mir2equip")
conn.execute("drop table mir2monster")
conn.execute("drop table mir2ck")
conn.execute("drop table mir2deal")
conn.execute("drop table mir2gbook")
conn.execute("drop table mir2config")
end if

response.Write "<p align='center'>安装成功