<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="../../Include/Connect.asp"-->
<!--#include file="../../Include/function.asp"-->
<!--#include file="../../Include/checksession.asp"-->
<%
if request.querystring("type")="photo" then
	Edit_GroupNums=0
	Edit_GroupDelNums=0
	Edit_GroupID=Split(Request.Form("groupid"),",")
	Edit_GroupName=Split(Request.Form("groupname"),",")
	Edit_GroupAccess=Split(Request.Form("groupaccess"),",")
	Edit_GroupDelID=Split(Request.Form("no"),",")
	For Each Edit_GroupEvery IN Edit_GroupID
	If Not IsInteger(Edit_GroupEvery) Then Edit_GroupEvery=0
	If Not IsInteger(Edit_GroupAccess(Edit_GroupNums)) Then Edit_GroupAccess(Edit_GroupNums)=1
	    Cn.Execute("UPDATE Show5_Photogroup SET Groupname='"&CheckStr(Edit_GroupName(Edit_GroupNums))&"',Groupaccess="&Edit_GroupAccess(Edit_GroupNums)&" WHERE GroupID="&Edit_GroupEvery&"")
		Edit_GroupNums=Edit_GroupNums+1
	Next
	IF Request.Form("no")<>Empty Then
	For Each Edit_GroupDelEvery IN Edit_GroupDelID
		Cn.Execute("DELETE FROM Show5_Photogroup WHERE GroupID="&Edit_GroupDelEvery&"")
		Edit_GroupDelNums=Edit_GroupDelNums+1
	Next
	End IF
	Dim new_GroupName
	new_GroupName=CheckStr(Request.Form("new_groupname"))
	new_GroupAccess=CheckStr(Request.Form("new_groupaccess"))
	If Request.Form("new_groupname")<>Empty then
    Cn.Execute("INSERT INTO Show5_Photogroup(Username,Groupname,Groupaccess) VALUES ('"&session("username")&"','"&new_GroupName&"',"&new_GroupAccess&")")
	End IF
    Response.write("<script>alert('相册分类保存成功！点击确认返回');window.location.replace('manage_folder.asp?type=photo');</script>")
elseif request.querystring("type")="article" then
	Edit_GroupNums=0
	Edit_GroupDelNums=0
	Edit_GroupID=Split(Request.Form("groupid"),",")
	Edit_GroupName=Split(Request.Form("groupname"),",")
	Edit_GroupAccess=Split(Request.Form("groupaccess"),",")
	Edit_GroupDelID=Split(Request.Form("no"),",")
	For Each Edit_GroupEvery IN Edit_GroupID
	If Not IsInteger(Edit_GroupEvery) Then Edit_GroupEvery=0
	If Not IsInteger(Edit_GroupAccess(Edit_GroupNums)) Then Edit_GroupAccess(Edit_GroupNums)=1
	    Cn.Execute("UPDATE Show5_Articlegroup SET Groupname='"&CheckStr(Edit_GroupName(Edit_GroupNums))&"',Groupaccess="&Edit_GroupAccess(Edit_GroupNums)&" WHERE GroupID="&Edit_GroupEvery&"")
		Edit_GroupNums=Edit_GroupNums+1
	Next
	IF Request.Form("no")<>Empty Then
	For Each Edit_GroupDelEvery IN Edit_GroupDelID
		Cn.Execute("DELETE FROM Show5_Articlegroup WHERE GroupID="&Edit_GroupDelEvery&"")
		Edit_GroupDelNums=Edit_GroupDelNums+1
	Next
	End IF
	new_GroupName=CheckStr(Request.Form("new_groupname"))
	new_GroupAccess=CheckStr(Request.Form("new_groupaccess"))
	If Request.Form("new_groupname")<>Empty then
    Cn.Execute("INSERT INTO Show5_Articlegroup(Username,Groupname,Groupaccess) VALUES ('"&session("username")&"','"&new_GroupName&"',"&new_GroupAccess&")")
	End IF
    Response.write("<script>alert('文章分类保存成功！点击确认返回');window.location.replace('manage_folder.asp?type=article');</script>")
elseif request.querystring("type")="video" then
	Edit_GroupNums=0
	Edit_GroupDelNums=0
	Edit_GroupID=Split(Request.Form("groupid"),",")
	Edit_GroupName=Split(Request.Form("groupname"),",")
	Edit_GroupAccess=Split(Request.Form("groupaccess"),",")
	Edit_GroupDelID=Split(Request.Form("no"),",")
	For Each Edit_GroupEvery IN Edit_GroupID
	If Not IsInteger(Edit_GroupEvery) Then Edit_GroupEvery=0
	If Not IsInteger(Edit_GroupAccess(Edit_GroupNums)) Then Edit_GroupAccess(Edit_GroupNums)=1
	    Cn.Execute("UPDATE Show5_Videogroup SET Groupname='"&CheckStr(Edit_GroupName(Edit_GroupNums))&"',Groupaccess="&Edit_GroupAccess(Edit_GroupNums)&" WHERE GroupID="&Edit_GroupEvery&"")
		Edit_GroupNums=Edit_GroupNums+1
	Next
	IF Request.Form("no")<>Empty Then
	For Each Edit_GroupDelEvery IN Edit_GroupDelID
		Cn.Execute("DELETE FROM Show5_Videogroup WHERE GroupID="&Edit_GroupDelEvery&"")
		Edit_GroupDelNums=Edit_GroupDelNums+1
	Next
	End IF
	new_GroupName=CheckStr(Request.Form("new_groupname"))
	new_GroupAccess=CheckStr(Request.Form("new_groupaccess"))
	If Request.Form("new_groupname")<>Empty then
    Cn.Execute("INSERT INTO Show5_Videogroup(Username,Groupname,Groupaccess) VALUES ('"&session("username")&"','"&new_GroupName&"',"&new_GroupAccess&")")
	End IF
    Response.write("<script>alert('视频分类保存成功！点击确认返回');window.location.replace('manage_folder.asp?type=video');</script>")
end if 
%>