<!--#include file="../../conn/conn.asp"-->
<!--#include file="../../conn/nosql.asp"-->
<!--#include file="../../conn/config.asp"-->
<!--#include file="../../conn/md5.asp"-->
 <%if Not ChkPosturl then response.redirect ("/login.asp")
if session("user")="" then
response.write "<script language='javascript'>"
response.write "alert('您没还有登录，请登录后再访问本页！');"
response.write"this.location.href='/index.asp';</SCRIPT>"
response.end
end if
if session("id")="" then 
response.write "<script language='javascript'>"
response.write "alert('您没还有登录，请登录后再访问本页！');"
response.write"this.location.href='/index.asp';</SCRIPT>"
response.end
end if
if session("uflag")<>3 then 
response.write "<script language='javascript'>"
response.write "alert('您还不是诚信会员，没有个人主页功能，相关情况请联系管理员！');"
response.write"this.location.href='/index.asp';</SCRIPT>"
response.end
end if
userid=session("id")
sql="select * from snsn_user where username='"&session("user")&"' and id="&session("id")&""
Set rs= Server.CreateObject("ADODB.Recordset") 
rs.open sql,conn,1,1
if rs("uflag")<>3 then
response.write "<script language='javascript'>"
response.write "alert('您还不是诚信会员，没有个人主页功能，相关情况请联系管理员！');"
response.write"this.location.href='/index.asp';</SCRIPT>"
response.end
else
dim id,px,xdname,xs,i
if request("action")="update" then
    for i=1 to request.form("id").count
	id=replace(request.form("id")(i),"'","")
	px=replace(request.form("px")(i),"'","")
	xs=replace(request.form("xs")(i),"'","")
	xdname=replace(request.form("xdname")(i),"'","")
	if replace(request.form("px")(i),"'","")="" then
%>
<script language=javascript>
history.back()
alert("请填写显示排序！")
</script>
<%
		Response.End
	end if
	conn.execute("update snsn_xd_class set px="&nosql(px)&",xdname='"&nosql(xdname)&"',xs="&nosql(xs)&" where userid="&userid&" and id="&nosql(id))

    next
conn.close
set conn=nothing
response.write "<p align=center><font color=red>设置成功!<br>2秒钟后返回上页!</font>"
response.write "<meta http-equiv=""refresh"" content=""2;url=xd.asp"">"
end if


if request("action")="add" then
	xs=nosql(request.form("xs"))
	xdname=nosql(trim(request("xdname")))
	px=nosql(request.form("px"))
	If xdname="" Then
		response.write "分类名称不能为空！请<a href=javascript:history.go(-1)>返回重新填写</a>！"
		response.end
	end if
	If px="" Then
		response.write "排序不能为空！请<a href=javascript:history.go(-1)>返回重新填写</a>！"
		response.end
	end if
Set rs = Server.CreateObject("ADODB.Recordset")
rs.open "select * From snsn_xd_class",conn,1,3
rs.addnew
rs("xs")=xs
rs("xdname")=xdname
rs("px")=px
rs("userid")=userid
rs.update
rs.close
set rs=nothing

conn.close
set conn=nothing
response.write "<p align=center><font color=red>分类添加成功!<br>2秒钟后返回上页!</font>"
response.write "<meta http-equiv=""refresh"" content=""2;url=xd.asp"">"
end if
if request("action")="del" then
if isChkInteger(request("id")) then
id=request("id")
else
response.write "<script language='javascript'>"
response.write "alert('非法操作，正在返回！');"
response.write"this.location.href='/index.asp';</SCRIPT>"
response.end
end if
set rs=server.createobject("adodb.recordset")
sql="delete from [snsn_xd_class] where userid="&userid&" and id = "&id
conn.execute sql
response.write "<p align=center><font color=red>删除成功!<br>2秒钟后返回上页!</font>"
response.write "<meta http-equiv=""refresh"" content=""2;url=xd.asp"">"
end if
end if
%>