<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="../conn.asp" -->
<!--#include file="logout.asp" -->
<!--#include file="MD5.asp" -->
<%
dim action
set rs=server.createobject("adodb.recordset")
action=request("action")
if action="modpass" then call modpass()
'====新闻 ======
if action="addnews" then call addnews()
if action="modnews" then call modnews()
if action="newsgood" then call newsgood()
if action="news_up" then call news_up()
if action="news_down" then call news_down()
if action="modwm" then call modwm()


if action="addfaq" then call addfaq()
if action="modfaq" then call modfaq()

'====教师 ======
if action="addteacher" then call addteacher()
if action="modteacher" then call modteacher()
if action="tgood" then call tgood()
if action="t_up" then call t_up()
if action="t_down" then call t_down()
'==作品==========
if action="addzp" then call addzp()
if action="modzp" then call modzp()
if action="zpgood" then call zpgood()
if action="zp_up" then call zp_up()
if action="zp_down" then call zp_down()

'==环境==========
if action="addhj" then call addhj()
if action="modhj" then call modhj()
if action="hjgood" then call hjgood()
if action="hj_up" then call hj_up()
if action="hj_down" then call hj_down()
'======专业===========
if action="addzhuanye" then call addzhuanye()
if action="modzhuanye" then call modzhuanye()
if action="lx" then call lx()

'=====修改密码==========
sub modpass()
ypass=request("ypass")
pass=request("pass")
rpass=request("rpass")
if ypass="" then call mb("请输入原密码","0","")
if pass="" then call mb("请输入新密码","0","")
if rpass="" then call mb("请输入新密码确认","0","")
if rpass<>pass then call mb("两次密码输入不一致","0","")

ypass=md5(ypass)
pass=md5(pass)

sql="select * from admin where admin_name='"&session("admin_name")&"'"
rs.open sql,conn,1,3
if rs("admin_pass")<>ypass then 
	call mb("您提供的原密码不正确","0","")
else
rs("admin_pass")=pass
rs.update
call mb("系统提示：恭喜你修改成功","1","Modify_pass.asp")
end if
rs.close
set rs=nothing
end sub


sub modwm()
id=request("id")
content=request("content")
set rs=server.CreateObject("adodb.recordset")
sql="Select * From about where id="&id
rs.open sql,conn,1,3
rs("content")=content
rs.update
call mb("恭喜！修改成功！",1,"Modify_info.asp?id="&id)
rs.close
set rs=nothing
end sub

'======添加新闻===============
sub addnews()
title=request("title")
bigclassid=request("bigclassid")
newstype=request("newstype")
pathfilename=request("d_savepathfilename")
d_savefilename=request("d_savefilename")
d_picture=request("d_picture")
if d_picture="" then d_picture="nopic"
good=request("good")
if good="" then good=false
focus=request("focus")
if focus="" then focus=false
content=request("content")
set rs=conn.execute("Select * From news where bigclassid=1 order by id desc")
if rs.eof then
ord=1
else
ord=rs("id")+1
rs.close
set rs=nothing
end if

set rs=server.CreateObject("adodb.recordset")
sql="Select * From news"
rs.open sql,conn,1,3
rs.addnew
rs("title")=title
rs("smallclassname")=newstype
rs("bigclassid")=bigclassid
rs("d_picture")=d_picture
rs("D_SaveFileName")=d_savefilename
rs("D_SavePathFileName")=pathfilename
rs("good")=good
rs("focus")=focus
rs("content")=content
rs("addtime")=date()
rs("ord")=ord
rs.update

call Confirm("恭喜！发布成功！继续发布请点击确认！","add_news.asp","Manage_news.asp")
rs.close
set rs=nothing
end sub
'======修改新闻===============
sub modnews()
id=request("id")
page=request("page")
title=request("title")
newstype=request("newstype")
pathfilename=request("d_savepathfilename")
d_savefilename=request("d_savefilename")
d_picture=request("d_picture")
if d_picture="" then d_picture="nopic"
good=request("good")
if good="" then good=0
focus=request("focus")
if focus="" then focus=0
content=request("content")
set rs=server.CreateObject("adodb.recordset")
sql="Select * From news where id="&id
rs.open sql,conn,1,3
rs("title")=title
rs("smallclassname")=newstype
rs("d_picture")=d_picture
rs("D_SaveFileName")=d_savefilename
rs("D_SavePathFileName")=pathfilename
rs("good")=good
rs("focus")=focus
rs("content")=content
rs.update
call mb("恭喜！修改成功！",1,"Manage_news.asp?nclass="&newstype&"&page="&page&"")
rs.close
set rs=nothing
end sub
'==========推荐新闻============
sub newsgood()
id=request("id")
url=request("url")
url2=request("url2")
set rs=server.CreateObject("adodb.recordset")
sql="Select * From news where id="&id
rs.open sql,conn,1,3
good=rs("good")
if rs("good")=true then
	good=0
else
	good=1
end if
conn.execute("update news set good='"&good&"'where id="&id)
response.Redirect""&url2&"?"&url&""
rs.close
set rs=nothing
end sub
'====新闻排序 向下===========
sub news_down()
id=int(request("id"))'当前记录的id号
page=request("page")
nclass=request("nclass")
set rs=conn.execute("Select id,ord From news where smallclassname='"&nclass&"' and bigclassid=1 order by ord desc,id desc")
do while not rs.eof
nid=int(rs(0))
if id=nid then
	t22=int(rs(1))'当前记录的排序号
	rs.movenext
if rs.eof then exit do
	t2=int(rs(0))'下一记录的id号
	t11=int(rs(1))'下一记录的排序号
	conn.execute("update news set ord="&t11&" where id="&id)
	conn.execute("update news set ord="&t22&" where id="&t2)
	exit do
end if
rs.movenext
loop
response.Redirect "Manage_news.asp?page="&page&"&nclass="&nclass&""
rs.close
set rs=nothing
end sub

'====新闻排序 向下===========
sub news_up()
id=int(request("id"))'当前记录的id号
page=request("page")
nclass=request("nclass")
set rs=server.CreateObject("adodb.recordset")
rs.open "Select id,ord From news where smallclassname='"&nclass&"' and bigclassid=1 order by ord desc,id desc",conn,1,3
do while not rs.eof
nid=int(rs(0))

if id=nid then
	t22=int(rs(1))'当前记录的排序号
	rs.MovePrevious
if rs.bof then exit do
	t2=int(rs(0))'下一记录的id号
	t11=int(rs(1))'下一记录的排序号
	conn.execute("update news set ord="&t11&" where id="&id)
	conn.execute("update news set ord="&t22&" where id="&t2)
	exit do
end if
rs.movenext
loop
response.Redirect "Manage_news.asp?page="&page&"&nclass="&nclass&""
rs.close
set rs=nothing
end sub
'======添加师资===============
sub addteacher()
title=request("title")
bigclassid=request("bigclassid")
newstype=request("newstype")
pathfilename=request("d_savepathfilename")
d_savefilename=request("d_savefilename")
d_picture=request("d_picture")
if d_picture="" then d_picture="nopic"
good=request("good")
if good="" then good=0
focus=request("focus")
if focus="" then focus=0
content=request("content")
set rs=conn.execute("Select * From news where bigclassid=3 order by id desc")
if rs.eof then
ord=1
else
ord=rs("id")+1
rs.close
set rs=nothing
end if

set rs=server.CreateObject("adodb.recordset")
sql="Select * From news"
rs.open sql,conn,1,3
rs.addnew
rs("title")=title
rs("smallclassname")=newstype
rs("bigclassid")=bigclassid
rs("d_picture")=d_picture
rs("D_SaveFileName")=d_savefilename
rs("D_SavePathFileName")=pathfilename
rs("good")=good
rs("focus")=focus
rs("content")=content
rs("addtime")=date()
rs("ord")=ord
rs.update

call Confirm("恭喜！发布成功！继续发布请点击确认！","add_teacher.asp","Manage_teacher.asp")
rs.close
set rs=nothing
end sub
'======修改师资===============
sub modteacher()
id=request("id")
page=request("page")
title=request("title")
newstype=request("newstype")
pathfilename=request("d_savepathfilename")
d_savefilename=request("d_savefilename")
d_picture=request("d_picture")
if d_picture="" then d_picture="nopic"
good=request("good")
if good="" then good=0
content=request("content")
set rs=server.CreateObject("adodb.recordset")
sql="Select * From news where id="&id
rs.open sql,conn,1,3
rs("title")=title
rs("smallclassname")=newstype
rs("d_picture")=d_picture
rs("D_SaveFileName")=d_savefilename
rs("D_SavePathFileName")=pathfilename
rs("good")=good
rs("content")=content
rs.update
call mb("恭喜！修改成功！",1,"Manage_teacher.asp?nclass="&newstype&"&page="&page&"")
rs.close
set rs=nothing
end sub

'==========推荐教师============
sub tgood()
id=request("id")
url=request("url")
url2=request("url2")
set rs=server.CreateObject("adodb.recordset")
sql="Select * From news where id="&id
rs.open sql,conn,1,3
good=rs("good")
if rs("good")=true then
	good=0
else
	good=1
end if
conn.execute("update news set good='"&good&"'where id="&id)
response.Redirect""&url2&"?"&url&""
rs.close
set rs=nothing
end sub
'====教师排序 向下===========
sub t_down()
id=int(request("id"))'当前记录的id号
page=request("page")
nclass=request("nclass")
set rs=conn.execute("Select id,ord From news where bigclassid=3  order by ord desc,id desc")
do while not rs.eof
nid=int(rs(0))
if id=nid then
	t22=int(rs(1))'当前记录的排序号
	rs.movenext
if rs.eof then exit do
	t2=int(rs(0))'下一记录的id号
	t11=int(rs(1))'下一记录的排序号
	conn.execute("update news set ord="&t11&" where id="&id)
	conn.execute("update news set ord="&t22&" where id="&t2)
	exit do
end if
rs.movenext
loop
response.Redirect "Manage_teacher.asp?page="&page
rs.close
set rs=nothing
end sub

'====教师排序 向上===========
sub t_up()
id=int(request("id"))'当前记录的id号
page=request("page")
nclass=request("nclass")
set rs=server.CreateObject("adodb.recordset")
rs.open "Select id,ord From news where bigclassid=3 order by ord desc,id desc",conn,1,3
do while not rs.eof
nid=int(rs(0))

if id=nid then
	t22=int(rs(1))'当前记录的排序号
	rs.MovePrevious
if rs.bof then exit do
	t2=int(rs(0))'下一记录的id号
	t11=int(rs(1))'下一记录的排序号
	conn.execute("update news set ord="&t11&" where id="&id)
	conn.execute("update news set ord="&t22&" where id="&t2)
	exit do
end if
rs.movenext
loop
response.Redirect "Manage_teacher.asp?page="&page
rs.close
set rs=nothing
end sub



'======添加作品===============
sub addzp()
title=request("title")
bigclassid=request("bigclassid")
newstype=request("newstype")
pathfilename=request("d_savepathfilename")
d_savefilename=request("d_savefilename")
d_picture=request("d_picture")
if d_picture="" then d_picture="nopic"
good=request("good")
if good="" then good=0
focus=request("focus")
if focus="" then focus=0
content=request("content")
set rs=conn.execute("Select * From news where bigclassid=2 order by id desc")
if rs.eof then
ord=1
else
ord=rs("id")+1
rs.close
set rs=nothing
end if

set rs=server.CreateObject("adodb.recordset")
sql="Select * From news"
rs.open sql,conn,1,3
rs.addnew
rs("title")=title
rs("smallclassname")=newstype
rs("bigclassid")=bigclassid
rs("d_picture")=d_picture
rs("D_SaveFileName")=d_savefilename
rs("D_SavePathFileName")=pathfilename
rs("good")=good
rs("focus")=focus
rs("content")=content
rs("addtime")=date()
rs("ord")=ord
rs.update

call Confirm("恭喜！发布成功！继续发布请点击确认！","add_zp.asp","Manage_zp.asp")
rs.close
set rs=nothing
end sub
'======修改作品===============
sub modzp()
id=request("id")
page=request("page")
title=request("title")
newstype=request("newstype")
pathfilename=request("d_savepathfilename")
d_savefilename=request("d_savefilename")
d_picture=request("d_picture")
if d_picture="" then d_picture="nopic"
good=request("good")
if good="" then good=0
content=request("content")
set rs=server.CreateObject("adodb.recordset")
sql="Select * From news where id="&id
rs.open sql,conn,1,3
rs("title")=title
rs("smallclassname")=newstype
rs("d_picture")=d_picture
rs("D_SaveFileName")=d_savefilename
rs("D_SavePathFileName")=pathfilename
rs("good")=good
rs("content")=content
rs.update
call mb("恭喜！修改成功！",1,"Manage_zp.asp?nclass="&newstype&"&page="&page&"")
rs.close
set rs=nothing
end sub

'==========推荐作品============
sub zpgood()
id=request("id")
url=request("url")
url2=request("url2")
set rs=server.CreateObject("adodb.recordset")
sql="Select * From news where id="&id
rs.open sql,conn,1,3
good=rs("good")
if rs("good")=true then
	good=0
else
	good=1
end if
conn.execute("update news set good='"&good&"'where id="&id)
response.Redirect""&url2&"?"&url&""
rs.close
set rs=nothing
end sub
'====作品排序 向下===========
sub zp_down()
id=int(request("id"))'当前记录的id号
page=request("page")
nclass=request("nclass")
set rs=conn.execute("Select id,ord From news where bigclassid=2  order by ord desc,id desc")
do while not rs.eof
nid=int(rs(0))
if id=nid then
	t22=int(rs(1))'当前记录的排序号
	rs.movenext
if rs.eof then exit do
	t2=int(rs(0))'下一记录的id号
	t11=int(rs(1))'下一记录的排序号
	conn.execute("update news set ord="&t11&" where id="&id)
	conn.execute("update news set ord="&t22&" where id="&t2)
	exit do
end if
rs.movenext
loop
response.Redirect "Manage_zp.asp?page="&page
rs.close
set rs=nothing
end sub

'====作品排序 向上===========
sub zp_up()
id=int(request("id"))'当前记录的id号
page=request("page")
nclass=request("nclass")
set rs=server.CreateObject("adodb.recordset")
rs.open "Select id,ord From news where bigclassid=2 order by ord desc,id desc",conn,1,3
do while not rs.eof
nid=int(rs(0))

if id=nid then
	t22=int(rs(1))'当前记录的排序号
	rs.MovePrevious
if rs.bof then exit do
	t2=int(rs(0))'下一记录的id号
	t11=int(rs(1))'下一记录的排序号
	conn.execute("update news set ord="&t11&" where id="&id)
	conn.execute("update news set ord="&t22&" where id="&t2)
	exit do
end if
rs.movenext
loop
response.Redirect "Manage_zp.asp?page="&page
rs.close
set rs=nothing
end sub



'======添加环境===============
sub addhj()
title=request("title")
bigclassid=request("bigclassid")
newstype=request("newstype")
pathfilename=request("d_savepathfilename")
d_savefilename=request("d_savefilename")
d_picture=request("d_picture")
if d_picture="" then d_picture="nopic"
good=request("good")
if good="" then good=0
focus=request("focus")
if focus="" then focus=0
content=request("content")
set rs=conn.execute("Select * From news where bigclassid=4 order by id desc")
if rs.eof then
ord=1
else
ord=rs("id")+1
rs.close
set rs=nothing
end if

set rs=server.CreateObject("adodb.recordset")
sql="Select * From news"
rs.open sql,conn,1,3
rs.addnew
rs("title")=title
rs("smallclassname")=newstype
rs("bigclassid")=bigclassid
rs("d_picture")=d_picture
rs("D_SaveFileName")=d_savefilename
rs("D_SavePathFileName")=pathfilename
rs("good")=good
rs("focus")=focus
rs("content")=content
rs("addtime")=date()
rs("ord")=ord
rs.update

call Confirm("恭喜！发布成功！继续发布请点击确认！","add_hj.asp","Manage_hj.asp")
rs.close
set rs=nothing
end sub
'======修改环境===============
sub modhj()
id=request("id")
page=request("page")
title=request("title")
newstype=request("newstype")
pathfilename=request("d_savepathfilename")
d_savefilename=request("d_savefilename")
d_picture=request("d_picture")
if d_picture="" then d_picture="nopic"
good=request("good")
if good="" then good=0
content=request("content")
set rs=server.CreateObject("adodb.recordset")
sql="Select * From news where id="&id
rs.open sql,conn,1,3
rs("title")=title
rs("smallclassname")=newstype
rs("d_picture")=d_picture
rs("D_SaveFileName")=d_savefilename
rs("D_SavePathFileName")=pathfilename
rs("good")=good
rs("content")=content
rs.update
call mb("恭喜！修改成功！",1,"Manage_hj.asp?nclass="&newstype&"&page="&page&"")
rs.close
set rs=nothing
end sub

'==========推荐环境============
sub hjgood()
id=request("id")
url=request("url")
url2=request("url2")
set rs=server.CreateObject("adodb.recordset")
sql="Select * From news where id="&id
rs.open sql,conn,1,3
good=rs("good")
if rs("good")=true then
	good=0
else
	good=1
end if
conn.execute("update news set good='"&good&"'where id="&id)
response.Redirect""&url2&"?"&url&""
rs.close
set rs=nothing
end sub
'====环境排序 向下===========
sub hj_down()
id=int(request("id"))'当前记录的id号
page=request("page")
nclass=request("nclass")
set rs=conn.execute("Select id,ord From news where bigclassid=4  order by ord desc,id desc")
do while not rs.eof
nid=int(rs(0))
if id=nid then
	t22=int(rs(1))'当前记录的排序号
	rs.movenext
if rs.eof then exit do
	t2=int(rs(0))'下一记录的id号
	t11=int(rs(1))'下一记录的排序号
	conn.execute("update news set ord="&t11&" where id="&id)
	conn.execute("update news set ord="&t22&" where id="&t2)
	exit do
end if
rs.movenext
loop
response.Redirect "Manage_hj.asp?page="&page
rs.close
set rs=nothing
end sub

'====环境排序 向上===========
sub hj_up()
id=int(request("id"))'当前记录的id号
page=request("page")
nclass=request("nclass")
set rs=server.CreateObject("adodb.recordset")
rs.open "Select id,ord From news where bigclassid=4 order by ord desc,id desc",conn,1,3
do while not rs.eof
nid=int(rs(0))

if id=nid then
	t22=int(rs(1))'当前记录的排序号
	rs.MovePrevious
if rs.bof then exit do
	t2=int(rs(0))'下一记录的id号
	t11=int(rs(1))'下一记录的排序号
	conn.execute("update news set ord="&t11&" where id="&id)
	conn.execute("update news set ord="&t22&" where id="&t2)
	exit do
end if
rs.movenext
loop
response.Redirect "Manage_hj.asp?page="&page
rs.close
set rs=nothing
end sub

'======添加专业===============
sub addzhuanye()
title=request("title")

pathfilename=request("d_savepathfilename")
d_savefilename=request("d_savefilename")
d_picture=request("d_picture")
content=request("content")
set rs=server.CreateObject("adodb.recordset")
sql="Select * From zhuanye"
rs.open sql,conn,1,3
rs.addnew
rs("zhuanyename")=title
rs("d_picture")=d_picture
rs("D_SaveFileName")=d_savefilename
rs("D_SavePathFileName")=pathfilename
rs("info")=content
rs("addtime")=now
rs.update
call Confirm("恭喜！发布成功！继续发布请点击确认！","add_zhuanye.asp","Manage_zhuanye.asp")
rs.close
set rs=nothing
end sub

'=======修改专业==========
sub modzhuanye()
id=request("id")
page=request("page")
title=request("title")
pathfilename=request("d_savepathfilename")
d_savefilename=request("d_savefilename")
d_picture=request("d_picture")
content=request("content")
set rs=server.CreateObject("adodb.recordset")
sql="Select * From zhuanye where id="&id
rs.open sql,conn,1,3
rs("zhuanyename")=title
rs("d_picture")=d_picture
rs("D_SaveFileName")=d_savefilename
rs("D_SavePathFileName")=pathfilename
rs("info")=content
rs("addtime")=now
rs.update
call mb("恭喜！修改成功！",1,"Manage_zhuanye.asp?page="&page)
rs.close
set rs=nothing
end sub

'=======联系==========
sub lx()
id=request("id")
page=request("page")
set rs=server.CreateObject("adodb.recordset")
sql="Select * From zxbm where id="&id
rs.open sql,conn,1,3
if rs("lxed")=true then
	tuijian=0
else
	tuijian=1
end if
conn.execute("update zxbm set lxed='"&tuijian&"'where id="&id)
response.Redirect "Manage_bm.asp?page="&page
rs.close
set rs=nothing
end sub






sub addfaq()
title=request("title")
bigclassid=request("bigclassid")
newstype=request("newstype")
good=request("good")
if good="" then good=false
focus=request("focus")
if focus="" then focus=false
content=request("content")

set rs=server.CreateObject("adodb.recordset")
sql="Select * From news"
rs.open sql,conn,1,3
rs.addnew
rs("title")=title
rs("smallclassname")=newstype
rs("bigclassid")=bigclassid
rs("good")=good
rs("focus")=focus
rs("content")=content
rs("addtime")=date()
rs.update
call Confirm("恭喜！发布成功！继续发布请点击确认！","add_faq.asp","Manage_faq.asp")
rs.close
set rs=nothing
end sub
'======修改新闻===============
sub modfaq()
id=request("id")
page=request("page")
title=request("title")
content=request("content")
set rs=server.CreateObject("adodb.recordset")
sql="Select * From news where id="&id
rs.open sql,conn,1,3
rs("title")=title
rs("content")=content
rs.update
call mb("恭喜！修改成功！",1,"Manage_faq.asp?page="&page&"")
rs.close
set rs=nothing
end sub


%>