nc_adcolumncls.asp
来自「多用户管理分权限发布、管理软件信息; 自由选择系统默认为静态HTML或动态A」· ASP 代码 · 共 930 行 · 第 1/3 页
ASP
930 行
If Len(Request.Form("topmargin1")) <> 0 Then Rs("topmargin1") = Request.Form("topmargin1")
If Len(Request.Form("sidemargin1")) <> 0 Then Rs("sidemargin1") = Request.Form("sidemargin1")
If Len(Request.Form("topmargin2")) <> 0 Then Rs("topmargin2") = Request.Form("topmargin2")
If Len(Request.Form("sidemargin2")) <> 0 Then Rs("sidemargin2") = Request.Form("sidemargin2")
Rs("AdsType") = Request.Form("AdsType")
Rs("ColumnID") = Request.Form("ColumnID")
Rs("AdsHits") = 0
Rs("AdsTime") = Now
Rs("LinkType") = Request.Form("LinkType")
Rs("isLock") = 0
Rs.Update
Rs.Close
Set Rs = Nothing
NC_Admin.Succeed_Msg ("<li>添加广告 " & Request.Form("HomeName") & " 成功!</li>")
Response.Write "<meta http-equiv=""refresh"" content=""3;url='admin_adcolumn.asp'"">" & vbCrLf
End If
End Sub
Private Sub savemodify()
If Len(Request.Form("HomeName")) = 0 Then
Founderr = True
ErrMsg = ErrMsg + "<li>网站名称不能为空!</li>"
Exit Sub
End If
If Len(Request.Form("Remark")) = 0 Then
Founderr = True
ErrMsg = ErrMsg + "<li>网站简介或广告代码!</li>"
Exit Sub
End If
If Founderr = False Then
Set Rs = CreateObject("ADODB.Recordset")
SQL = "select * from NC_AdColumn where id=" & Request.Form("id")
Rs.Open SQL, Conn, 1, 3
Rs("HomeName") = Newasp.HTMLEncodes(Request.Form("HomeName"))
Rs("Remark") = Request.Form("Remark")
If Trim(Request.Form("LinkUrl")) <> "" Then Rs("LinkUrl") = Request.Form("LinkUrl")
If Trim(Request.Form("image1")) <> "" Then Rs("ImageUrl") = Request.Form("image1")
If Trim(Request.Form("Height")) <> "" Then Rs("Height") = Request.Form("Height")
If Trim(Request.Form("Width")) <> "" Then Rs("Width") = Request.Form("Width")
If Len(Request.Form("topmargin")) <> 0 Then Rs("topmargin") = Request.Form("topmargin")
If Len(Request.Form("sidemargin")) <> 0 Then Rs("sidemargin") = Request.Form("sidemargin")
If Len(Request.Form("topmargin1")) <> 0 Then Rs("topmargin1") = Request.Form("topmargin1")
If Len(Request.Form("sidemargin1")) <> 0 Then Rs("sidemargin1") = Request.Form("sidemargin1")
If Len(Request.Form("topmargin2")) <> 0 Then Rs("topmargin2") = Request.Form("topmargin2")
If Len(Request.Form("sidemargin2")) <> 0 Then Rs("sidemargin2") = Request.Form("sidemargin2")
Rs("AdsType") = Request.Form("AdsType")
Rs("ColumnID") = Request.Form("ColumnID")
Rs("AdsHits") = 0
If Request.Form("UpdateTime") = "yes" Then Rs("AdsTime") = Now
Rs("LinkType") = Request.Form("LinkType")
Rs("isLock") = 0
Rs.Update
Rs.Close
Set Rs = Nothing
NC_Admin.Succeed_Msg ("<li>添加广告 " & Request.Form("HomeName") & " 成功!</li>")
Response.Write "<meta http-equiv=""refresh"" content=""3;url='admin_adcolumn.asp'"">" & vbCrLf
End If
End Sub
Private Sub DelAds()
Newasp.Execute ("delete from NC_AdColumn where id in (" & Request.Form("seladsid") & ")")
DelAdsImage (Request.Form("seladsid"))
Response.redirect (Request.ServerVariables("HTTP_REFERER"))
Err.Raise -19691969
End Sub
Private Sub DelAllAds()
Newasp.Execute ("delete from NC_AdColumn")
Response.redirect (Request.ServerVariables("HTTP_REFERER"))
Err.Raise -19691969
End Sub
Private Sub isLockAds()
Newasp.Execute ("update NC_AdColumn set isLock = 1 where id in (" & Request.Form("seladsid") & ")")
Response.redirect (Request.ServerVariables("HTTP_REFERER"))
Err.Raise -19691969
End Sub
Private Sub UnlockAds()
Newasp.Execute ("update NC_AdColumn set isLock = 0 where id in (" & Request.Form("seladsid") & ")")
Response.redirect (Request.ServerVariables("HTTP_REFERER"))
Err.Raise -19691969
End Sub
Private Sub BatchMove()
Newasp.Execute ("update NC_AdColumn set ColumnID = " & Request.Form("ColumnID") & " where id in (" & Request.Form("seladsid") & ")")
Response.redirect (Request.ServerVariables("HTTP_REFERER"))
Err.Raise -19691969
End Sub
Private Sub indateAds()
Newasp.Execute ("update NC_AdColumn set AdsTime = " & Newasp.SqlString & " where id in (" & Request.Form("seladsid") & ")")
Response.redirect (Request.ServerVariables("HTTP_REFERER"))
Err.Raise -19691969
End Sub
Private Sub showpage()
Dim FileName
Dim n
Dim ii
FileName = "admin_adcolumn.asp"
If totalnumber Mod maxperpage = 0 Then
n = totalnumber \ maxperpage
Else
n = totalnumber \ maxperpage + 1
End If
Response.Write "<table cellspacing=1 width='100%' border=0><form method=Post action=" & FileName & "><tr><td align=center> " & vbCrLf
If CurrentPage < 2 Then
Response.Write "共有广告 <font COLOR=#FF0000><B>" & totalnumber & "</B></font> 首 页 上一页 "
Else
Response.Write "共有广告 <font COLOR=#FF0000><B>" & totalnumber & "</B></font> <a href=" & FileName & "?page=1>首 页</a> "
Response.Write "<a href=" & FileName & "?page=" & CurrentPage - 1 & ">上一页</a> "
End If
If n - CurrentPage < 1 Then
Response.Write "下一页 尾 页 " & vbCrLf
Else
Response.Write "<a href=" & FileName & "?page=" & (CurrentPage + 1) & ">下一页</a>"
Response.Write " <a href=" & FileName & "?page=" & n & ">尾 页</a>" & vbCrLf
End If
Response.Write " 页次:<strong><font color=red>" & CurrentPage & "</font>/" & n & "</strong>页 "
Response.Write " 转到:"
Response.Write " <select name='page' size='1' style=""font-size: 9pt"" onChange='javascript:submit()'>" & vbCrLf
For ii = 1 To n
Response.Write "<option value='" & ii & "' "
If CurrentPage = Int(ii) Then
Response.Write "selected "
End If
Response.Write ">第" & ii & "页</option>"
Next
Response.Write " </select> " & vbCrLf
Response.Write "</td></tr></FORM></table>" & vbCrLf
End Sub
Private Function DelAdsImage(FileID)
Dim FSO
Dim FilePath
Dim Rs_Obj
If Not Newasp.IsObjectFSO(Newasp.Script_FSO) Then Exit Function
Set FSO = Server.CreateObject(Newasp.Script_FSO)
Set Rs_Obj = CreateObject("adodb.recordset")
SQL = "select id,ImageUrl from NC_Adcolumn where id in (" & FileID & ")"
Rs_Obj.Open SQL, Conn, 1, 1
Do While Not Rs_Obj.EOF
FilePath = Rs_Obj(1)
FilePath = Replace(FilePath, "http:/", "")
If FSO.FileExists(Server.MapPath(FilePath)) Then
FSO.DeleteFile Server.MapPath(FilePath), True
End If
Rs_Obj.movenext
Loop
Rs_Obj.Close
Set Rs_Obj = Nothing
Set FSO = Nothing
End Function
'*************************************************************
'函数作用:Banner广告
'*************************************************************
Public Function BannerAds(ColumnID)
Dim SQL, Rs_Ad, HtmlString
Set Rs_Ad = CreateObject("adodb.recordset")
SQL = "select Top 1 * from NC_Adcolumn where AdsType = 1 And isLock = 0 And ColumnID in (0, " & ColumnID & ") order by AdsTime desc, id desc"
Rs_Ad.Open SQL, Conn, 1, 1
If Rs_Ad.bof And Rs_Ad.EOF Then
HtmlString = "<A HREF='http://www.newasp.net/' target=_blank><img src='" & Newasp.SetupDir & "images/Banner.gif' border=0 width='468' height='60'></A>"
Else
If Rs_Ad("LinkType") = 0 Then
HtmlString = "<A HREF='" & Rs_Ad("LinkUrl") & "' target=_blank Title='" & Rs_Ad("Remark") & "'><img src='" & Rs_Ad("ImageUrl") & "' border=0 width='" & Rs_Ad("Width") & "' height='" & Rs_Ad("Height") & "'></A>"
ElseIf Rs_Ad("LinkType") = 1 Then
HtmlString = " <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='" & Rs_Ad("Width") & "' height='" & Rs_Ad("Height") & "'>" & vbCrLf
HtmlString = HtmlString & " <param name='movie' value='" & Rs_Ad("ImageUrl") & "'>" & vbCrLf
HtmlString = HtmlString & " <param name='quality' value='high'>" & vbCrLf
HtmlString = HtmlString & " <embed src='" & Rs_Ad("ImageUrl") & "' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='" & Rs_Ad("Width") & "' height='" & Rs_Ad("Height") & "'></embed>" & vbCrLf
HtmlString = HtmlString & " </object>" & vbCrLf
Else
HtmlString = Rs_Ad("Remark")
End If
End If
Rs_Ad.Close
Set Rs_Ad = Nothing
BannerAds = HtmlString
End Function
'*************************************************************
'函数作用:栏目广告
'*************************************************************
Public Function AdsColumn(ColumnID, TypeID)
Dim SQL, Rs_Ad, HtmlString
Set Rs_Ad = CreateObject("adodb.recordset")
SQL = "select Top 12 * from NC_Adcolumn where AdsType = " & TypeID & " And isLock = 0 And ColumnID in (0, " & ColumnID & ") order by AdsTime desc, id desc"
Rs_Ad.Open SQL, Conn, 1, 1
If Rs_Ad.bof And Rs_Ad.EOF Then
HtmlString = ""
Else
Do While Not Rs_Ad.EOF
If Rs_Ad("LinkType") = 0 Then
HtmlString = HtmlString & "<A HREF='" & Rs_Ad("LinkUrl") & "' target=_blank Title='" & Rs_Ad("Remark") & "'><img src='" & Rs_Ad("ImageUrl") & "' border=0 width='" & Rs_Ad("Width") & "' height='" & Rs_Ad("Height") & "'></A>" & vbCrLf & Chr(9)
ElseIf Rs_Ad("LinkType") = 1 Then
HtmlString = HtmlString & " <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='" & Rs_Ad("Width") & "' height='" & Rs_Ad("Height") & "'>" & vbCrLf
HtmlString = HtmlString & " <param name='movie' value='" & Rs_Ad("ImageUrl") & "'>" & vbCrLf
HtmlString = HtmlString & " <param name='quality' value='high'>" & vbCrLf
HtmlString = HtmlString & " <embed src='" & Rs_Ad("ImageUrl") & "' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='" & Rs_Ad("Width") & "' height='" & Rs_Ad("Height") & "'></embed>" & vbCrLf
HtmlString = HtmlString & " </object>" & vbCrLf & Chr(9)
Else
HtmlString = HtmlString & Rs_Ad("Remark") & vbCrLf & Chr(9)
End If
Rs_Ad.movenext
Loop
End If
Rs_Ad.Close
Set Rs_Ad = Nothing
AdsColumn = HtmlString
End Function
'*************************************************************
'函数作用:固定广告
'*************************************************************
Public Function ScriptFixedAds(ColumnID)
Dim SQL, Rs_Ad, HtmlString, ScriptString, strMargin
Set Rs_Ad = CreateObject("adodb.recordset")
SQL = "select Top 12 * from NC_Adcolumn where AdsType in (5,6) And isLock = 0 And ColumnID in (0, " & ColumnID & ") order by AdsTime desc, id desc"
Rs_Ad.Open SQL, Conn, 1, 1
If Rs_Ad.bof And Rs_Ad.EOF Then
ScriptFixedAds = ""
Else
Do While Not Rs_Ad.EOF
If Rs_Ad("AdsType") = 6 Then strMargin = "style='right:" & Rs_Ad("sidemargin2") & "px;POSITION:absolute;TOP:" & Rs_Ad("topmargin2") & "px;'"
If Rs_Ad("AdsType") = 5 Then strMargin = "style='left:" & Rs_Ad("sidemargin1") & "px;POSITION:absolute;TOP:" & Rs_Ad("topmargin1") & "px;'"
If Rs_Ad("LinkType") = 0 Then
HtmlString = HtmlString & "suspendcode" & Rs_Ad("id") & "=""<DIV id=lovexin" & Rs_Ad("id") & " " & strMargin & "><A HREF='" & Rs_Ad("LinkUrl") & "' target=_blank Title='" & Rs_Ad("Remark") & "'><img src='" & Rs_Ad("ImageUrl") & "' border=0 width='" & Rs_Ad("Width") & "' height='" & Rs_Ad("Height") & "'></A></div>""" & vbCrLf
HtmlString = HtmlString & "document.write(suspendcode" & Rs_Ad("id") & "); " & vbCrLf
ScriptString = ScriptString & "document.all.lovexin" & Rs_Ad("id") & ".style.pixelTop+=percent;" & vbCrLf
ElseIf Rs_Ad("LinkType") = 1 Then
HtmlString = HtmlString & " suspendcode" & Rs_Ad("id") & "=""<DIV id=lovexin" & Rs_Ad("id") & " " & strMargin & "><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='" & Rs_Ad("Width") & "' height='" & Rs_Ad("Height") & "'>"
HtmlString = HtmlString & "<param name='movie' value='" & Rs_Ad("ImageUrl") & "'>"
HtmlString = HtmlString & "<param name='quality' value='high'>"
HtmlString = HtmlString & "<embed src='" & Rs_Ad("ImageUrl") & "' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='" & Rs_Ad("Width") & "' height='" & Rs_Ad("Height") & "'></embed>"
HtmlString = HtmlString & "</object></div>""" & vbCrLf
HtmlString = HtmlString & "document.write(suspendcode" & Rs_Ad("id") & "); " & vbCrLf
ScriptString = ScriptString & "document.all.lovexin" & Rs_Ad("id") & ".style.pixelTop+=percent;" & vbCrLf
Else
HtmlString = HtmlString & "suspendcode" & Rs_Ad("id") & "=""<DIV id=lovexin" & Rs_Ad("id") & " " & strMargin & "><table border=0 width='" & Rs_Ad("Width") & "' height='" & Rs_Ad("Height") & "'><tr><td class=AdsBorder>" & Rs_Ad("Remark") & "</td></tr></table></div>""" & vbCrLf
HtmlString = HtmlString & "document.write(suspendcode" & Rs_Ad("id") & "); " & vbCrLf
ScriptString = ScriptString & "document.all.lovexin" & Rs_Ad("id") & ".style.pixelTop+=percent;" & vbCrLf
End If
Rs_Ad.movenext
Loop
ScriptFixedAds = "<script language=""JavaScript"">" & vbCrLf
ScriptFixedAds = ScriptFixedAds & "lastScrollY=0;" & vbCrLf
ScriptFixedAds = ScriptFixedAds & "function heartBeat(){ " & vbCrLf
ScriptFixedAds = ScriptFixedAds & "diffY=document.body.scrollTop; " & vbCrLf
ScriptFixedAds = ScriptFixedAds & "percent=.1*(diffY-lastScrollY); " & vbCrLf
ScriptFixedAds = ScriptFixedAds & "if(percent>0)percent=Math.ceil(percent); " & vbCrLf
ScriptFixedAds = ScriptFixedAds & "else percent=Math.floor(percent); " & vbCrLf
ScriptFixedAds = ScriptFixedAds & ScriptString
ScriptFixedAds = ScriptFixedAds & "lastScrollY=lastScrollY+percent; " & vbCrLf
ScriptFixedAds = ScriptFixedAds & "} " & vbCrLf
ScriptFixedAds = ScriptFixedAds & HtmlString
ScriptFixedAds = ScriptFixedAds & "window.setInterval(""heartBeat()"",1); " & vbCrLf
ScriptFixedAds = ScriptFixedAds & "</script>" & vbCrLf
End If
Rs_Ad.Close
Set Rs_Ad = Nothing
End Function
'*************************************************************
'函数作用:漂浮广告
'*************************************************************
Public Function ScriptFloatAds(ColumnID)
Dim SQL, Rs_Ad, HtmlString
Set Rs_Ad = CreateObject("adodb.recordset")
SQL = "select Top 1 * from NC_Adcolumn where AdsType = 4 And isLock = 0 And ColumnID in (0, " & ColumnID & ") order by AdsTime desc, id desc"
Rs_Ad.Open SQL, Conn, 1, 1
If Rs_Ad.bof And Rs_Ad.EOF Then
HtmlString = ""
Else
HtmlString = HtmlString & "<SCRIPT LANGUAGE=JavaScript src=" & Newasp.SetupDir & "js/floatads.js></SCRIPT>" & vbCrLf
If Rs_Ad("LinkType") = 0 Then
HtmlString = HtmlString & "<div id='yuxingtome' style='position:absolute;'><A HREF='" & Rs_Ad("LinkUrl") & "' target=_blank Title='" & Rs_Ad("Remark") & "'><img src='" & Rs_Ad("ImageUrl") & "' border=0 width='" & Rs_Ad("Width") & "' height='" & Rs_Ad("Height") & "'></A></div>" & vbCrLf
ElseIf Rs_Ad("LinkType") = 1 Then
HtmlString = HtmlString & "<div id='yuxingtome' style='position:absolute;'><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='" & Rs_Ad("Width") & "' height='" & Rs_Ad("Height") & "'>"
HtmlString = HtmlString & "<param name='movie' value='" & Rs_Ad("ImageUrl") & "'>"
HtmlString = HtmlString & "<param name='quality' value='high'>"
HtmlString = HtmlString & "<embed src='" & Rs_Ad("ImageUrl") & "' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='" & Rs_Ad("Width") & "' height='" & Rs_Ad("Height") & "'></embed>"
HtmlString = HtmlString & "</object></div>" & vbCrLf
Else
HtmlString = HtmlString & "<div id='yuxingtome' style='position:absolute;'><table border=0 width='" & Rs_Ad("Width") & "' height='" & Rs_Ad("Height") & "'><tr><td class=AdsBorder>" & Rs_Ad("Remark") & "</td></tr></table></div>" & vbCrLf
End If
HtmlString = HtmlString & "<SCRIPT LANGUAGE=JavaScript>yuxingtome()</SCRIPT>" & vbCrLf
End If
Rs_Ad.Close
Set Rs_Ad = Nothing
ScriptFloatAds = HtmlString
End Function
'*************************************************************
'函数作用:弹出式窗口
'*************************************************************
Public Function RunScriptAds(ColumnID)
Dim SQL, Rs_Ad, HtmlString
Set Rs_Ad = CreateObject("adodb.recordset")
SQL = "select Top 1 * from NC_Adcolumn where AdsType = 0 And isLock = 0 And ColumnID in (0, " & ColumnID & ") order by AdsTime desc, id desc"
Rs_Ad.Open SQL, Conn, 1, 1
If Rs_Ad.bof And Rs_Ad.EOF Then
HtmlString = ""
Else
HtmlString = "<SCRIPT language=javascript>window.open(""" & Newasp.SetupDir & "runads.asp?id=" & Rs_Ad("id") & """,""runads" & Rs_Ad("id") & """,""toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,width=" & Rs_Ad("Width") & ",height=" & Rs_Ad("Height") & ",top=" & Rs_Ad("topmargin") & ",left=" & Rs_Ad("sidemargin") & """);</script>" & vbCrLf
End If
Rs_Ad.Close
Set Rs_Ad = Nothing
RunScriptAds = HtmlString
End Function
End Class
%>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?