Guest - Junior - Postado Abril 10, 2006 Denunciar Share Postado Abril 10, 2006 O que devo fazr?Pois quando clico no produto ele não abre e quando coloco end if ele abre mais quando finalizo compra da erroagurado__________________________________________________________________________________<!--#include file="banner_conectar.asp"--><%function vwdImageBounds(flnm,maxWidth,maxHeight) Dim width Dim height Dim imgAspectRatio Dim deltaWidth Dim deltaHeight if gfxSpex(flnm, width, height) = False then width=0 height=0 end if if width > 0 AND height > 0 then imgAspectRatio=width/height deltaWidth=maxWidth - width deltaHeight=maxHeight - height if deltaWidth > deltaHeight then height=maxHeight width=int(height * imgAspectRatio) else width=maxWidth height=int(width*(1/imgAspectRatio)) end if end if vwdImageBounds="width=" & chr(34) & cStr(width) & chr(34) & " height=" & chr(34) & cStr(height) & chr(34)end function function GetBytes(flnm, offset, bytes) Dim objFSO Dim objFTemp Dim objTextStream Dim lngSize on error resume next Set objFSO = CreateObject("Scripting.FileSystemObject") flnm=Server.MapPath(flnm) ' First, we get the filesize Set objFTemp = objFSO.GetFile(flnm) lngSize = objFTemp.Size set objFTemp = nothing fsoForReading = 1 Set objTextStream = objFSO.OpenTextFile(flnm, fsoForReading) if offset > 0 then strBuff = objTextStream.Read(offset - 1) end if if bytes = -1 then GetBytes = objTextStream.Read(lngSize) 'ReadAll else GetBytes = objTextStream.Read(bytes) end if objTextStream.Close set objTextStream = nothing set objFSO = nothingend functionfunction lngConvert(strTemp) lngConvert = clng(asc(left(strTemp, 1)) + ((asc(right(strTemp, 1)) * 256)))end functionfunction lngConvert2(strTemp) lngConvert2 = (asc(right(strTemp, 1)) + ((asc(left(strTemp, 1)) * 256)))end function function gfxSpex(flnm, width, height) dim strPNG dim strGIF dim strBMP dim strType strType = "" gfxSpex = False strPNG = chr(137) & chr(80) & chr(78) strGIF = "GIF" strType = GetBytes(flnm, 0, 3) if strType = strGIF then width = lngConvert(GetBytes(flnm, 7, 2)) height = lngConvert(GetBytes(flnm, 9, 2)) gfxSpex = True elseif left(strType, 2) = strBMP then 'never a bmp elseif strType = strPNG then Width = lngConvert2(GetBytes(flnm, 19, 2)) Height = lngConvert2(GetBytes(flnm, 23, 2)) Depth = getBytes(flnm, 25, 2) Dim d d=asc(right(Depth,1)) if d=0 OR d=2 OR d=3 OR d=4 OR d=6 then gfxSpex=True else strBuff = GetBytes(flnm, 0, -1) lngSize = len(strBuff) flgFound = 0 strTarget = chr(255) & chr(216) & chr(255) flgFound = instr(strBuff, strTarget) if flgFound = 0 then exit function end if lngPos = flgFound + 2 'jpg ExitLoop = false do while ExitLoop = False and lngPos < lngSize do while asc(mid(strBuff, lngPos, 1)) = 255 and lngPos < lngSize lngPos = lngPos + 1 loop if asc(mid(strBuff, lngPos, 1)) < 192 or asc(mid(strBuff, lngPos, 1)) > 195 then lngMarkerSize = lngConvert2(mid(strBuff, lngPos + 1, 2)) lngPos = lngPos + lngMarkerSize + 1 else ExitLoop = True end if loop if ExitLoop = False then Width = -1 Height = -1 else Height = lngConvert2(mid(strBuff, lngPos + 4, 2)) Width = lngConvert2(mid(strBuff, lngPos + 6, 2)) gfxSpex = True end if end ifend function%><script language="vbscript" runat="server">function vwdImageBounds(flnm,maxWidth,maxHeight) Dim width Dim height Dim imgAspectRatio Dim deltaWidth Dim deltaHeight if gfxSpex(flnm, width, height) = False then width=0 height=0 end if if width > 0 AND height > 0 then imgAspectRatio=width/height deltaWidth=maxWidth - width deltaHeight=maxHeight - height if deltaWidth > deltaHeight then height=maxHeight width=int(height * imgAspectRatio) else width=maxWidth height=int(width*(1/imgAspectRatio)) end if end if vwdImageBounds="width=" & chr(34) & cStr(width) & chr(34) & " height=" & chr(34) & cStr(height) & chr(34)end function function GetBytes(flnm, offset, bytes) Dim objFSO Dim objFTemp Dim objTextStream Dim lngSize on error resume next Set objFSO = CreateObject("Scripting.FileSystemObject") flnm=Server.MapPath(flnm) ' First, we get the filesize Set objFTemp = objFSO.GetFile(flnm) lngSize = objFTemp.Size set objFTemp = nothing fsoForReading = 1 Set objTextStream = objFSO.OpenTextFile(flnm, fsoForReading) if offset > 0 then strBuff = objTextStream.Read(offset - 1) end if if bytes = -1 then GetBytes = objTextStream.Read(lngSize) 'ReadAll else GetBytes = objTextStream.Read(bytes) end if objTextStream.Close set objTextStream = nothing set objFSO = nothingend functionfunction lngConvert(strTemp) lngConvert = clng(asc(left(strTemp, 1)) + ((asc(right(strTemp, 1)) * 256)))end functionfunction lngConvert2(strTemp) lngConvert2 = (asc(right(strTemp, 1)) + ((asc(left(strTemp, 1)) * 256)))end function function gfxSpex(flnm, width, height) dim strPNG dim strGIF dim strBMP dim strType strType = "" gfxSpex = False strPNG = chr(137) & chr(80) & chr(78) strGIF = "GIF" strType = GetBytes(flnm, 0, 3) if strType = strGIF then width = lngConvert(GetBytes(flnm, 7, 2)) height = lngConvert(GetBytes(flnm, 9, 2)) gfxSpex = True elseif left(strType, 2) = strBMP then 'never a bmp elseif strType = strPNG then Width = lngConvert2(GetBytes(flnm, 19, 2)) Height = lngConvert2(GetBytes(flnm, 23, 2)) Depth = getBytes(flnm, 25, 2) Dim d d=asc(right(Depth,1)) if d=0 OR d=2 OR d=3 OR d=4 OR d=6 then gfxSpex=True else strBuff = GetBytes(flnm, 0, -1) lngSize = len(strBuff) flgFound = 0 strTarget = chr(255) & chr(216) & chr(255) flgFound = instr(strBuff, strTarget) if flgFound = 0 then exit function end if lngPos = flgFound + 2 'jpg ExitLoop = false do while ExitLoop = False and lngPos < lngSize do while asc(mid(strBuff, lngPos, 1)) = 255 and lngPos < lngSize lngPos = lngPos + 1 loop if asc(mid(strBuff, lngPos, 1)) < 192 or asc(mid(strBuff, lngPos, 1)) > 195 then lngMarkerSize = lngConvert2(mid(strBuff, lngPos + 1, 2)) lngPos = lngPos + lngMarkerSize + 1 else ExitLoop = True end if loop if ExitLoop = False then Width = -1 Height = -1 else Height = lngConvert2(mid(strBuff, lngPos + 4, 2)) Width = lngConvert2(mid(strBuff, lngPos + 6, 2)) gfxSpex = True end if end ifend functionend if</script><% AbreConexaoSql="SELECT * FROM banner"Set RS = Conexao.Execute(Sql)if RS.eof thenElseDo Until RS.EOF or RS.BOFValores = Valores & RS("ID") & ","RS.MovenextLoopArraySplit = Split(Left(Valores,Len(Valores)-1),",")Randomizex = CInt(Rnd()*Ubound(ArraySplit))sID = ArraySplit(x)Sql="SELECT * FROM banner WHERE id = "&sID&""Set rsMostra = Conexao.Execute(Sql) %><a href="banner_vai.asp?id=<%=rsMostra("id")%>&url=<%=rsMostra("url")%>"><img alt="<%=rsMostra("alt")%>" <%=vwdImageBounds(rsMostra("banner"),351,45)%> src="<%=rsMostra("banner")%>" width="351" height="45"border="0"></a> <% Sql1 = "UPDATE banner SET exibicoes = exibicoes + 1 WHERE id = "&rsMostra("id")&" "Conexao.Execute(Sql1) %><% end if %> Citar Link para o comentário Compartilhar em outros sites More sharing options...
0 .Andreia. Postado Abril 10, 2006 Denunciar Share Postado Abril 10, 2006 Posta o erro que aparece pra você e a sinaliza a linha. Fica mais facil... Citar Link para o comentário Compartilhar em outros sites More sharing options...
0 Marcio-Free-lance Postado Abril 10, 2006 Denunciar Share Postado Abril 10, 2006 Junior eu entendi bem ou você está fazendo um carrinho de compra utilizando este maravilhoso script (enorme ele caraca), eu quase mori de rir com a resposta da adriana....ela se viu na amazonia a pé hehehehe e eu também que coisa grande e verde hehehehehe....falando sério....que tão usar session talves ajude você melhor e depos você não vai ter problemas com usuários que tenha bloqueados os cks , mais seguro no bom sentido de não corrrer o risco de algum usuário sortudo ter bloqueado cks e quer comprar em lojas que usam cks para o carrinho coisa loca esta mais tem gente ai que faz com cks.espero ter ajudado.aproveitando ...como vai ANDREIA foi mau ( erro adriana ) morri de rir com sua resposta..abraços para vocês. Citar Link para o comentário Compartilhar em outros sites More sharing options...
0 .Andreia. Postado Abril 10, 2006 Denunciar Share Postado Abril 10, 2006 Oi Marcio, td bem.. mas por favor, meu nome é ANDREIA :lol: :lol: Dessa vez eu perdoo rssss Citar Link para o comentário Compartilhar em outros sites More sharing options...
Pergunta
Guest - Junior -
O que devo fazr?
Pois quando clico no produto ele não abre e quando coloco end if ele abre mais quando finalizo compra da erro
agurado
__________________________________________________________________________________
<!--#include file="banner_conectar.asp"-->
<%
function vwdImageBounds(flnm,maxWidth,maxHeight)
Dim width
Dim height
Dim imgAspectRatio
Dim deltaWidth
Dim deltaHeight
if gfxSpex(flnm, width, height) = False then
width=0
height=0
end if
if width > 0 AND height > 0 then
imgAspectRatio=width/height
deltaWidth=maxWidth - width
deltaHeight=maxHeight - height
if deltaWidth > deltaHeight then
height=maxHeight
width=int(height * imgAspectRatio)
else
width=maxWidth
height=int(width*(1/imgAspectRatio))
end if
end if
vwdImageBounds="width=" & chr(34) & cStr(width) & chr(34) & " height=" & chr(34) & cStr(height) & chr(34)
end function
function GetBytes(flnm, offset, bytes)
Dim objFSO
Dim objFTemp
Dim objTextStream
Dim lngSize
on error resume next
Set objFSO = CreateObject("Scripting.FileSystemObject")
flnm=Server.MapPath(flnm)
' First, we get the filesize
Set objFTemp = objFSO.GetFile(flnm)
lngSize = objFTemp.Size
set objFTemp = nothing
fsoForReading = 1
Set objTextStream = objFSO.OpenTextFile(flnm, fsoForReading)
if offset > 0 then
strBuff = objTextStream.Read(offset - 1)
end if
if bytes = -1 then
GetBytes = objTextStream.Read(lngSize) 'ReadAll
else
GetBytes = objTextStream.Read(bytes)
end if
objTextStream.Close
set objTextStream = nothing
set objFSO = nothing
end function
function lngConvert(strTemp)
lngConvert = clng(asc(left(strTemp, 1)) + ((asc(right(strTemp, 1)) * 256)))
end function
function lngConvert2(strTemp)
lngConvert2 = (asc(right(strTemp, 1)) + ((asc(left(strTemp, 1)) * 256)))
end function
function gfxSpex(flnm, width, height)
dim strPNG
dim strGIF
dim strBMP
dim strType
strType = ""
gfxSpex = False
strPNG = chr(137) & chr(80) & chr(78)
strGIF = "GIF"
strType = GetBytes(flnm, 0, 3)
if strType = strGIF then
width = lngConvert(GetBytes(flnm, 7, 2))
height = lngConvert(GetBytes(flnm, 9, 2))
gfxSpex = True
elseif left(strType, 2) = strBMP then
'never a bmp
elseif strType = strPNG then
Width = lngConvert2(GetBytes(flnm, 19, 2))
Height = lngConvert2(GetBytes(flnm, 23, 2))
Depth = getBytes(flnm, 25, 2)
Dim d
d=asc(right(Depth,1))
if d=0 OR d=2 OR d=3 OR d=4 OR d=6 then gfxSpex=True
else
strBuff = GetBytes(flnm, 0, -1)
lngSize = len(strBuff)
flgFound = 0
strTarget = chr(255) & chr(216) & chr(255)
flgFound = instr(strBuff, strTarget)
if flgFound = 0 then
exit function
end if
lngPos = flgFound + 2 'jpg
ExitLoop = false
do while ExitLoop = False and lngPos < lngSize
do while asc(mid(strBuff, lngPos, 1)) = 255 and lngPos < lngSize
lngPos = lngPos + 1
loop
if asc(mid(strBuff, lngPos, 1)) < 192 or asc(mid(strBuff, lngPos, 1)) > 195 then
lngMarkerSize = lngConvert2(mid(strBuff, lngPos + 1, 2))
lngPos = lngPos + lngMarkerSize + 1
else
ExitLoop = True
end if
loop
if ExitLoop = False then
Width = -1
Height = -1
else
Height = lngConvert2(mid(strBuff, lngPos + 4, 2))
Width = lngConvert2(mid(strBuff, lngPos + 6, 2))
gfxSpex = True
end if
end if
end function
%>
<script language="vbscript" runat="server">
function vwdImageBounds(flnm,maxWidth,maxHeight)
Dim width
Dim height
Dim imgAspectRatio
Dim deltaWidth
Dim deltaHeight
if gfxSpex(flnm, width, height) = False then
width=0
height=0
end if
if width > 0 AND height > 0 then
imgAspectRatio=width/height
deltaWidth=maxWidth - width
deltaHeight=maxHeight - height
if deltaWidth > deltaHeight then
height=maxHeight
width=int(height * imgAspectRatio)
else
width=maxWidth
height=int(width*(1/imgAspectRatio))
end if
end if
vwdImageBounds="width=" & chr(34) & cStr(width) & chr(34) & " height=" & chr(34) & cStr(height) & chr(34)
end function
function GetBytes(flnm, offset, bytes)
Dim objFSO
Dim objFTemp
Dim objTextStream
Dim lngSize
on error resume next
Set objFSO = CreateObject("Scripting.FileSystemObject")
flnm=Server.MapPath(flnm)
' First, we get the filesize
Set objFTemp = objFSO.GetFile(flnm)
lngSize = objFTemp.Size
set objFTemp = nothing
fsoForReading = 1
Set objTextStream = objFSO.OpenTextFile(flnm, fsoForReading)
if offset > 0 then
strBuff = objTextStream.Read(offset - 1)
end if
if bytes = -1 then
GetBytes = objTextStream.Read(lngSize) 'ReadAll
else
GetBytes = objTextStream.Read(bytes)
end if
objTextStream.Close
set objTextStream = nothing
set objFSO = nothing
end function
function lngConvert(strTemp)
lngConvert = clng(asc(left(strTemp, 1)) + ((asc(right(strTemp, 1)) * 256)))
end function
function lngConvert2(strTemp)
lngConvert2 = (asc(right(strTemp, 1)) + ((asc(left(strTemp, 1)) * 256)))
end function
function gfxSpex(flnm, width, height)
dim strPNG
dim strGIF
dim strBMP
dim strType
strType = ""
gfxSpex = False
strPNG = chr(137) & chr(80) & chr(78)
strGIF = "GIF"
strType = GetBytes(flnm, 0, 3)
if strType = strGIF then
width = lngConvert(GetBytes(flnm, 7, 2))
height = lngConvert(GetBytes(flnm, 9, 2))
gfxSpex = True
elseif left(strType, 2) = strBMP then
'never a bmp
elseif strType = strPNG then
Width = lngConvert2(GetBytes(flnm, 19, 2))
Height = lngConvert2(GetBytes(flnm, 23, 2))
Depth = getBytes(flnm, 25, 2)
Dim d
d=asc(right(Depth,1))
if d=0 OR d=2 OR d=3 OR d=4 OR d=6 then gfxSpex=True
else
strBuff = GetBytes(flnm, 0, -1)
lngSize = len(strBuff)
flgFound = 0
strTarget = chr(255) & chr(216) & chr(255)
flgFound = instr(strBuff, strTarget)
if flgFound = 0 then
exit function
end if
lngPos = flgFound + 2 'jpg
ExitLoop = false
do while ExitLoop = False and lngPos < lngSize
do while asc(mid(strBuff, lngPos, 1)) = 255 and lngPos < lngSize
lngPos = lngPos + 1
loop
if asc(mid(strBuff, lngPos, 1)) < 192 or asc(mid(strBuff, lngPos, 1)) > 195 then
lngMarkerSize = lngConvert2(mid(strBuff, lngPos + 1, 2))
lngPos = lngPos + lngMarkerSize + 1
else
ExitLoop = True
end if
loop
if ExitLoop = False then
Width = -1
Height = -1
else
Height = lngConvert2(mid(strBuff, lngPos + 4, 2))
Width = lngConvert2(mid(strBuff, lngPos + 6, 2))
gfxSpex = True
end if
end if
end function
end if
</script>
<% AbreConexao
Sql="SELECT * FROM banner"
Set RS = Conexao.Execute(Sql)
if RS.eof then
Else
Do Until RS.EOF or RS.BOF
Valores = Valores & RS("ID") & ","
RS.Movenext
Loop
ArraySplit = Split(Left(Valores,Len(Valores)-1),",")
Randomize
x = CInt(Rnd()*Ubound(ArraySplit))
sID = ArraySplit(x)
Sql="SELECT * FROM banner WHERE id = "&sID&""
Set rsMostra = Conexao.Execute(Sql) %>
<a href="banner_vai.asp?id=<%=rsMostra("id")%>&url=<%=rsMostra("url")%>">
<img alt="<%=rsMostra("alt")%>" <%=vwdImageBounds(rsMostra("banner"),351,45)%> src="<%=rsMostra("banner")%>" width="351" height="45"border="0"></a>
<% Sql1 = "UPDATE banner SET exibicoes = exibicoes + 1 WHERE id = "&rsMostra("id")&" "
Conexao.Execute(Sql1)
%><% end if %>
Link para o comentário
Compartilhar em outros sites
3 respostass a esta questão
Posts Recomendados
Participe da discussão
Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.