<%
'=========================================================
'　　　　　　　　　　　飞　扬　网　络
' Copyright (C) 2003-2005 feiyang.Com. All Rights Reserved.
' Web: http://www.feiyang.com
' QQ: 99686532        E-mail: bgh_edu@126.com
'=========================================================
%>
<%
If Request("Action")="lbaddsave" Then
Menu=request("Menu")
UpID=request("UpID")

ClassName=goback(left(server.htmlencode(trim(request("ClassName"))),60),"请填入类别名称!")
ListID=left(server.htmlencode(trim(request("ListID"))),60)
State=left(server.htmlencode(request("State")),60)
Memo=left(server.htmlencode(trim(request("Memo"))),60)

IF ListID="" Then ListID=0
IF Memo="" Then Memo="-"

Sql="Update QQCF_FeiLei Set Menu=-1 Where ClassID="&UpID
Conn.ExeCute Sql

Set Rs= Server.CreateObject("ADODB.Recordset")
Sql="Select * From WWW_QQCF_COM_Class"
Rs.Open Sql,Conn,3,2
Rs.addnew
Rs("Menu")=Menu
Rs("UpID")=UpID
Rs("ClassName")=ClassName
Rs("ListID")=ListID
Rs("State")=State
Rs("Memo")=Memo
Rs.update

Call AlertBack("类别加入成功",2)

End If       '类别加入

If Request("Action")="lbmodifysave" Then
Menu=Request("Menu")

ClassID=Request("ClassID")
ClassName=goback(left(server.htmlencode(trim(request("ClassName"))),60),"请填入类别名称!")
ListID=left(server.htmlencode(trim(request("ListID"))),60)
State=left(server.htmlencode(request("State")),60)
Memo=left(server.htmlencode(trim(request("Memo"))),60)

IF ListID="" Then ListID=0
IF Memo="" Then Memo="-"

Set Rs= Server.CreateObject("ADODB.Recordset")
Sql="Select * From WWW_QQCF_COM_Class where classid="&classid
Rs.Open Sql,Conn,3,2
Rs("Menu")=Menu
Rs("ClassName")=ClassName
Rs("ListID")=ListID
Rs("State")=State
Rs("Memo")=Memo
Rs.update


Call AlertBack("类别修改成功",2)
end if       '类别修改

if request("action")="lbdel" then
Set rs= Server.CreateObject("ADODB.Recordset")
sql="delete from WWW_QQCF_COM_Class where classid="&request("classid")
rs.open sql,conn,3,2

Call AlertBack("类别删除成功",1)
end if       '类别删除

if request("action")="wzaddsave" then
Title=goback(left(server.htmlencode(trim(request("Title"))),60),"请填入网站名称!")
Url=goback(left(server.htmlencode(trim(request("Url"))),6000),"请填入网站地址!")
Memo=server.htmlencode(trim(request("Memo")))
ClassID=goback(left(server.htmlencode(trim(request("ClassID"))),6000),"请选择网站类别!")
State=server.htmlencode(request("State"))
ListID=goback(left(server.htmlencode(trim(request("ListID"))),60),"请填入排序数字!")
Total=goback(left(server.htmlencode(trim(request("Total"))),60),"请填入游览总数!")

if Memo="" then Memo="-"

Set rs= Server.CreateObject("ADODB.Recordset")
sql="select Top 1 * from WWW_QQCF_COM_WebSite"
rs.open sql,conn,3,2
rs.addnew
rs("Title")=Title
rs("Url")=Url
rs("Memo")=Memo
rs("ClassID")=ClassID
rs("State")=State
rs("ListID")=ListID
rs("Total")=Total
rs.update

htmfile=left(request.servervariables("SCRIPT_NAME"),len(request.servervariables("SCRIPT_NAME"))-len("qqcf_admin_manage.asp"))&"QQCF_Zlist"&ClassID&".Htm"
aspfile=Tmp&"QQCF_List.Asp?Action=getcode&ClassID="&ClassID
htmcode=getCategories(aspfile)

Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set fout = fso.Createtextfile(server.mappath(htmfile),true)
Fout.WriteLine htmcode
Fout.Close

Call AlertBack("网址加入成功",2)
end if

if request("action")="wzmodifysave" then
id=request("id")
Title=goback(left(server.htmlencode(trim(request("Title"))),60),"请填入网站名称!")
Url=goback(left(server.htmlencode(trim(request("Url"))),6000),"请填入网站地址!")
Memo=server.htmlencode(trim(request("Memo")))
ClassID=goback(left(server.htmlencode(trim(request("ClassID"))),6000),"请选择网站类别!")
State=server.htmlencode(request("State"))
ListID=goback(left(server.htmlencode(trim(request("ListID"))),60),"请填入排序数字!")
Total=goback(left(server.htmlencode(trim(request("Total"))),60),"请填入游览总数!")

if Memo="" then Memo="-"

Set rs= Server.CreateObject("ADODB.Recordset")
sql="select * from WWW_QQCF_COM_WebSite where id="&id
rs.open sql,conn,3,2
rs("Title")=Title
rs("Url")=Url
rs("Memo")=Memo
rs("ClassID")=ClassID
rs("State")=State
rs("ListID")=ListID
rs("Total")=Total
rs.update

Set rs= Server.CreateObject("ADODB.Recordset")
sql="select * from WWW_QQCF_COM_WebSite where id="&id
rs.open sql,conn,1,1
ClassID=Rs("ClassID")

htmfile=left(request.servervariables("SCRIPT_NAME"),len(request.servervariables("SCRIPT_NAME"))-len("qqcf_admin_manage.asp"))&"QQCF_Zlist"&ClassID&".Htm"
aspfile=Tmp&"QQCF_List.Asp?Action=getcode&ClassID="&ClassID
htmcode=getCategories(aspfile)

Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set fout = fso.Createtextfile(server.mappath(htmfile),true)
Fout.WriteLine htmcode
Fout.Close

Call AlertBack("网址修改成功",2)
end if

if request("action")="wzdel" then

ID=request("id")

Set rs= Server.CreateObject("ADODB.Recordset")
sql="select * from WWW_QQCF_COM_WebSite where id="&ID
rs.open sql,conn,1,1
ClassID=Rs("ClassID")

Set rs= Server.CreateObject("ADODB.Recordset")
sql="delete from WWW_QQCF_COM_WebSite where id="&ID
rs.open sql,conn,3,2

htmfile=left(request.servervariables("SCRIPT_NAME"),len(request.servervariables("SCRIPT_NAME"))-len("qqcf_admin_manage.asp"))&"QQCF_Zlist"&ClassID&".Htm"
aspfile=Tmp&"QQCF_List.Asp?Action=getcode&ClassID="&ClassID
htmcode=getCategories(aspfile)

Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set fout = fso.Createtextfile(server.mappath(htmfile),true)
Fout.WriteLine htmcode
Fout.Close

Call AlertBack("网址删除成功",1)
end if       '网址删除

if request("action")="modifyadminsave" then
admin=goback(left(server.htmlencode(request("admin")),60),"请填入管理员名称!")
password=goback(left(server.htmlencode(request("password")),60),"请填入管理员密码!")
password2=goback(left(server.htmlencode(request("password2")),60),"请重复输入一次密码!")
htm=server.htmlencode(request("htm"))
AdBanner=server.htmlencode(request("AdBanner"))
qqshow=server.htmlencode(request("qqshow"))
qqcode=server.htmlencode(request("qqcode"))

if password<>password2 then Call AlertBack("两次密码输入不一致",1)

Set rs= Server.CreateObject("ADODB.Recordset")
sql="select * from WWW_QQCF_COM_Admin"
rs.open sql,conn,3,2
rs("admin")=admin
rs("password")=password
rs("htm")=htm
rs("AdBanner")=AdBanner
rs("qqshow")=qqshow
rs("qqcode")=qqcode
rs.update


htmfile=left(request.servervariables("SCRIPT_NAME"),len(request.servervariables("SCRIPT_NAME"))-len("qqcf_admin_manage.asp"))&"Index.Htm"
If Int(htm)=-1 Then
 htmcode="<script>location.href='QQCF_Zindex.htm';</script>"
Else
 htmcode="<script>location.href='QQCF_Index.Asp';</script>"
End If
Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set fout = fso.Createtextfile(server.mappath(htmfile),true)
Fout.WriteLine htmcode
Fout.Close


Call AlertBack("资料修改成功",1)
end if

if request("action")="adminlogout" then
Session("CfWZ_Admin")=""
Response.cookies("CfWZ_Admin_Cookie")=""
Response.Redirect "QQCF_Admin.Asp"
end if

if Request("Action")="back" then
 currf=request.form("currf")
 currf=server.mappath(currf)
 backf=request.form("backf")
 backf=server.mappath(backf)
 backfy=request.form("backfy")
 
Set objfso = Server.CreateObject("Scripting.FileSystemObject")
if err then 
err.clear
Call AlertBack("不能建立fso对象，请确保你的空间支持fso:！",1)
End If

 if objfso.Folderexists(backf) then
 else
  Set fy=objfso.CreateFolder(backf)
 end if

 objfso.copyfile currf,backf& "\"& backfy
Call AlertBack("备份数据库成功!",1)

End If '数据库备份结束

if Request("Action")="ys" then
currf=request.form("currf")
currf = server.mappath(currf)
assort=request.form("assort")

Const JET_3X = 4
strDBPath = left(currf,instrrev(currf,"\"))
on error resume next
 Set objfso = Server.CreateObject("Scripting.FileSystemObject")
if err then 
err.clear
Call AlertBack("不能建立fso对象，请确保你的空间支持fso:！",1)
end if

 if objfso.fileexists(currf) then 
 Set Engine = CreateObject("JRO.JetEngine")
on error resume next

If assort = 1 Then
 Engine.CompactDatabase "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & currf, _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & "cftemp.mdb;" _
& "Jet OLEDB:Engine Type=" & JET_3X
Else
Engine.CompactDatabase "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & currf, _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & "cftemp.mdb"
End If
objfso.CopyFile strDBPath & "cftemp.mdb",currf
objfso.DeleteFile(strDBPath & "cftemp.mdb")
Set objfso = nothing
Set Engine = nothing
if err then 
err.clear
Call AlertBack("错误：很抱歉，由于系统错误，压缩失败:！",1)
end if

Call AlertBack("压缩数据库成功！",1)
Else

Call AlertBack("错误:找不到数据库文件！",1)
End If

End If '压缩数据结束

if Request("Action")="reload" then
 currf=request.form("currf")
 currf=server.mappath(currf)
  backf=request.form("backf")
if backf="" then
	response.write "<script>alert(""请输入您要恢复的数据库全名"");history.back();</script>"	
	else
	backf=server.mappath(backf)
	end if
on error resume next
 Set objfso = Server.CreateObject("Scripting.FileSystemObject")
if err then 
	err.clear
response.write "<script>alert(""不能建立fso对象，请确保你的空间支持fso:！"");history.back();</script>"
response.end
	end if
 if objfso.fileexists(backf) then  
  objfso.copyfile ""&backf&"",""&currf&""
 response.write "<script>alert(""恢复数据库成功"");history.back();</script>"
response.end
 else
 response.write "<script>alert(""错误:备份目录下无您的备份文件！"");history.back();</script>"
 response.end

end if
end if 

if request("action")="indexhtmmake" then

htmfile=left(request.servervariables("SCRIPT_NAME"),len(request.servervariables("SCRIPT_NAME"))-len("qqcf_admin_manage.asp"))&"QQCF_Zindex.Htm"
aspfile=Tmp&"QQCF_Index.Asp?Action=getcode"
htmcode=getCategories(aspfile)

Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set fout = fso.Createtextfile(server.mappath(htmfile),true)
Fout.WriteLine htmcode
Fout.Close

Call AlertBack("更新静态首页成功!",1)
end if

if request("action")="classhtmmake" then

Set Rs=Server.CreateObject("Adodb.RecordSet")
Sql="Select * From WWW_QQCF_COM_Class Order By ClassID Desc"
Rs.Open Sql,Conn,1,1
While Not Rs.Eof		
htmfile=left(request.servervariables("SCRIPT_NAME"),len(request.servervariables("SCRIPT_NAME"))-len("qqcf_admin_manage.asp"))&"QQCF_Zlist"&Rs("ClassID")&".Htm"
aspfile=Tmp&"QQCF_List.Asp?Action=getcode&ClassID="&Rs("ClassID")
htmcode=getCategories(aspfile)

Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set fout = fso.Createtextfile(server.mappath(htmfile),true)
Fout.WriteLine htmcode
Fout.Close

Rs.MoveNext
Wend

Call AlertBack("更新静态栏目页成功!",1)
end if
%>