⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ad.aspx

📁 很好的新闻更新系统
💻 ASPX
字号:
<%@ Page Language="VB" ContentType="text/html" debug="true"%>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<html>
<head>
<title>advertisement</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
</body>
</html>
<script language="VB" runat="server">
Dim sql as String
Dim myConn as OleDbConnection
Dim myCmd as OleDbCommand
function getdatareader(sql as string) as OleDbDataReader
   myCmd=new OleDbCommand(sql,myConn)
   myConn.open()
   getdatareader=myCmd.ExecuteReader()
end Function
function executesql(sql as string)
   myCmd=new OleDbCommand(sql,myConn)
   myConn.open()
   myCmd.ExecuteNonQuery()
   myConn.close()
end Function
Function filterad()
   sql="update ads set act=1 where click>=clicks and class=1"
   executesql(sql)
   sql="update ads set act=1 where show>=shows and class=2"
   executesql(sql)
   sql="update ads set act=1 where riqi>=lasttime and class=3"
   executesql(sql)
   sql="update ads set act=1 where (riqi>=lasttime or click>=clicks) and class=4"
   executesql(sql)
   sql="update ads set act=1 where (show>=shows or riqi>=lasttime) and class=5"
   executesql(sql)
   sql="update ads set act=1 where (click>=clicks or show>=shows or riqi>=lasttime) and class=6"
   executesql(sql) 
End Function
function addshowlist(adsid as integer,showtimes as integer)
   dim ipaddress,isok as string
   ipaddress=request.ServerVariables("REMOTE_ADDR")
   isok="true"
   sql="select top 1 riqi from iplist where adsid="& adsid &" and ipaddress='"& ipaddress &"' and leixing=1 order by riqi desc"
   dim ipreader as oledbdatareader=getdatareader(sql)
   while ipreader.read()
      if ipreader.Item(0)>=(dateadd("h",-2,now())) then
	     isok="false"
	  end if     
   end while
   myConn.close()
   if isok="true" then
   sql="insert into iplist(adsid,ipaddress,riqi,leixing) values("& adsid &",'"& ipaddress &"','"& now() &"',1)"
   executesql(sql)
   showtimes+=1
   sql="UPDATE ads SET show="& showtimes &",riqi='"& now() &"' where id="&adsid
   executesql(sql)
   end if
end function
Sub Page_Load(sender As Object, e As EventArgs)
   Dim strConn As String
   strConn="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&server.MapPath("./")&"data/news.mdb"	    	
   myConn = New OledbConnection(strConn)
   filterad
   dim width,height as integer
   select case page.request("weizhi")
      case "0"
	     width=468
		 height=60
	  case "1"
	     width=360
		 height=300
	  case "2"
	     width=146
		 height=228
   end select
   sql="select top 1 id,sitename,picurl,url,window,show from ads where act=0 and place="& cint(page.request("weizhi")) &" order by riqi"
   dim adsreader as oledbdatareader=getdatareader(sql)
   dim opentype as string
   dim showtimes,adsid as integer
   while adsreader.read()
      adsid=adsreader.Item(0)
      showtimes=adsreader.Item(5)
      if adsreader.Item(4)=0 then
	     opentype="_new"
	  else
	     opentype="_top"
	  end if
      if right(adsreader.Item(2),4)=".swf" then
	     response.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='"& width &"' height='"& height &"'><param name='movie' value='"&adsreader.Item(2)&"'><param name='quality' value='high'><embed src='"&adsreader.Item(2)&"' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='"& width &"' height='"& height &"'></embed></object>")
	  else
	     response.Write("<a href='adsurl.aspx?adid="&adsreader.Item(0)&"' target='"& opentype &"'><img src='"&adsreader.Item(2)&"' alt='"&adsreader.Item(1)&"' border=0 width='"& width &"' heignt='"& height &"'></a>")
	  end if   
   end while
   myConn.close()
   sql="update ads set riqi='"& now() &"' where id="&adsid
   executesql(sql)
   addshowlist(adsid,showtimes)	  
End sub
</script>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -