Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

asp.net

[Resolvido] Sistema de Banner com .fla, .jpg, . gif e scripts

Recommended Posts

Estou postando aqui um pequeno script para banner rotativo, com administração, suporte a flash, Scripts de troca de banners. Estou fazendo a segunda versão com contador de exibições e cliques, entre outras coisas em breve aqui as modificações. Lembrem-se de criar o arquivo de conexão com o banco de dados.

 

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::

ESTRUTURA DO BANCO

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::

 

Imagem Postada

 

:::Sorteio do Banner:::::::::::::::::::::::::::

Dim banner

 

' Faço uma busca geral na tabela banner para pegar o ID de cada banner, jogando num vetor o resultado

 

banner="Select * from banner"

vb.Open banner

vetorbanner_codigo = array() 'inicia sem valor

while not vb.eof

ReDim preserve vetorbanner_codigo ( UBound( vetorbanner_codigo )+1) vetorbanner_codigo (Ubound(vetorbanner_codigo)) = vb("codigo")

vb.movenext

wend

 

vb.close

 

randomize()

 

registrobanner_atual = Int((Ubound(vetorbanner_codigo) - Lbound(vetorbanner_codigo) + 1) * Rnd + Lbound(vetorbanner_codigo))

registrobanner_atual=(vetorbanner_codigo(registrobanner_atual))

 

'Faço outra busca agora já tendo o ID do banner que foi escolhido aleatoriamente.

 

buscabanner_usuario="Select * from banner where codigo="&registrobanner_atual

vb.open buscabanner_usuario

if vb.bof and vb.eof then

'Se ele não encontrar nenhum banner chama novamente o script

else

'Agora eu verifico que tipo de arquivo ele me trouxe, se for 3 - Flash, "Script" - Script de troca de banner, e a outra opção as imagens podendo ser .jpg ou .gif

 

if right(vb("banner"),3)="swf" then%>

<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="468" height="60">

<param name="movie" value="<%=vb("banner")%>">

<param name="quality" value="high">

<embed src="<%=vb("banner")%>" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="468" height="60"></embed></object>

<%elseif vb("banner")="script" then

response.Write(vb("link"))

else

response.Write("<a href="&vb("link")&" target="&vb("target")&">")

response.Write("<img src="&vb("banner")&" border=0>")

response.Write("</a>")

end if

end if

vb.close

 

::::::::::::::::::Administração do Banner::::::::::::::::::::::::::::::::::::::::::::

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>

<html>

<head>

<title>Documento sem título</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

</head>

 

<body>

<table width="780" border="0" cellpadding="1" cellspacing="1" bordercolor="#FFFFFF" bgcolor="#000000">

<tr bgcolor="#FFFFFF">

<td width="205"><img src="jpg/logotipo.jpg" width="284" height="162"></td>

<td width="568" valign="bottom"><font size="2" face="Tahoma, Verdana"><strong>Sistema

de Administração da Valeu boi.</strong></font></td>

</tr>

<tr bgcolor="#FFFFFF">

<td>

<%if session("admin")=true then%>

<br>

<table width="100%" border="0" cellspacing="1" cellpadding="1">

<tr>

<td><font size="2" face="Tahoma, Verdana"><strong> :.: <a href="visualizabanner.asp">Visualizar

Banners</a></strong></font></td>

</tr>

<tr>

<td><font size="2" face="Tahoma, Verdana"><strong> :.: <a href="excluibanner.asp">Excluir

Banners</a> </strong></font></td>

</tr>

<tr>

<td> <font size="2" face="Tahoma, Verdana"><strong>:.: <a href="adicionabanner.asp">Adicionar

Banners</a></strong></font></td>

</tr>

</table> <br>

<%else%>

<form action="logandousuario.asp" method="post"><table width="100%" border="0" cellspacing="1" cellpadding="1">

<tr>

<td>Login:  

<input name="email" type="text" id="email">

<input name="pagina" type="hidden" id="pagina" value="adm"></td>

</tr>

<tr>

<td>Senha:  <input name="senha" type="password" id="senha"></td>

</tr>

<tr>

<td><input type="submit" name="Submit" value="Login"></td>

</tr>

</table></form></td>

<%end if%>

<td> </td>

</tr>

</table>

</body>

</html>

 

 

:::::::Arquivos de visualização, exclusão e inserção dos banners.

 

- Cadastrando no banco o banner

 

<!--#include file="connections/valeuboi2004.asp"-->

<%

Dim comando, comandosql

comando=Request.QueryString("comando")

if comando=1 then

comandosql="Delete * from banner where codigo="&Request.QueryString("banner")

vb.open comandosql

Response.Redirect("visualizabanner.asp")

else

vb.open "banner"

vb.AddNew

if Request.Form("banner")="gif" then

vb("banner")=Request.Form("codigo")

vb("link")=Request.Form("codigo")

else

vb("banner")=Request.Form("banner")

vb("link")=Request.Form("codigo")

end if

vb.update

vb.close

Response.Redirect("visualizabanner.asp")

end if

%>

 

::::Exclusão.

 

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>

<!--#include file="connections/valeuboi2004.asp"-->

<html>

<head>

<title>Documento sem título</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

</head>

 

<body>

<table width="780" border="0" cellpadding="1" cellspacing="1" bordercolor="#FFFFFF" bgcolor="#000000">

<tr bgcolor="#FFFFFF">

<td width="205"><img src="jpg/logotipo.jpg" width="284" height="162"></td>

<td width="568" valign="bottom"><font size="2" face="Tahoma, Verdana"><strong>Sistema

de Administração da Valeu boi.</strong></font></td>

</tr>

<tr bgcolor="#FFFFFF">

<td valign="top">

<%if session("admin")=true then%>

<br>

<table width="100%" border="0" cellspacing="1" cellpadding="1">

<tr>

<td><font size="2" face="Tahoma, Verdana"><strong> :.: <a href="visualizabanner.asp">Visualizar

Banners</a></strong></font></td>

</tr>

<tr>

<td><font size="2" face="Tahoma, Verdana"><strong> :.: <a href="excluibanner.asp">Excluir

Banners</a> </strong></font></td>

</tr>

<tr>

<td> <font size="2" face="Tahoma, Verdana"><strong>:.: <a href="adicionabanner.asp">Adicionar

Banners</a></strong></font></td>

</tr>

</table> <br>

<%else%>

<form action="logandousuario.asp" method="post"><table width="100%" border="0" cellspacing="1" cellpadding="1">

<tr>

<td>Login:  

<input name="email" type="text" id="email">

<input name="pagina" type="hidden" id="pagina" value="adm"></td>

</tr>

<tr>

<td>Senha:  <input name="senha" type="password" id="senha"></td>

</tr>

<tr>

<td><input type="submit" name="Submit" value="Login"></td>

</tr>

</table></form></td>

<%end if%>

<td>

<%

'Inicio do sistema de banners visualizacao

Dim buscabanner

buscabanner="Select * from banner"

vb.open buscabanner

while not vb.eof

if vb.bof and vb.eof then

else

if right(vb("banner"),3)="swf" then%>

<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="468" height="60">

<param name="movie" value="<%=vb("banner")%>">

<param name="quality" value="high">

<embed src="<%=vb("banner")%>" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="468" height="60"></embed></object>

<a href="manutencaobanner.asp?comando=1&banner=<%=vb("codigo")%>">-</a>

<%

response.Write("<hr>")

elseif vb("banner")="script" then

response.Write(vb("link"))

response.Write("<a href='manutencaobanner.asp?comando=1&banner="&vb("codigo")&"'>-</a>")

response.Write("<hr>")

else

response.Write("<a href="&vb("link")&" target="&vb("target")&">")

response.Write("<img src="&vb("banner")&" border=0>")

response.Write("</a>")

response.Write("<a href='manutencaobanner.asp?comando=1&banner="&vb("codigo")&"'>-</a>")

response.Write("<hr>")

end if

end if

vb.movenext

wend

vb.close

%>

</td>

</tr>

</table>

</body>

</html>

 

::::::Visualização do banner

 

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>

<!--#include file="connections/valeuboi2004.asp"-->

<html>

<head>

<title>Documento sem título</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

</head>

 

<body>

<table width="780" border="0" cellpadding="1" cellspacing="1" bordercolor="#FFFFFF" bgcolor="#000000">

<tr bgcolor="#FFFFFF">

<td width="205"><img src="jpg/logotipo.jpg" width="284" height="162"></td>

<td width="568" valign="bottom"><font size="2" face="Tahoma, Verdana"><strong>Sistema

de Administração da Valeu boi.</strong></font></td>

</tr>

<tr bgcolor="#FFFFFF">

<td valign="top">

<%if session("admin")=true then%>

<br>

<table width="100%" border="0" cellspacing="1" cellpadding="1">

<tr>

<td><font size="2" face="Tahoma, Verdana"><strong> :.: <a href="visualizabanner.asp">Visualizar

Banners</a></strong></font></td>

</tr>

<tr>

<td><font size="2" face="Tahoma, Verdana"><strong> :.: <a href="excluibanner.asp">Excluir

Banners</a> </strong></font></td>

</tr>

<tr>

<td> <font size="2" face="Tahoma, Verdana"><strong>:.: <a href="adicionabanner.asp">Adicionar

Banners</a></strong></font></td>

</tr>

</table> <br>

<%else%>

<form action="logandousuario.asp" method="post"><table width="100%" border="0" cellspacing="1" cellpadding="1">

<tr>

<td>Login:  

<input name="email" type="text" id="email">

<input name="pagina" type="hidden" id="pagina" value="adm"></td>

</tr>

<tr>

<td>Senha:  <input name="senha" type="password" id="senha"></td>

</tr>

<tr>

<td><input type="submit" name="Submit" value="Login"></td>

</tr>

</table></form></td>

<%end if%>

<td>

<%

'Inicio do sistema de banners visualizacao

Dim buscabanner

buscabanner="Select * from banner"

vb.open buscabanner

while not vb.eof

if vb.bof and vb.eof then

'response.redirect("index.asp")

else

'response.Write(right(vb("banner"),3))

'response.End()

if right(vb("banner"),3)="swf" then%>

<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="468" height="60">

<param name="movie" value="<%=vb("banner")%>">

<param name="quality" value="high">

<embed src="<%=vb("banner")%>" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="468" height="60"></embed></object>

 

<%

response.Write("<hr>")

elseif vb("banner")="script" then

response.Write(vb("link"))

response.Write("<hr>")

else

response.Write("<a href="&vb("link")&" target="&vb("target")&">")

response.Write("<img src="&vb("banner")&" border=0>")

response.Write("</a>")

response.Write("<hr>")

end if

end if

vb.movenext

wend

vb.close

%>

</td>

</tr>

</table>

</body>

</html>

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.