Jump to content


Isso é um problema! Erro passo-a-passo:


  • Faça o login para participar
12 replies to this topic

#1 malagoli

malagoli
  • Visitantes

Posted 28/01/2003, 08:31

:huh: O Admentor criou este código para colocar na página:

Generated HTML (Just cut 'n' paste into your page.)
 
<%=AdMentor_GetAdASP("F=6&Z=13&N=1")%>

Remember to include admentor2.asp also
Something like:
<!--#include virtual="/admentor/include/admentor2.asp"-->  
 

:huh: Eu coloquei em uma página teste:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body><%=AdMentor_GetAdASP("F=6&Z=13&N=1")%><!--#include virtual="/admentor/include/admentor2.asp"--> 
</body>
</html>

:huh: ele dá esse erro quando tento visualizar a página:

Microsoft OLE DB Provider for ODBC Drivers erro '80004005'

[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

/admentor/include/admentordb.asp, line 44


:huh: O código deste arquivo é:

<!--#include file="admentorconfig.asp"-->
<!--#include file="adovbs.inc"-->
<%

'''''''''''  (C) Stefan Holmberg 1999  
'''''''''''  Free to use if these sourcecode lines is not deleted 
'''''''''''  Contact me at webmaster@sqlexperts.com
'''''''''''  [url=http://www.sqlexperts.com]http://www.sqlexperts.com[/url]
'''''''''''  AdMentor homepage at [url=http://www.create-a-webshop.com]http://www.create-a-webshop.com[/url]

' Version 1.11 contains contribution from Shawn Willmon - traceclicks code

Function Internal_AdMentordb_GetDateFunction()
	If g_AdMentor_DatabaseType = "SQLServer" Then
  Internal_AdMentordb_GetDateFunction = "getdate()"
	Else
  Internal_AdMentordb_GetDateFunction = "date()"
	End If
End Function

Function Internal_AdMentordb_GetBoolValue( fTrue )
	If g_AdMentor_DatabaseType = "SQLServer" Then
  If fTrue = True Then
 	 Internal_AdMentordb_GetBoolValue = "1"
  Else
 	 Internal_AdMentordb_GetBoolValue = "0"
  End If 	 
	Else
  If fTrue = true Then
 	 Internal_AdMentordb_GetBoolValue = "true"
  Else
 	 Internal_AdMentordb_GetBoolValue = "false"
  End If	
	End If
	
End Function



Function AdMentor_DBOpenConnection()
    Dim oConn
      
   	 Set oConn = Server.CreateObject("ADODB.Connection")
   	 oConn.Open g_AdMentor_strConnect   	 #####################################
  Set AdMentor_DBOpenConnection = oConn
End Function

Function AdMentor_DBGetBannersInFarm( oConn, nBannerFarm )
  Dim oRS
    Set oRS = CreateObject("ADODB.Recordset")
    oRS.CursorLocation = adUseClient
    oRS.MaxRecords = g_AdMentor_MaxRecords
    oRS.CacheSize = g_AdMentor_MaxRecords
    oRS.CursorType = adOpenForwardOnly
	oRS.Open "select bannerid, gifurl, weight, alttext, undertext, xsize, ysize from banner  where farmid=" & nBannerFarm & " and weight > 0 and showcount < maximpressions AND clickcount+underclickcount < maxclicks AND validtodate >= " & Internal_AdMentordb_GetDateFunction() & " AND validfromdate <= " & Internal_AdMentordb_GetDateFunction(), oConn
    
    Set oRS.ActiveConnection = Nothing
    Set  AdMentor_DBGetBannersInFarm = oRS
End Function

Sub AdMentor_DBAddShowCount( oConn, nBanner )
	oConn.Execute "update banner set showcount=showcount+1 where bannerid=" & nBanner
End Sub 


Sub AdMentor_DBUpdateClickCount( oConn, nBanner, fUnderText )
	Dim sSQL
	Dim oRSTC

	If fUnderText = True Then
  sSQL = "update banner set underclickcount = underclickcount +1 where bannerid = " & nBanner
	Else
  sSQL = "update banner set clickcount = clickcount +1 where bannerid = " & nBanner
	End if
	oConn.Execute ( sSQL )

	Set oRSTC = Server.CreateObject("ADODB.Recordset")
	Set oRSTC.ActiveConnection = oConn
	oRSTC.Open "select * from traceclicks where bannerid = -1 ", ,adOpenKeyset,adLockOptimistic
	oRSTC.AddNew()
	oRSTC("bannerid")=nBanner
	oRSTC("page")=Request.ServerVariables("HTTP_REFERER")
	oRSTC("dt") = now()
	oRSTC("ip")=Request.ServerVariables( "REMOTE_ADDR" )
	oRSTC("undertext")=fUndertext
	oRSTC.Update
	oRSTC.Close
        Set oRSTC = Nothing
End Sub

Function  AdMentor_DBGetUrl( oConn, nBanner, fUnderText )   	 
	Dim oRS
	Dim sSQL2

	If fUnderText = True Then
        sSQL2 = "select underurl as url from banner where bannerid= " & nBanner
	Else
        sSQL2 = "select redirurl as url from banner where bannerid= " & nBanner
	End if
	
	Set oRS = oConn.Execute ( sSQL2 )
	AdMentor_DBGetUrl = oRS("url").Value
	oRS.Close
	Set oRS = Nothing
End Function









Function AdSQL_AddAndWhere( strWhere, strWhat )
	If strWhere = "" Then
  strWhere = " WHERE "
	Else
  strWhere = strWhere & " AND "
	End If
	strWhere = strWhere & " " & strWhat
	AdSQL_AddAndWhere = strWhere
End Function



Function AdMentor_DBGetAvailBanners( oConn, fASP, strZones, nFarm, nBannerId, fCanUseHTML  )
  Dim oRS
    Set oRS = CreateObject("ADODB.Recordset")
    oRS.CursorLocation = adUseClient
    oRS.MaxRecords = g_AdMentor_MaxRecords
    oRS.CacheSize = g_AdMentor_MaxRecords
    oRS.CursorType = adOpenStatic
    oRS.Open GetAdSQL(fASP, strZones, nFarm, nBannerId, fCanUseHTML ), oConn
    
    Set oRS.ActiveConnection = Nothing
    Set  AdMentor_DBGetAvailBanners = oRS
End Function

Function AdMentor_GetHTMLCode( oConn, nBannerId )
  Dim oRS
    Set oRS = CreateObject("ADODB.Recordset")
    oRS.CursorLocation = adUseClient
    oRS.MaxRecords = 1
    oRS.CacheSize = 1
    oRS.CursorType = adOpenForwardOnly
    oRS.Open "select htmlcode from banner where bannerid="&nBannerId, oConn
    AdMentor_GetHTMLCode = oRS("htmlcode").Value
    
    oRS.Close
    Set oRS = Nothing  
End Function


Function GetAdSQL( fASP, sZone, nFarm, nBannerId, fCanUseHTML  )
	Dim strSQL
	Dim strWhere
	
	strSQL =  "select distinct banner.bannerid, banner.gifurl, banner.weight " 
	If fASP Then
  strSQL = strSQL & ", banner.AltText, banner.UnderText, banner.xsize, banner.ysize "
	End If
	If fCanUseHTML Then
  strSQL = strSQL & ",ishtml"
	End If
	
	If  strAdmentor_strAlreadyOnPage <> "" Then
  strWhere = AdSQL_AddAndWhere( strWhere, "banner.bannerid not in ( " &  strAdmentor_strAlreadyOnPage & ")" )
	End If
	
	strSQL = strSQL & " from banner "
	If sZone <> "0" Then
 	 strSQL = strSQL & ",banzone "
 	 strWhere = AdSQL_AddAndWhere( strWhere, "banner.bannerid=banzone.bannerid" )
 	 strWhere = AdSQL_AddAndWhere( strWhere, "banzone.zoneid in ( " & sZone & ")" )
	End If	
	
	
	If nBannerId <> "" Then
  strWhere = AdSQL_AddAndWhere( strWhere, "banner.bannerid=" & nBannerId )
	Else
  If nFarm <> 0 Then
 	 strWhere = AdSQL_AddAndWhere( strWhere, "banner.farmid=" & nFarm )
  End If
  strWhere = AdSQL_AddAndWhere( strWhere, "weight > 0 and showcount < maximpressions AND validtodate >= " & Internal_AdMentordb_GetDateFunction() & " AND validfromdate <= " & Internal_AdMentordb_GetDateFunction() )
  If fCanUseHTML = True Then
 	 strWhere = AdSQL_AddAndWhere( strWhere, " ( ( clickcount+underclickcount < maxclicks ) OR ishtml=" & Internal_AdMentordb_GetBoolValue(true) & " )"  )
  Else
 	 strWhere = AdSQL_AddAndWhere( strWhere, "ishtml <> " & Internal_AdMentordb_GetBoolValue(true)  )
  End If
	End If
	
	
	strSQL = strSQL & strWhere
	

' If you want banners with no zoning to mean all zones then add these 
' lines

'	If sZone <> "0" Then
' 	 strSQL = strSQL & "union select  distinct banner.bannerid, banner.gifurl, banner.weight "
'  If fASP Then
' 	 strSQL = strSQL & ", banner.AltText, banner.UnderText, banner.xsize, banner.ysize "
'  End If
'  If fCanUseHTML Then
' 	 strSQL = strSQL & ",ishtml"
'  End If
'  strSQL = strSQL & " from banner "
'  strSQL = strSQL & " where bannerid not in (select bannerid from banzone)"
'  If  strAdmentor_strAlreadyOnPage <> "" Then
' 	 strSQL = strSQL & " AND banner.bannerid not in ( " &  strAdmentor_strAlreadyOnPage & ")" 
'  End If
'	End If	


	GetAdSQL = strSQL
	
End Function



%>


:huh: a linha que ele fale é essa:

  	 oConn.Open g_AdMentor_strConnect

:o QUE EU FIZ DE ERRADO???

:blink: :( :unsure:

#2 malagoli

malagoli
  • Visitantes

Posted 28/01/2003, 08:39

Como eu consigo ser tão anta?

#3 otavio

otavio

    http://www.cursosvirtuais.net

  • Usuários
  • 443 posts
  • Sexo:Não informado

Posted 28/01/2003, 09:18

kra...
a variavel : g_AdMentor_strConnect
não possui os dados corretos para efetuar a conexao com o banco de dados...

na sua pagina de teste use:
<include file="/admentor/include/admentor2.asp"--> 

ao invés de:
<include virtual="/admentor/include/admentor2.asp"--> 

se não funcionar poste aki o codigo do arquivo q está em admentor/include/admentor2.asp

Aguardo retorno,
Abraços,
t+
/////////////////////////////////////////////

http://www.cursosvirtuais.net/

#4 malagoli

malagoli
  • Visitantes

Posted 28/01/2003, 09:40

:unsure: Ele deu este problema agora:

Erro de tempo de execução do Microsoft VBScript erro '800a000d' 

Tipos incompatíveis: 'AdMentor_GetAdASP' 

/teste.asp, line 8 

:ph34r: O código do Admentor2.asp é esse:


<!--#include file="admentordb.asp"-->
<%

'''''''''''  (C) Stefan Holmberg 1999  
'''''''''''  Free to use if these sourcecode lines is not deleted 
'''''''''''  Contact me at webmaster@sqlexperts.com
'''''''''''  [url=http://www.sqlexperts.com]http://www.sqlexperts.com[/url]
'''''''''''  AdMentor homepage at [url=http://www.create-a-webshop.com]http://www.create-a-webshop.com[/url]




''''''''''''''''The public functions

'This should be called from ASP pages on SAME server
'The QueryString parameter is just that - a querystring string
'where you specify zone etc the same way as when
'using NonSSI version

Public Function AdMentor_GetAdASP( strQueryString )
	Dim sArr, n
	Dim sArr2
	'Setable parameters
	Dim sZones, nFarm, nBannerId
	
	sArr = Split( strQueryString, "&" )

	For n=LBound(sArr) To UBound(sArr)
  sArr2 = Split( sArr(n), "=" )
  
  Select Case sArr2(0)
 	 Case "Z"
    sZones = sArr2(1)
 	 Case "F"
    nFarm = sArr2(1)
 	 Case "B"
    nBannerId = sArr2(1)
 	 Case "N"
    nBannerOnPage = sArr2(1)
  End Select
	Next
	
	'If we have selected a certain banner to run on this
	'specific spot then just don't care about the rest...
	AdMentor_GetAdASP = AdMentor_GetAdEx( True, sZones, nFarm, nBannerId, nBannerOnPage, True )
End Function

Public Function AdMentor_GetAdNonSSI()
	'Setable parameters
	Dim sZones, nFarm, nBannerId, nBannerOnPage
	
	sZones = Request.QueryString("Z")
	nFarm = Request.QueryString("F")
	nBannerId = Request.QueryString("B")
	nBannerOnPage = Request.QueryString("N")
	
	AdMentor_GetAdNonSSI = AdMentor_GetAdEx( False, sZones, nFarm, nBannerId, nBannerOnPage, False )
End Function


'Private functions 

Private Function AdMentor_AddToUsedList( nBannerId )
	If strAdmentor_strAlreadyOnPage <> "" Then
  strAdmentor_strAlreadyOnPage = strAdmentor_strAlreadyOnPage & ","  
	End If
	strAdmentor_strAlreadyOnPage = strAdmentor_strAlreadyOnPage & CStr(nBannerId)
End Function


' If ASP then it returns the HTML
' else it simply returns the bannerid

' fASP = true or false
Private Function AdMentor_GetAdEx( fASP, strZone, nFarm, nBannerId, nBannerOnPage, fCanUseHTML )
    Dim oConn
    Dim oRS
    Dim nSumWeight
    Dim nTempIndex
    Dim nWeight
    Dim nTempIndex2
    Dim nBanner
    Dim nCurRow
    Dim nMax
    
    Set oConn = AdMentor_DBOpenConnection()
    
    If strZone = "" Then
   	 strZone = "0"
    End If

    If nFarm = "" Then
   	 nFarm = "0"
    End If
    
    ' Get Total Weight
    Set oRS = AdMentor_DBGetAvailBanners( oConn, fASP, strZone, nFarm, nBannerId, fCanUseHTML  )
    If oRS.EOF Then
       'There is no banner in this banner farm
       'TODO: RETURN DEFAULT BANNER!!!!!
        oRS.Close
  Set oRS = Nothing
   	 oConn.Close
   	 Set oConn = Nothing
       AdMentor_GetAd = "No banner in farm"
  Exit Function
    End If
    
    'Now lets get the total weight
    nSumWeight = 0
    While Not oRS.EOF
        nSumWeight = nSumWeight + oRS("weight").Value
        oRS.MoveNext
    Wend
    
    ' Lets get a random banner
    Randomize
    nBanner = Int((nSumWeight * Rnd) + 1)
    
    oRS.MoveFirst
    nCurVal = 0
    While nCurVal + oRS("weight").Value < nBanner
        nCurVal = nCurVal + oRS("weight").Value
        oRS.MoveNext
    Wend
    
    nBanner = oRS("bannerid").Value
    
    AdMentor_AddToUsedList nBanner
    
    If Not fASP Then
       oRS.Close
  Set oRS = Nothing
   	 AdMentor_GetAdEx = nBanner & "---" & oRS("gifurl").Value
   	 AdMentor_DBAddShowCount oConn, nBanner 
   	 oConn.Close
   	 Set oConn = Nothing
   	 Exit Function
    End If
    
    
    If fCanUseHTML And oRS("ishtml").Value = True Then
   	 Dim sHTMCode
   	 oRS.Close
  Set oRS = Nothing
   	 sHTMCode = AdMentor_GetHTMLCode( oConn, nBanner )
   	 AdMentor_GetAdEx = FixupSpecialVariables(sHTMCode)
   	 AdMentor_DBAddShowCount oConn, nBanner 
   	 oConn.Close
   	 Set oConn = Nothing
   	 Exit Function
    End If
        
    ' Now we have the banner id, lets create the actual HTML
    
    'Move into temp variables only to make it more readable
    Dim sRedirUrl
    Dim sGifUrl
    Dim sAltText
    Dim sUnderText
    Dim sUnderUrl
    Dim sRet
    Dim nXSize
    Dim nYSize
    
    
    sRedirUrl = g_AdMentor_AdMentorRedirPath & "?id=" & nBanner & "&way=ban"
	If IsNull( oRS("gifurl").Value ) Then
  sGifUrl = ""
	Else
  sGifUrl = oRS("gifurl").Value
	End if
	If IsNull( oRS("AltText").Value ) Then
  sAltText = ""
	Else
  sAltText = oRS("AltText").Value
	End if
	If IsNull( oRS("UnderText").Value ) Then
  sUnderText = ""
	Else
  sUnderText = oRS("UnderText").Value
	End if
    sUnderUrl = g_AdMentor_AdMentorRedirPath & "?id=" & nBanner & "&way=txt"
    
    nXSize=oRS("xsize").Value
    nYSize=oRS("ysize").Value
    
    sRet = "<center><a href=""" & sRedirUrl & """>" & "<img src=""" & sGifUrl & """" & " alt=""" & sAltText & """" & " border=0 width=""" & nXSize & """" & " height=""" & nYSize & """" &  ">"  & "</a>"
    If sUnderText <> "" Then
        sRet = sRet & "<br><font face=""arial"" size=""1""><a href=""" & sUnderUrl & """" & ">" & sUnderText & "</a></font>"
    Else
        '
    End If
    sRet = sRet & "</center>"
    
    AdMentor_GetAdEx = sRet
    
    ' Lets update impression for it
    AdMentor_DBAddShowCount oConn, nBanner 
    oRS.Close
    Set oRS = Nothing  
    oConn.Close
    Set oConn = Nothing
End Function



Public Function AdMentor_ClickAd(nBannerId, sWay)
    Dim oConn
    Dim sSQL
    Dim sSQL2
    Dim oRS
    Dim sRedir
	Dim fIsUnderText    
	
	If sWay ="txt" Then
  fIsUnderText = true
	Else
  fIsUnderText = false ' Clicked on actual banner
	End If
    
    
    'Pretty easy...
    Set oConn = AdMentor_DBOpenConnection()
    
    AdMentor_DBUpdateClickCount oConn, nBannerId, fIsUnderText 
	sRedir = AdMentor_DBGetUrl( oConn, nBannerId, fIsUnderText )   	 
    
    oConn.Close
    Set oConn = Nothing
    
    AdMentor_ClickAd = sRedir
End Function


Private Function FixupSpecialVariables( sHTML )
	'Now check for '<ADM_RANDOM
	Dim fCont
	fCont = True
	While fCont = True
  Dim nIndStart, nIndEnd, sSubStr, vData, nLow, nHigh, nNumber
  Dim sLeftHTML, sRightHTML
  
  nIndStart = InStr( 1,CStr(sHTML), "<ADM_RANDOM" )
  If nIndStart > 0 Then
 	 sLeftHTML = Left( sHTML, nIndStart -1 )
 	 
 	 nIndEnd = InStr( nIndStart, sHTML, ">" )

 	 sRightHTML = Mid( sHTML, nIndEnd + 1 )

 	 sSubStr = Mid( sHTML, nIndStart, nIndEnd - nIndStart )

 	 vData = Split( sSubStr, "-")
 	 If vData(1) = "LAST" Then
    nNumber = Session("AdMentor_RndNumber")
 	 Else
    nLow = CLng(vData(1))
    nHigh = CLng(vData(2))
     	 Randomize
     	 nNumber = CLng((nHigh * Rnd) + nLow)
     	 Session("AdMentor_RndNumber") = nNumber
      End If
 	 sHTML = sLeftHTML & CStr(nNumber) & sRightHTML
  End If
  If InStr( 1,CStr(sHTML), "<ADM_RANDOM" ) > 0 Then
 	 fCont = True
  Else
 	 fCont = False
  End If
	Wend
	FixupSpecialVariables = sHTML
End Function


Public Function GetAdminPagesBannerCode()
	'Want to advertise on your admin pages?
	'Then just change this function to what you want...
	'What I do is just call AdMentorGetAd with a special banner id
	'to get by Datais-banners showed
'	Dim sRet
'	sRet = AdMentor_GetAdASP("B=93")
	GetAdminPagesBannerCode = ""
End Function

%>

:( Se você quiser entrar na área administrativa clique aqui o login é rodrigo e a senha é 123456...

#5 otavio

otavio

    http://www.cursosvirtuais.net

  • Usuários
  • 443 posts
  • Sexo:Não informado

Posted 28/01/2003, 09:46

desculpa kra...
eu viajei total..

seu teste.asp deve ficar assim:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body><%=AdMentor_GetAdASP("F=6&Z=13&N=1")%><!--#include virtual="/admentor/include/admentor2.asp"--> 
</body>
</html>

pesso q poste o codigo do arquivo: /admentor/include/admentordb.asp

Abraços,
t+
/////////////////////////////////////////////

http://www.cursosvirtuais.net/

#6 malagoli

malagoli
  • Visitantes

Posted 28/01/2003, 18:37

Putz Cara!

:( Eu devo ser uma anta mesmo... voltei ao erro do começo:

Microsoft OLE DB Provider for ODBC Drivers erro '80004005' 

[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified 

/admentor/include/admentordb.asp, line 44 

Por favor... mais uma vez eu encho seu saco e peço para me ajudar...

#7 otavio

otavio

    http://www.cursosvirtuais.net

  • Usuários
  • 443 posts
  • Sexo:Não informado

Posted 28/01/2003, 18:52

pesso q poste o codigo do arquivo: /admentor/include/admentordb.asp

Abraços,
t+
/////////////////////////////////////////////

http://www.cursosvirtuais.net/

#8 malagoli

malagoli
  • Visitantes

Posted 29/01/2003, 07:43

:(abaixo está o código... mas tem nos posts de cima também...

<!--#include file="admentorconfig.asp"-->
<!--#include file="adovbs.inc"-->
<%

'''''''''''  (C) Stefan Holmberg 1999  
'''''''''''  Free to use if these sourcecode lines is not deleted 
'''''''''''  Contact me at webmaster@sqlexperts.com
'''''''''''  [url=http://www.sqlexperts.com]http://www.sqlexperts.com[/url]
'''''''''''  AdMentor homepage at [url=http://www.create-a-webshop.com]http://www.create-a-webshop.com[/url]

' Version 1.11 contains contribution from Shawn Willmon - traceclicks code

Function Internal_AdMentordb_GetDateFunction()
	If g_AdMentor_DatabaseType = "SQLServer" Then
  Internal_AdMentordb_GetDateFunction = "getdate()"
	Else
  Internal_AdMentordb_GetDateFunction = "date()"
	End If
End Function

Function Internal_AdMentordb_GetBoolValue( fTrue )
	If g_AdMentor_DatabaseType = "SQLServer" Then
  If fTrue = True Then
 	 Internal_AdMentordb_GetBoolValue = "1"
  Else
 	 Internal_AdMentordb_GetBoolValue = "0"
  End If 	 
	Else
  If fTrue = true Then
 	 Internal_AdMentordb_GetBoolValue = "true"
  Else
 	 Internal_AdMentordb_GetBoolValue = "false"
  End If	
	End If
	
End Function



Function AdMentor_DBOpenConnection()
    Dim oConn
      
   	 Set oConn = Server.CreateObject("ADODB.Connection")
   	 oConn.Open g_AdMentor_strConnect
  Set AdMentor_DBOpenConnection = oConn
End Function

Function AdMentor_DBGetBannersInFarm( oConn, nBannerFarm )
  Dim oRS
    Set oRS = CreateObject("ADODB.Recordset")
    oRS.CursorLocation = adUseClient
    oRS.MaxRecords = g_AdMentor_MaxRecords
    oRS.CacheSize = g_AdMentor_MaxRecords
    oRS.CursorType = adOpenForwardOnly
	oRS.Open "select bannerid, gifurl, weight, alttext, undertext, xsize, ysize from banner  where farmid=" & nBannerFarm & " and weight > 0 and showcount < maximpressions AND clickcount+underclickcount < maxclicks AND validtodate >= " & Internal_AdMentordb_GetDateFunction() & " AND validfromdate <= " & Internal_AdMentordb_GetDateFunction(), oConn
    
    Set oRS.ActiveConnection = Nothing
    Set  AdMentor_DBGetBannersInFarm = oRS
End Function

Sub AdMentor_DBAddShowCount( oConn, nBanner )
	oConn.Execute "update banner set showcount=showcount+1 where bannerid=" & nBanner
End Sub 


Sub AdMentor_DBUpdateClickCount( oConn, nBanner, fUnderText )
	Dim sSQL
	Dim oRSTC

	If fUnderText = True Then
  sSQL = "update banner set underclickcount = underclickcount +1 where bannerid = " & nBanner
	Else
  sSQL = "update banner set clickcount = clickcount +1 where bannerid = " & nBanner
	End if
	oConn.Execute ( sSQL )

	Set oRSTC = Server.CreateObject("ADODB.Recordset")
	Set oRSTC.ActiveConnection = oConn
	oRSTC.Open "select * from traceclicks where bannerid = -1 ", ,adOpenKeyset,adLockOptimistic
	oRSTC.AddNew()
	oRSTC("bannerid")=nBanner
	oRSTC("page")=Request.ServerVariables("HTTP_REFERER")
	oRSTC("dt") = now()
	oRSTC("ip")=Request.ServerVariables( "REMOTE_ADDR" )
	oRSTC("undertext")=fUndertext
	oRSTC.Update
	oRSTC.Close
        Set oRSTC = Nothing
End Sub

Function  AdMentor_DBGetUrl( oConn, nBanner, fUnderText )   	 
	Dim oRS
	Dim sSQL2

	If fUnderText = True Then
        sSQL2 = "select underurl as url from banner where bannerid= " & nBanner
	Else
        sSQL2 = "select redirurl as url from banner where bannerid= " & nBanner
	End if
	
	Set oRS = oConn.Execute ( sSQL2 )
	AdMentor_DBGetUrl = oRS("url").Value
	oRS.Close
	Set oRS = Nothing
End Function









Function AdSQL_AddAndWhere( strWhere, strWhat )
	If strWhere = "" Then
  strWhere = " WHERE "
	Else
  strWhere = strWhere & " AND "
	End If
	strWhere = strWhere & " " & strWhat
	AdSQL_AddAndWhere = strWhere
End Function



Function AdMentor_DBGetAvailBanners( oConn, fASP, strZones, nFarm, nBannerId, fCanUseHTML  )
  Dim oRS
    Set oRS = CreateObject("ADODB.Recordset")
    oRS.CursorLocation = adUseClient
    oRS.MaxRecords = g_AdMentor_MaxRecords
    oRS.CacheSize = g_AdMentor_MaxRecords
    oRS.CursorType = adOpenStatic
    oRS.Open GetAdSQL(fASP, strZones, nFarm, nBannerId, fCanUseHTML ), oConn
    
    Set oRS.ActiveConnection = Nothing
    Set  AdMentor_DBGetAvailBanners = oRS
End Function

Function AdMentor_GetHTMLCode( oConn, nBannerId )
  Dim oRS
    Set oRS = CreateObject("ADODB.Recordset")
    oRS.CursorLocation = adUseClient
    oRS.MaxRecords = 1
    oRS.CacheSize = 1
    oRS.CursorType = adOpenForwardOnly
    oRS.Open "select htmlcode from banner where bannerid="&nBannerId, oConn
    AdMentor_GetHTMLCode = oRS("htmlcode").Value
    
    oRS.Close
    Set oRS = Nothing  
End Function


Function GetAdSQL( fASP, sZone, nFarm, nBannerId, fCanUseHTML  )
	Dim strSQL
	Dim strWhere
	
	strSQL =  "select distinct banner.bannerid, banner.gifurl, banner.weight " 
	If fASP Then
  strSQL = strSQL & ", banner.AltText, banner.UnderText, banner.xsize, banner.ysize "
	End If
	If fCanUseHTML Then
  strSQL = strSQL & ",ishtml"
	End If
	
	If  strAdmentor_strAlreadyOnPage <> "" Then
  strWhere = AdSQL_AddAndWhere( strWhere, "banner.bannerid not in ( " &  strAdmentor_strAlreadyOnPage & ")" )
	End If
	
	strSQL = strSQL & " from banner "
	If sZone <> "0" Then
 	 strSQL = strSQL & ",banzone "
 	 strWhere = AdSQL_AddAndWhere( strWhere, "banner.bannerid=banzone.bannerid" )
 	 strWhere = AdSQL_AddAndWhere( strWhere, "banzone.zoneid in ( " & sZone & ")" )
	End If	
	
	
	If nBannerId <> "" Then
  strWhere = AdSQL_AddAndWhere( strWhere, "banner.bannerid=" & nBannerId )
	Else
  If nFarm <> 0 Then
 	 strWhere = AdSQL_AddAndWhere( strWhere, "banner.farmid=" & nFarm )
  End If
  strWhere = AdSQL_AddAndWhere( strWhere, "weight > 0 and showcount < maximpressions AND validtodate >= " & Internal_AdMentordb_GetDateFunction() & " AND validfromdate <= " & Internal_AdMentordb_GetDateFunction() )
  If fCanUseHTML = True Then
 	 strWhere = AdSQL_AddAndWhere( strWhere, " ( ( clickcount+underclickcount < maxclicks ) OR ishtml=" & Internal_AdMentordb_GetBoolValue(true) & " )"  )
  Else
 	 strWhere = AdSQL_AddAndWhere( strWhere, "ishtml <> " & Internal_AdMentordb_GetBoolValue(true)  )
  End If
	End If
	
	
	strSQL = strSQL & strWhere
	

' If you want banners with no zoning to mean all zones then add these 
' lines

'	If sZone <> "0" Then
' 	 strSQL = strSQL & "union select  distinct banner.bannerid, banner.gifurl, banner.weight "
'  If fASP Then
' 	 strSQL = strSQL & ", banner.AltText, banner.UnderText, banner.xsize, banner.ysize "
'  End If
'  If fCanUseHTML Then
' 	 strSQL = strSQL & ",ishtml"
'  End If
'  strSQL = strSQL & " from banner "
'  strSQL = strSQL & " where bannerid not in (select bannerid from banzone)"
'  If  strAdmentor_strAlreadyOnPage <> "" Then
' 	 strSQL = strSQL & " AND banner.bannerid not in ( " &  strAdmentor_strAlreadyOnPage & ")" 
'  End If
'	End If	


	GetAdSQL = strSQL
	
End Function



%>


:( xxxxx cara... já tô até envergonhado... se quiser desistir de me ajudar vou entender...

#9 malagoli

malagoli
  • Visitantes

Posted 29/01/2003, 09:11

Bom, o Admentor ainda dá a opção de um outro código... eu o coloquei este link: clique!, mas ele não funciona... não dá erro e fica parado... sem aparecer banner algum... esse pode ser uma outra saída... que você acha?

O código é esse:

<!------- AdMentor Ad code ------------->
<script language="JavaScript"> var code = '';
var now = new Date();
var nIndex = now.getTime();
document.write('<s' + 'cript src="http://www.rodrigomalagoli.com/admentor/scriptinject.asp?F=6&Z=13&N=1&nocache=' + nIndex + '">');
document.write('</' + 's' + 'cript>');
</script>
<script language="JavaScript">document.write(code);</script>
<noscript><a href="http://www.rodrigomalagoli.com/admentor/adclick.asp?F=6&Z=13&N=1">
<img border="0" src="http://www.rodrigomalagoli.com/admentor/adserve.asp?F=6&Z=13&N=1"></a></noscript>
<!--------- End AdMentor Ad code --------------->

Mas isso leva à uma outra questão... será que configurei o Admentor corretamente? Será que você poderia entrar e dar uma olhada?

o endereço para login é este, o id é rodrigo e a senha 123456

Obrigado mais uma vez... :D

#10 otavio

otavio

    http://www.cursosvirtuais.net

  • Usuários
  • 443 posts
  • Sexo:Não informado

Posted 29/01/2003, 09:16

kra...
eu nunca trabalhei com o admentor..
mas o seguinte:

Microsoft OLE DB Provider for ODBC Drivers erro '80004005'

[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

/admentor/include/admentordb.asp, line 44


quer dizer que o BANCO DE DADOS NAO FOI ENCONTRADO OU NAO TEM INSTALADO O DRIVER DO ACCESS...
o que quer dizer isso:

VERIFIQUE o arquivo em que se faz a conexao com o banco de dados, COM CERTEZA ELE ESTA ERRADO!

Abraços,
t+
/////////////////////////////////////////////

http://www.cursosvirtuais.net/

#11 malagoli

malagoli
  • Visitantes

Posted 31/01/2003, 12:11

obrigado assim mesmo... :)

#12 julianojc

julianojc
  • Visitantes

Posted 24/08/2003, 19:42

Olá amigo,
Quase morri de rir de ver seu drama com o AdMentor, quando vc dizia q vc era uma anta mesmo por ter voltado ao erro inicial... achei muito engraçado...

Agora, eu tambem estou tendo o mesmo erro e gostaria de saber se vc conseguiu resolver.

Estou com um outro erro tambem, como fazer para as páginas dos banners abrir em blank, ou seja, em uma nova página?

T ++++
Juliano.
julianocunha@bol.com.br

#13 Operador

Operador

    12 Horas

  • Usuários
  • 228 posts
  • Sexo:Masculino
  • Localidade:Picos - PI

Posted 09/05/2005, 22:05

Amigo é o seguinte para rodar beleza basta vc colocar assim:

Coloque isso no inicio da página, no topo....

<!--#include virtual="/admentor/include/admentor2.asp"-->


E o código abaixo na parte que vc quer que apareça o banner

<%=AdMentor_GetAdASP("F=4&Z=7&N=1")%>


Espero que tenha ajudado...
----------------------------------------------------------------------------
Não sei assinar... ehehehe
----------------------------------------------------------------------------




0 user(s) are reading this topic

0 membro(s), 0 visitante(s) e 0 membros anônimo(s)

IPB Skin By Virteq