<!--#include file="../common/conn.asp"-->
<%
'检查用户权限
call checkuser("广告管理")
%>
<%
if request.form("id")="" then
	'添加记录
	Call adAdd
else
	'修改记录
	Call adSave	
end if

%>
<body onLoad="window.parent.opener.parent.main.location=window.parent.opener.parent.main.location;alert('保存完毕!')"></body>
<%
'---------------------------------------------------------------------------
sub adAdd()
		
		'添加记录		
		strSQL="Insert Into web_ad(m_id,a_name,a_content) Values("
		strSQL=strSQL & "" & WebUserID & ","
		strSQL=strSQL & "'" & Replace(request.form("txtTitle"),"'","''") & "',"
		strSQL=strSQL & "'" & Replace(request.form("content"),"'","''") & "')"
		
		conn.execute strSQL,0,1

End sub

'---------------------------------------------------------------------------
sub adSave()

		'保存记录		
		strSQL="Update web_ad Set "
		strSQL=strSQL & "a_name='" & Replace(request.form("txtTitle"),"'","''") & "',"
		strSQL=strSQL & "a_content='" & Replace(request.form("content"),"'","''") & "' "
		
		strSQL=strSQL & " Where id=" & Cint(request.form("id"))
		'response.Write(strSQL)
		conn.execute strSQL,0,1


End sub		
		
%>
