<!--#include file="../../../inc/cms_admin.asp" -->
<%
dim sql,act,result,table,col,colval,id,idval,filepath,LID,LIDs,L_type
dim title,ltype,list_TP,Content_TP,list_FD,Content_FD,list_Name,Content_Name,order,url,pic,cid
act=getform("act","both")
LID=zset.lid
Ltype=getform("Ltype","both")
id=isnum(getForm("id","both"))
col=getform("col","both")
colval=request.form("colval")
title=getform("title","both")
order=getform("order","both")
url=isUrl(getform("url","both"))
pic=getform("pic","both")
cID=isnum(getForm("cID","both"))

if act="editdata" then
  sql="update [dbpre]Links set L_Name='"&title&"', L_type='"&ltype&"',L_url='"&url&"',L_pic='"&pic&"',L_cid="&cid&",L_order="&order&"  where LID="&id&""
  dbconn sql
elseif act="addnew" then
sql="insert into [dbpre]Links(L_Name,L_type,L_url,L_pic,L_cid,L_order,L_OnOff)values('"&title&"','"&Ltype&"','"&url&"','"&pic&"',"&cid&","&order&",1)"
dbconn sql
elseif act="setlinks" then
dbconn("update  [dbpre]Links set "&col&"="&colval&"  where LID="&id&"")
elseif act="del" then
sql="delete from [dbpre]Links  where  LID in ("&id&")"
dbconn sql
aspgo sitepath&adminpath&"/cms_content/Links/Links_List.asp?ltype='"&ltype&"'"
elseif act="saveid" then
	saveid()
end if

Sub saveid
	dim colid		:	colid=getForm("colid","both")
	dim colname		:	colname=getForm("colname","both")
	dim colval		:	colval=getForm("colval","both")
	dim sql1 		:	sql1="update [dbpre]Links Set "&colname&"='"&colval&"' Where LID="&colid
	dim sql2 		:	sql2="update [dbpre]Links Set "&colname&"="&colval&" Where LID="&colid	
	dbconn(sql1)	:	if err then dbconn(sql2)
End Sub
%>