📄 update.asp
字号:
<ul>
<li>2、将本栏目及其下属栏目的数据都转移至目标栏目,并删除本栏目及其下属栏目;</li>
</ul>
<ul>
<li>3、合并后您所指定的栏目(或者包括其下属栏目)将被删除,所有数据将转移到您所指定的目标频道中。</li>
</ul>
<ul><li> </li></ul>
</div>
</div>
<%else%>
<div class="minB">
<!--32-->
<div class="list line30">
<ul class="borderB">
<li><strong class="color f14">操作说明:</strong>正在处理数据,未出现下一步之前,请勿刷新或关闭浏览器!</li>
</ul>
<ul><li> </li></ul>
<ul>
<li class="left" style="width:250px;">供求信息转移成功!</li>
<%
'as_news comment
dim num
i=0
set rs=conn.execute("select * from as_news order by newsID asc")
if not(rs.bof and rs.eof) then
do while not rs.eof
i=i+1
'统计评论数
num=0
num=anysale.getValue("as_comment","count(*)","groups=6 and ID="&rs("newsID"))
'将新的newchannelID替换as_news里的oldchannelID
conn.execute("update as_news set comment="&num&" where newsID="&rs("newsID"))
rs.movenext
loop
end if
response.write b&"成功统计"&i&"条as_news评论"&e
Response.Flush
'as_user md5,为32位,大小转为小写 userInfo统计 money统计(改变level)
dim userInfo,money
i=0
set rs=conn.execute("select userID,username,logins,istrust from as_user order by userID asc")
if not(rs.bof and rs.eof) then
do while not rs.eof
i=i+1
'统计会员信息
userInfo=anysale.getValue("as_business","count(*)","channelID=1 and userID="&rs("userID"))'供应
userInfo=userInfo&"|||"&anysale.getValue("as_business","count(*)","channelID=2 and userID="&rs("userID"))'求购
userInfo=userInfo&"|||"&anysale.getValue("as_business","count(*)","channelID=3 and userID="&rs("userID"))'服务
userInfo=userInfo&"|||"&anysale.getValue("as_products","count(*)","userID="&rs("userID"))'产品
userInfo=userInfo&"|||0|||0|||0|||0|||0|||0|||0|||0|||"&anysale.getValue("as_comment","count(*)","isuser=1 and username='"&rs("username")&"'")'招聘|||展会|||资讯|||文章|||论坛主题|||帖子|||精华帖|||新闻|||评论
userInfo=userInfo&"|||"&anysale.getValue("as_upfile","count(*)","userID="&rs("userID"))'上传
userInfo=userInfo&"|||"&anysale.getValue("as_friend","count(*)","userID="&rs("userID"))'好友
userInfo=userInfo&"|||"&anysale.getValue("as_favorite","count(*)","userID="&rs("userID"))'收藏
userInfo=userInfo&"|||0|||0|||0|||"&anysale.getValue("as_message","count(*)","isdel=0 and incept='"&rs("username")&"'")'收到询价|||未读询价|||询价议价|||收到留言
userInfo=userInfo&"|||"&anysale.getValue("as_message","count(*)","isdel=0 and isread=0 and incept='"&rs("username")&"'")'未读留言
userInfo=userInfo&"|||"&anysale.getValue("as_message","count(*)","sender='"&rs("username")&"'")'发送留言
userInfo=userInfo&"|||0|||0|||0"'收到简历|||未读简历|||发送简历
money=0
money=trim(anysale.asMoney(0)) + rs("logins")*trim(anysale.asMoney(1)) + rs("istrust")*trim(anysale.asMoney(2))
money=money + (anysale.getValue("as_business","count(*)","userID="&rs("userID"))+anysale.getValue("as_products","count(*)","userID="&rs("userID")))*trim(anysale.asMoney(3))
money=money + anysale.getValue("as_message","count(*)","sender='"&rs("username")&"'")*trim(anysale.asMoney(6))
money=money + anysale.getValue("as_comment","count(*)","isuser=1 and username='"&rs("username")&"'")*trim(anysale.asMoney(8))
money=money + anysale.getValue("as_comment","count(*)","isbest=1 and isuser=1 and username='"&rs("username")&"'")*trim(anysale.asMoney(5))
conn.execute("update as_user set userInfo='"&anysale.checkStr(userInfo)&"',[money]="&money&" where userID="&rs("userID"))
call anysale.setMoney(0,"userID="&rs("userID"))
rs.movenext
loop
end if
response.write b&"成功统计"&i&"条会员信息"&e
Response.Flush
'as_config siteInfo 统计
dim siteInfo
siteInfo=anysale.getValue("as_business","count(*)","channelID=1")'供应
siteInfo=siteInfo&"|||"&anysale.getValue("as_business","count(*)","channelID=2")'求购
siteInfo=siteInfo&"|||"&anysale.getValue("as_business","count(*)","channelID=3")'服务
siteInfo=siteInfo&"|||"&anysale.getValue("as_products","count(*)","")'产品
siteInfo=siteInfo&"|||"&anysale.getValue("as_user","count(*)","")'企业
siteInfo=siteInfo&"|||"&anysale.getValue("as_user","count(*)","istrust=1")'诚信企业
siteInfo=siteInfo&"|||0|||0"'招聘|||展会
siteInfo=siteInfo&"|||"&anysale.getValue("as_news","count(*)","")'资讯
siteInfo=siteInfo&"|||0|||0|||0|||0|||0"'文章|||论坛主题|||帖子|||精华帖|||新闻
siteInfo=siteInfo&"|||"&anysale.getValue("as_comment","count(*)","")'评论
conn.execute("update as_config set siteInfo='"&anysale.checkStr(siteInfo)&"'")
response.write b&"成功统计网站信息"&e
Response.Flush
%>
</ul>
</div>
</div>
<div>
<ul>
<li> </li>
<li> </li>
<li class="txtCen title green"><input type="submit" name="submit" value="下一步:压缩数据库" class="button" onmouseover="this.className='buttonH'" onmouseout="this.className='button'" /></li>
<li> </li>
<li> </li>
<li> </li>
</ul>
</div>
</form>
<%
end if
closeData()
end sub
sub step5()
if request.form("database")="" then
response.write"<div class=""txtCen title"" style=""padding:150px 0 226px 0;"">请输入正确的数据库名称!<br /><br /><br /><br /><button onclick=""javascript:history.go(-1);"" class=""button"" onmouseover=""this.className='buttonH'"" onmouseout=""this.className='button'""> 返 回 </button></div>"
exit sub
end if
%>
<div>
<ul>
<li> </li>
<li> </li>
<li class="txtCen title green">第五步:压缩数据库</li>
<li> </li>
<li> </li>
<li> </li>
<li class="txtCen title red">
<%=CompactDB(Server.Mappath(myDbPath&db),False)%>
</li>
<li> </li>
</ul>
</div>
<form name="step5" id="step5" method="post" action="?action=step6">
<input type="hidden" value="<%=request("database")%>" name="database">
<div class="minB">
<div class="list line30">
<ul>
<li> </li>
<li> </li>
<li class="txtCen title green"><input type="submit" name="submit" value="升级成功:删除升级文件&返回首页" class="button" onmouseover="this.className='buttonH'" onmouseout="this.className='button'" /></li>
<li> </li>
<li> </li>
<li> </li>
</ul>
<ul class="borderB">
<li class="color f14"><strong>其它操作</strong></li>
</ul>
<ul>
<li><strong>操作说明,请仔细阅读操作说明后进行操作:</strong></li>
</ul>
<ul>
<li>1、请进入后台更新网站"系统常规设置"和"网站广告管理"相关数据。</li>
</ul>
<ul>
<li>2、关于我们、使用帮助,会员权限相关内容根据需要进行改变。</li>
</ul>
<ul><li> </li></ul>
<!--list.end-->
</div>
</div>
</form>
<%
end sub
sub step6()
dim objFSO,path
path=request("database")
set objFSO = server.createObject("scripting.fileSystemObject")
if objFSO.fileExists(server.mapPath(path)) then
objFSO.deleteFile(server.mapPath(path))
end if
if objFSO.fileExists(server.mapPath("update.asp")) then
objFSO.deleteFile(server.mapPath("update.asp"))
end if
set objFSO=nothing
response.redirect "index.asp"
end sub
Sub Conntting(db)
'On Error Resume Next
Set uConn = Server.CreateObject("ADODB.Connection")
uConnStr = "Provider = Microsoft.Jet.OLEDB.4.0;Data Source = " & Server.MapPath(db)
uConn.Open uConnStr
If Err Then
Err.Clear
Set uConn = Nothing
Response.Write "数据库连接出错,请检查连接字串,请确认您输入的数据库地址是否正确。"
Response.End
End If
End Sub
Sub closeData()
uConn.Close
Set uConn=Nothing
End Sub
'=====================压缩参数=========================
Function CompactDB(dbPath, boolIs97)
On Error Resume Next
Dim fso, Engine, strDBPath,JET_3X
strDBPath = left(dbPath,instrrev(DBPath,"\"))
Set fso = CreateObject("Scripting.FileSystemObject")
If Err Then
Err.Clear
CompactDB = "您当前升级操作目录不支持FSO,请手动进行压缩数据库操作!" & vbCrLf
Exit Function
End If
If fso.FileExists(dbPath) Then
fso.CopyFile dbpath,strDBPath & "temp.mdb"
Set Engine = CreateObject("JRO.JetEngine")
If boolIs97 = "True" Then
Engine.CompactDatabase "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & "temp.mdb", _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & "temp1.mdb;" _
& "Jet OLEDB:Engine Type=" & JET_3X
Else
Engine.CompactDatabase "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & "temp.mdb", _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & "temp1.mdb"
End If
fso.CopyFile strDBPath & "temp1.mdb",dbpath
fso.DeleteFile(strDBPath & "temp.mdb")
fso.DeleteFile(strDBPath & "temp1.mdb")
Set fso = Nothing
Set Engine = Nothing
CompactDB = "恭喜! 你的数据库已经压缩成功!" & vbCrLf
Else
CompactDB = "数据库名称或路径不正确. 请重试!" & vbCrLf
End If
End Function
sub checkAndFixChannel(table,parentID,orders)
dim rs,child,parentStr
if parentID=0 Then
conn.execute("update as_"&table&" set depth=0,parentStr='0' where parentID=0")
end if
set rs=conn.execute("select "&table&"ID,rootID,parentStr,depth from as_"&table&" where parentID="&parentID&" order by rootID,orders")
do while not rs.eof
if rs(2)<>"0" then
parentStr=rs(2)&","&rs(0)
else
parentStr=rs(0)
end If
conn.execute "update as_"&table&" set depth="&rs(3)+1&",parentStr='"&parentStr&"',rootID="&rs(1)&" where parentID="&rs(0)&"",child
conn.Execute("update as_"&table&" set child="&child&",orders="&orders&" where "&table&"ID="&rs(0)&"")
conn.Execute("update as_"&table&" set child="&child&" where "&table&"ID="&rs(0)&"")
orders=orders+1
checkAndFixChannel table,rs(0),orders
rs.moveNext
loop
set rs=nothing
end sub
sub channelChild(table)
dim cChannelNum, cChannelID
dim trs,rs,sql
dim n,i
conn.execute("update as_"&table&" set child=0")
set rs = conn.execute("select "&table&"ID,rootID,parentID,depth,child,parentStr from as_"&table&" order by "&table&"ID desc")
if not (rs.eof and rs.bof) then
sql=rs.getRows(-1)
rs.close:set rs=nothing
for n=0 to ubound(sql,2)
if isnull(sql(4,n)) and cint(sql(3,n))>0 then
conn.execute("update as_"&table&" set child=0 where "&table&"ID="&sql(0,n))
end if
if cint(sql(2,n))=0 and cint(sql(3,n))=0 then
set trs=conn.execute("select count(*) from as_"&table&" where rootID="&sql(1,n))
cChannelNum=trs(0)-1
trs.close:set trs=nothing
if isnull(cChannelNum) or cChannelNum<0 then cChannelNum=0
conn.execute("update as_"&table&" set child="&cChannelNum& " where "&table&"ID="&sql(0,n))
elseif cint(sql(3,n))>1 then
cChannelID=split(sql(5,n),",")
for i=1 to ubound(cChannelID)
conn.execute("update as_"&table&" set child=child+1 where "&table&"ID="&cChannelID(i))
next
end if
next
end if
end sub
function IDSelect(table,parentID,groups,isuser,editID)
dim rs,sql,i
sql="select "&table&"ID,"&table&"Type,depth,child from "&table&" where parentID="&parentID
if groups>0 then
sql=sql+" and types="&groups
end if
if isuser=1 then
sql=sql+" and userID="&anysale.userID
end if
sql=sql+" order by orders,rootID"
set rs=uconn.execute(sql)
do while not rs.eof
response.write " <option value="""&rs(0)&""""
if editID = rs(0) then response.write " selected=""selected"" " end if
response.write ">"
if rs("depth")>0 then
for i=1 to rs("depth")
response.write "-"
next
end if
response.write ""&rs(1)&""
response.write "</option>"
IDSelect table,rs(0),groups,isuser,editID
rs.moveNext
loop
rs.close
set rs=nothing
end function
anysale.minFoot
closeConn
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -