<!--#include file="Inc.asp"-->
<!--#include file="ydzq.asp"-->
<%
call head()
%>

<%
	IF  (Request.QueryString("Action")="view") Then
		call view
	elseIF  (Request.QueryString("Action")="del") Then
		call del
	elseIF  (Request.QueryString("Action")="edit") Then
		call edit
	elseIF  (Request.QueryString("Action")="save") Then
		call save
	elseIF  (Request.QueryString("Action")="add") Then
		call add
	else
		call login
	End IF%>
<%sub login
Call saycarda("点击送币")%>

		<% Set Rs = Server.CreateObject("Adodb.Recordset")
		Sql = "SELECT * FROM gogo where typeID=6"
		Rs.Open Sql,conn,1,1
If Not rs.eof	Then
	Dim PageSize,i
	PageSize=10							
	Dim Count,page,pagecount,gopage,parent			
	gopage="adminads.asp?saytk="&saytk&"&amp;sid="&sid&"&amp;"
	Count=rs.recordcount
	page=int(request.QueryString ("page"))
	if page<=0 or page="" then page=1		
	pagecount=(count+pagesize-1)\pagesize	
        if page>pagecount then page=pagecount	
	rs.move(pagesize*(page-1))				
	For i=1 To PageSize       						
	If rs.eof Then Exit For				
%><%=i+(page-1)*PageSize%>.<a href="adminads.asp?saytk=<%=saytk%>&amp;sid=<%=sid%>&amp;Action=view&amp;id=<%=Rs("id")%>"><%=ubb(Rs("name"))%></a><br/>点击：<%=Rs("tid")%><br/>
<%     
	rs.moveNext								
	Next
	if page-pagecount<0 then response.write "<a href="""&gopage&"page="&page+1&""">下页</a>"
	if page>1 then response.write "<a href="""&gopage&"page="&page-1&""">上页</a>"
	if pagecount>1 then response.write "<br/><b>"&page&"</b>/"&pagecount&"页<input name=""page"" format=""*N"" value="""&page&""" type=""text"" maxlength=""5"" emptyok=""true"" size=""3""/><a href="""&gopage&"page=$(page)"">>></a>"
Else
%>
	(没有广告)

<%end if%><br/>---------<br/>
<a href="todayad.asp?saytk=<%=saytk%>&amp;sid=<%=sid%>">[今日会员点击]</a><br/>
<a href="adminads.asp?saytk=<%=saytk%>&amp;sid=<%=sid%>&amp;Action=add">[添加广告]</a><br/>
<a href="adzero.asp?saytk=<%=saytk%>&amp;sid=<%=sid%>">[点击清零]</a><br/>
                <a href="../admingo.asp?saytk=<%=saytk%>&amp;sid=<%=sid%>">[广告中心]</a><br/>
<a href="../index.asp?saytk=<%=saytk%>&amp;sid=<%=sid%>">[后台管理]</a>
<%end sub%>
<%sub del
id=Request("id")
if not isnumeric(id) then id=""
if id<>"" then
	IF  (Request.QueryString("del")="true") Then
			Set Rs2 = Server.CreateObject("Adodb.Recordset")
			Sql2 = "select * FROM gogo WHERE id=" & id
			Rs2.Open Sql2,conn,1,3
			if not (rs2.eof and rs2.bof) then
			rs2.Delete
			end if
			rs2.Close
			Set rs2 = Nothing
Call saycarda("删除广告")%>
			
			删除广告成功!<br/>
			<a href="adminads.asp?saytk=<%=saytk%>&amp;sid=<%=sid%>">[点击送币]</a><br/>
			<a href="../index.asp?saytk=<%=saytk%>&amp;sid=<%=sid%>">[后台管理]</a><br/>
	<%Else
	Call saycarda("删除广告")%>

		注意：确定要删除该广告吗？<br/>
		<a href="adminads.asp?Action=del&amp;id=<%=id%>&amp;del=true&amp;saytk=<%=saytk%>&amp;sid=<%=sid%>">[删除]</a> <a href="adminads.asp?Action=login&amp;id=<%=id%>&amp;saytk=<%=saytk%>&amp;sid=<%=sid%>">[取消]</a><br/>
		<a href="adminads.asp?saytk=<%=saytk%>&amp;sid=<%=sid%>">[点击送币]</a><br/>
                <a href="../admingo.asp?saytk=<%=saytk%>&amp;sid=<%=sid%>">[广告中心]</a><br/>
			<a href="../index.asp?saytk=<%=saytk%>&amp;sid=<%=sid%>">[后台管理]</a><br/>
	<%End IF

Else
Call saycarda("删除广告")%>

		出错了!<br/>
		<a href="adminads.asp?saytk=<%=saytk%>&amp;sid=<%=sid%>">[点击送币]</a><br/>
                <a href="../admingo.asp?saytk=<%=saytk%>&amp;sid=<%=sid%>">[广告中心]</a><br/>
			<a href="../index.asp?saytk=<%=saytk%>&amp;sid=<%=sid%>">[后台管理]</a><br/>

<%end if

end sub%>

<%sub view
id=Request("id")
if not isnumeric(id) then id=""
if id<>"" then

		Set Rs2 = Server.CreateObject("Adodb.Recordset")
		Sql2 = "select * FROM gogo WHERE id=" & id
		Rs2.Open Sql2,conn,1,1
		if not (rs2.eof and rs2.bof) Then
		Call saycarda("查看广告")
%>

		广告名称:<%=ubb(rs2("name"))%><br/>
                点击次数:<%=rs2("tid")%><br/>
		广告地址:<%=ubb(rs2("url"))%><br/>
		赠送<%=getcent%>:<%=ubb(rs2("cent"))%><br/><br/>
		<a href="adminads.asp?Action=edit&amp;id=<%=Rs2("id")%>&amp;saytk=<%=saytk%>&amp;sid=<%=sid%>">[修改]</a> <a href="adminads.asp?Action=del&amp;id=<%=Rs2("id")%>&amp;saytk=<%=saytk%>&amp;sid=<%=sid%>">[删除]</a><br/>
		<a href="adminads.asp?saytk=<%=saytk%>&amp;sid=<%=sid%>">[点击送币]</a><br/>
                <a href="../admingo.asp?saytk=<%=saytk%>&amp;sid=<%=sid%>">[广告中心]</a><br/>
			<a href="../index.asp?saytk=<%=saytk%>&amp;sid=<%=sid%>">[后台管理]</a><br/>

<%

		end if
		rs2.Close
		Set rs2 = Nothing

Else
Call saycarda("查看广告")
%>

		出错了!<br/>
		<a href="adminads.asp?saytk=<%=saytk%>&amp;sid=<%=sid%>">[点击送币]</a><br/>
                <a href="../admingo.asp?saytk=<%=saytk%>&amp;sid=<%=sid%>">[广告中心]</a><br/>
			<a href="../index.asp?saytk=<%=saytk%>&amp;sid=<%=sid%>">[后台管理]</a><br/>

<%
end if
end sub%>


<%sub add
	if Request.QueryString("add")="true"  then
		Name=Request.form("Name")
		url=Request.form("url")
		cent=Request.form("cent")
        if cent="" or isnumeric(cent)=False then cent=0
		if name<>"" and url<>"" then
			set rs=Server.CreateObject("Adodb.Recordset")
			rs.open "select * from gogo ",conn,1,3
			rs.addnew()	
				rs("Name")=Name
				rs("url")=url
				rs("cent")=cent
			rs("typeID")=6
			rs.update
			rs.close
			set rs=Nothing
			Call saycarda("添加广告")%>

			[添加广告]成功！	<br/>	
			<a href="adminads.asp?saytk=<%=saytk%>&amp;sid=<%=sid%>">[点击送币]</a><br/>
                <a href="../admingo.asp?saytk=<%=saytk%>&amp;sid=<%=sid%>">[广告中心]</a><br/>
			<a href="../index.asp?saytk=<%=saytk%>&amp;sid=<%=sid%>">[后台管理]</a><br/>


		<%Else
		Call saycarda("添加广告")%>

			广告名称或广告地址不能为空!<br/>
			<br/><a href="adminads.asp?Action=add&amp;saytk=<%=saytk%>&amp;sid=<%=sid%>">返回修改</a><br/>
			<a href="adminads.asp?saytk=<%=saytk%>&amp;sid=<%=sid%>">[点击送币]</a><br/>
                <a href="../admingo.asp?saytk=<%=saytk%>&amp;sid=<%=sid%>">[广告中心]</a><br/>
			<a href="../index.asp?saytk=<%=saytk%>&amp;sid=<%=sid%>">[后台管理]</a><br/>
			
			

		<%end if

	Else
		Call saycarda("添加广告")
		if saytk>1 then
		Response.write"<form action=""adminads.asp?Action=add&amp;add=true&amp;saytk="&saytk&"&amp;sid="&sid&""" method=""POST"" name=""form1"">"
		end if%>


		广告名称:<br/>
		<input name="name" emptyok="false" maxlength="50"/><br/>
		广告地址:<br/>
		<input name="url" emptyok="false" maxlength="255"/><br/>
		赠送<%=getcent%>:<br/>
		<input name="cent" emptyok="false" maxlength="255"/><br/>
		<%if saytk>1 then%>
		<input type="submit" name="Submit" value="添加广告"></form><br/>
		<%else%>
		<anchor>[添加广告]
			<go href="adminads.asp?Action=add&amp;add=true&amp;saytk=<%=saytk%>&amp;sid=<%=sid%>" method="post">
				<postfield name="url" value="$(url)" />
				<postfield name="name" value="$(name)" />
				<postfield name="cent" value="$(cent)" />
			</go>
		</anchor><br/>
		<%end if%>
		<a href="adminads.asp?saytk=<%=saytk%>&amp;sid=<%=sid%>">[点击送币]</a><br/>
                <a href="../admingo.asp?saytk=<%=saytk%>&amp;sid=<%=sid%>">[广告中心]</a><br/>
			<a href="../index.asp?saytk=<%=saytk%>&amp;sid=<%=sid%>">[后台管理]</a><br/>

	<%end if

end sub%>

<%sub edit
id=TRim(Request("id"))
if not isnumeric(id) then id=""
if id<>"" then
	if Request.QueryString("add")="true"  then
		Name=Request.form("Name")
		url=Request.form("url")
		cent=Request.form("cent")
        if cent="" or isnumeric(cent)=False then cent=0
		if name<>"" and url<>"" then
			set rs=Server.CreateObject("Adodb.Recordset")
			rs.open "select * from gogo where id= "&id,conn,1,3
				rs("Name")=Name
				rs("url")=url
				rs("cent")=cent
			rs.update
			rs.close
			set rs=Nothing
					Call saycarda("修改广告")%>

			修改广告成功！<br/>
			<a href="adminads.asp?saytk=<%=saytk%>&amp;sid=<%=sid%>">[点击送币]</a><br/>
                <a href="../admingo.asp?saytk=<%=saytk%>&amp;sid=<%=sid%>">[广告中心]</a><br/>
			<a href="../index.asp?saytk=<%=saytk%>&amp;sid=<%=sid%>">[后台管理]</a><br/>

		<%Else
		Call saycarda("修改广告")%>

	
			广告名或广告联接不能为空!<br/>
			<br/><a href="adminads.asp?Action=edit&amp;id=<%=id%>&amp;saytk=<%=saytk%>&amp;sid=<%=sid%>">返回修改</a><br/>
			<a href="adminads.asp?saytk=<%=saytk%>&amp;sid=<%=sid%>">[点击送币]</a><br/>
                <a href="../admingo.asp?saytk=<%=saytk%>&amp;sid=<%=sid%>">[广告中心]</a><br/>
			<a href="../index.asp?saytk=<%=saytk%>&amp;sid=<%=sid%>">[后台管理]</a><br/>

		<%end if
	else
		Set Rs2 = Server.CreateObject("Adodb.Recordset")
		Sql2 = "select * FROM gogo WHERE id=" & id
		Rs2.Open Sql2,conn,1,1
		if not (rs2.eof and rs2.bof) Then
		Call saycarda("修改广告")
		if saytk>1 then
		Response.write"<form action="""&dz&""" method=""POST"" name=""form1"">"
		end if%> 

广告名称:<br/>
		<input name="name<%=tt%>" emptyok="false" maxlength="50" value="<%=ubb(rs2("name"))%>"/><br/>
		广告地址:<br/>
		<input name="url<%=tt%>" emptyok="false" maxlength="255" value="<%=ubb(rs2("url"))%>"/><br/>
		赠送<%=getcent%>:<br/>
		<input name="cent<%=tt%>" emptyok="false" maxlength="255" value="<%=ubb(rs2("cent"))%>"/><br/>
		<%if saytk>1 then%>
		<input type="submit" name="Submit" value="修改广告"></form><br/>
		<%else%>
		<anchor>修改广告
			<go href="adminads.asp?Action=edit&amp;add=true&amp;id=<%=id%>&amp;saytk=<%=saytk%>&amp;sid=<%=sid%>" method="post">
				<postfield name="url" value="$(url<%=tt%>)" />
				<postfield name="name" value="$(name<%=tt%>)" />
				<postfield name="cent" value="$(cent<%=tt%>)" />
			</go>
		</anchor><br/>
		<%end if%>
		<a href="adminads.asp?saytk=<%=saytk%>&amp;sid=<%=sid%>">[点击送币]</a><br/>
                <a href="../admingo.asp?saytk=<%=saytk%>&amp;sid=<%=sid%>">[广告中心]</a><br/>
			<a href="../index.asp?saytk=<%=saytk%>&amp;sid=<%=sid%>">[后台管理]</a><br/>

	<%
		end if
		rs2.Close
		Set rs2 = Nothing
	end if
Else
Call saycarda("查看广告")
%>

		出错了<br/>
		<a href="adminads.asp?saytk=<%=saytk%>&amp;sid=<%=sid%>">[点击送币]</a><br/>
                <a href="../admingo.asp?saytk=<%=saytk%>&amp;sid=<%=sid%>">[广告中心]</a><br/>
		<a href="../index.asp?saytk=<%=saytk%>&amp;sid=<%=sid%>">[后台管理]</a><br/>

<%
end if
end Sub
Call headsay()%>
