<% 'dim conexaodb pag = request("pag") action = request("action") %> <% IF action = "" Then SQL = "SELECT * FROM banner ORDER BY id DESC" Call abreconexao Set RS = conexaodb.execute(SQL) ELSEIF action = "adicionar" then vlink = request("txtlink") Vfoto = request("imag_peq") ' trato os ' por " par evitar erro no codigo vlink = replace(vlink,"'",""") 'Response.Write( vlink & vfoto) 'Response.end SQL = "INSERT INTO banner (link, foto) VALUES ('"&vlink&"', '"&vfoto&"')" Call abreconexao conexaodb.execute(SQL) %> <% ELSEIF action = "excluir" then 'indico o codigo do banco codigo = request("codigo") ' inicio um select para que eu posso selecinar a foto e apagala da pasta SQL = "SELECT * FROM banner WHERE id="&codigo Call abreconexao conexaodb.execute (SQL) set rs = conexaodb.execute(SQL) 'indico a foto banner = Rs.Fields("foto") ' c foto for <> "" então ele vai pegar o diretorio + a foto e deleta-la da pasta IF banner <> "" then 'deleto os arquivos da pasta Set fso = CreateObject("Scripting.FileSystemObject") Set fileObject = fso.GetFile(Server.MapPath("../../images_foto") & "/"& banner &"") fileObject.Delete End IF 'fecho o if do delete da pasta 'deleto os arquivos do banco SQL = "DELETE * FROM banner WHERE id="&codigo Call abreconexao conexaodb.execute (SQL) %> <% ELSEIF action = "alterar" then codigo = request("codigo") SQL = "SELECT * FROM banner WHERE id="&codigo Call abreconexao Set rs = conexaodb.execute(SQL) ELSEIF action = "alterar2" then codigo = request("codigo") vlink = request("txtlink") Vfoto = request("imag_peq") vlink = replace(vlink,"'",""") SQL = "UPDATE banner SET link='"&vlink&"', foto='"&vfoto&"' WHERE id="&codigo Call Abreconexao set Rs = conexaodb.execute(SQL) Call Fechaconexao Set RS = Nothing %> <% END IF %> <% IF pag = 1 then %> <% ELSEIF pag = 2 then %> <% ELSEIF pag = 3 then %> <% END IF %>
 Banner > Adicionar
Links : 
http://
Banner: 

                        
   
 Banner > Listar
<% If Not RS.EOF Then While Not Rs.EOF %> <%IF RS("foto") <> "" Then%> <%ELSE%> <%END IF%> <% Rs.Movenext Wend 'Rs.close 'Call FechaConexao 'Set Rs = Nothing Else %> <%END IF%>
<% nomeextensao = right(rs("foto"),3) IF nomeextensao <> "swf" Then %> " hspace="3" vspace="3" border="0" align="bottom"> <%ELSE%> " name="fotoEvento"> " quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparente"> <%End IF%>
 <%=RS("link")%>
 <%=RS("link")%> )">  )">
Nenhum Banner cadastrado!!!
 Banner > Alterar
">                       Novo banner:
Link : 
http:// ">
Banner Atual: <% vimag_peq = Rs("foto") if trim(vimag_peq)<>"" then vurlFoto="../../images_foto/" & vimag_peq else vurlFoto="../imagens/pix_transp.gif" end if %>