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

📄 adsadd.aspx

📁 很好的新闻更新系统
💻 ASPX
字号:
<%@ Page Language="VB" ContentType="text/html"%>
<%@ Import Namespace="System.Data"%>
<%@ Import Namespace="System.Data.OleDb"%>
<%@ Register TagPrefix="mynews" TagName="main" src="ascx/main.ascx"%>
<%@ Register TagPrefix="mynews" TagName="end" src="ascx/end.ascx"%>
<html>
<head>
<title>广告添加</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
body  {font-family: "宋体";font-size:9pt;background-color:#ffffff;margin-left:0pt;margin-top:0pt}
td,input,select {font-family:宋体;font-size:9pt; color:#000000}

.p9   {font-size: 9pt}
.p9t   {line-height:18px}
.p9y  {color:#ffffd0}
.p9w  {color:#ffffff}
.p9r  {color:#ff0000}

A:link,A:active,A:visited {text-decoration: none; color: #000080}
A:hover {text-decoration: underline; color:#b40000}
A.r:link,A.r:active,A.r:visited{text-decoration: none; color: #ff0000}
A.r:hover {text-decoration: underline; color:#ff0000}
A.w:link,A.w:active,A.w:visited {text-decoration: none; color: #ffffff}
A.w:hover {text-decoration: underline; color:#ffffff}
A.b:link,A.b:active,A.b:visited {text-decoration: none; color: #808080}
A.b:hover {text-decoration: underline; color:#000000}
</style>
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><mynews:main runat="server"/></td>
  </tr>
  <tr>
    <td align="center">添加新的广告</td>
  </tr>
  <tr>
    <td><form id="addads" runat="server">
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="10%">站点名称</td>
            <td width="90%"><asp:textbox ID="sitename" MaxLength="50" Columns="50" runat="server"/></td>
          </tr>
          <tr>
            <td>站点URL</td>
            <td><asp:textbox ID="siteurl" MaxLength="80" Columns="80" Text="http://" runat="server"/></td>
          </tr>
          <tr>
            <td>图标URL</td>
            <td><asp:textbox ID="picurl" MaxLength="80" Columns="80" Text="http://" runat="server"/></td>
          </tr>
          <tr>
            <td>图标摆放位置</td>
            <td><asp:dropdownlist ID="place" runat="server">
			<asp:listitem Value="0">首页黄金位置</asp:listitem>
			<asp:listitem Value="1">页面内容位置</asp:listitem>
			<asp:listitem Value="2">二三级页面位置</asp:listitem>
			</asp:dropdownlist></td>
          </tr>
          <tr>
            <td>打开方式</td>
            <td><asp:dropdownlist ID="opentype" runat="server">
			<asp:listitem Value="0">新窗口</asp:listitem>
			<asp:listitem Value="1">原窗口</asp:listitem>
			</asp:dropdownlist></td>
          </tr>
          <tr bgcolor="#c0d0e0">
            <td>广告播放条件</td>
            <td>&nbsp;&nbsp;受多个条件限制的广告,只要有一个条件满足,该广告便自动进入休眠状态,你可以修改限制条件并激活广告。</td>
          </tr>
          <tr>
            <td height="64">&nbsp;</td>
            <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
                  <tr> 
                    <td width="4%"></td>
                    <td width="96%"><asp:radiobuttonlist ID="xianzhi" runat="server">
<asp:listitem Value="0" selected>无限制</asp:listitem>
<asp:listitem Value="1">限制点击次数</asp:listitem>
<asp:listitem Value="2">限制显示次数</asp:listitem>
<asp:listitem Value="3">限制截止时间</asp:listitem>
<asp:listitem Value="4">限制点击数和截止时间</asp:listitem>
<asp:listitem Value="5">限制显示次数和截止时间</asp:listitem>
<asp:listitem Value="6">限制点击次数、显示次数和截止时间</asp:listitem>
</asp:radiobuttonlist></td>
                  </tr>
                  <tr> 
                    <td></td>
                    <td>点击数不超过
                      <asp:textbox ID="click" MaxLength="10" Columns="10" runat="server"/></td>
                  </tr>
                  <tr> 
                    <td></td>
                    <td>显示数不超过
                      <asp:textbox ID="show" MaxLength="10" Columns="10" runat="server"/></td>
                  </tr>
                  <tr> 
                    <td></td>
                    <td>显示截止期为
                      <asp:textbox ID="enddate" MaxLength="20" Columns="20" runat="server"/> 
                      <font color=#FF0000>格式为yyyy-mm-dd hh:mm:ss或者yyyy-mm-dd</font></td>
                  </tr>
              </table></td>
          </tr>
        </table>
		<tr>
    <td align="center"><asp:button ID="add" Text="添加" OnClick="addclick" runat="server"/><asp:button ID="cancel" Text="取消" OnClick="cancelclick" runat="server"/></td>
  </tr>
      </form></td>
  </tr>
  <tr>
    <td align="center"><asp:label ID="message" runat="server"/></td>
  </tr> 
  <tr>
    <td><mynews:end runat="server"/></td>
  </tr>
</table>
</body>
</html>
<script language="VB" runat="server">
Dim sql,result as string
Dim myConn as OleDbConnection
Dim myCmd as OleDbCommand

function executesql(sql as string)
   myCmd=new OleDbCommand(sql,myConn)
   myConn.open()
   myCmd.ExecuteNonQuery()
   myConn.close()
end function
function isok(xuanze as string)
   message.text=""
   result="true"
   if sitename.text="" then
      result="false"
      message.text="站点名称为必填项目!<br>"
   end if
   if siteurl.text="http://" then
      result="false"
	  message.text+="站点url为必填项目!<br>"
   end if
   if picurl.text="http://" then
      result="false"
	  message.text+="图片url为必填项目!<br>"
   end if
   select case xuanze
      case "1" 
	     if click.text="" then
		    result="false"
			message.text+="限制条件不完整!"
		 end if
	  case "2" 
	     if show.text="" then
		    result="false"
			message.text+="限制条件不完整!"
		 end if
	  case "3" 
	     if enddate.text="" then
		    result="false"
			message.text+="限制条件不完整!"
		 end if
	  case "4"
	     if click.text="" or enddate.text="" then
		    result="false"
			message.text="限制条件不完整!"
		 end if
	  case "5" 
	     if show.text="" or enddate.text="" then
		    result="false"
			message.text="限制条件不完整!"
		 end if
	  case "6" 
	     if click.text="" or show.text="" or enddate.text="" then
		    result="false"
			message.text="限制条件不完整!"
		 end if	  
   end select
   return result
end function
function makesql()
   select case xianzhi.SelectedItem.value
      case "0"
	     sql="insert into ads(sitename,picurl,url,class,place,window,regtime) values('"& sitename.text &"','" & picurl.text &"','"& siteurl.text &"',"& xianzhi.SelectedItem.value &","& place.SelectedItem.value &","& opentype.SelectedItem.value &",'"& now() &"')"
	  case "1"
	     sql="insert into ads(sitename,picurl,url,class,place,window,clicks,regtime) values('"& sitename.text &"','" & picurl.text &"','"& siteurl.text &"',"& xianzhi.SelectedItem.value &","& place.SelectedItem.value &","& opentype.SelectedItem.value &","& cint(click.text) &",'"& now() &"')"
	  case "2"
	     sql="insert into ads(sitename,picurl,url,class,place,window,shows,regtime) values('"& sitename.text &"','" & picurl.text &"','"& siteurl.text &"',"& xianzhi.SelectedItem.value &","& place.SelectedItem.value &","& opentype.SelectedItem.value &","& cint(show.text) &",'"& now() &"')"
	  case "3"
	     sql="insert into ads(sitename,picurl,url,class,place,window,lasttime,regtime) values('"& sitename.text &"','" & picurl.text &"','"& siteurl.text &"',"& xianzhi.SelectedItem.value &","& place.SelectedItem.value &","& opentype.SelectedItem.value &","& enddate.text &",'"& now() &"')"
	  case "4"
	     sql="insert into ads(sitename,picurl,url,class,place,window,clicks,lasttime,regtime) values('"& sitename.text &"','" & picurl.text &"','"& siteurl.text &"',"& xianzhi.SelectedItem.value &","& place.SelectedItem.value &","& opentype.SelectedItem.value &","& cint(click.text) &",'"& enddate.text &"','"& now() &"')"
		 message.text=sql
	  case "5"
	     sql="insert into ads(sitename,picurl,url,class,place,window,shows,lasttime,regtime) values('"& sitename.text &"','" & picurl.text &"','"& siteurl.text &"',"& xianzhi.SelectedItem.value &","& place.SelectedItem.value &","& opentype.SelectedItem.value &","& cint(show.text) &",'"& enddate.text &"','"& now() &"')"
	  case "6"
	     sql="insert into ads(sitename,picurl,url,class,place,window,clicks,shows,lasttime,regtime) values('"& sitename.text &"','" & picurl.text &"','"& siteurl.text &"',"& xianzhi.SelectedItem.value &","& place.SelectedItem.value &","& opentype.SelectedItem.value &","& cint(click.text) &","& cint(show.text) &",'"& enddate.text &"','"& now() &"')"
   end select 
   return sql  
end function

Sub Page_Load(sender As Object, e As EventArgs)
if session("user")="administrator" then
Dim strConn as string
strConn="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&server.MapPath("./")&"data/news.mdb"
myConn=new OleDbConnection(strConn)
if not page.ispostback then
   
end if
else
  response.redirect("login.aspx")
end if
end sub
sub addclick(sender as Object,e as EventArgs)
   isok(xianzhi.SelectedItem.Value)
   if result="true" then
	  makesql
	  executesql(sql)
	  message.text="广告添加成功!"
	  response.Redirect("adsmanager.aspx")
   end if 
end sub
sub cancelclick(sender as Object,e as eventArgs)
   sitename.text=""
   siteurl.text="http://"
   picurl.text="http://"
   click.text=""
   show.text=""
   enddate.text=""
   message.text=""
end sub
</script>

⌨️ 快捷键说明

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