School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become an Expert!

Join 300,413 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,601 people online right now. Registration is fast and FREE... Join Now!




Problem with google adsense and coldfusion counter.

 

Problem with google adsense and coldfusion counter.

pirula

10 May, 2009 - 06:17 AM
Post #1

New D.I.C Head
*

Joined: 26 Apr, 2009
Posts: 20



Thanked: 1 times
My Contributions
Hi can anyone please help me I am pretty much stuck.

I want to add coldfusion counter on page , simple or advanced i can type whatever I want, that is not an issue. I tried i think 7-10 different types(I made all of them) of Coldfusion counter and something is wrong, my cfm counter is messy. I am sure that any of this code should work. Problem is in google adsense. When I delete google adsense from that page any code i type work fine. Can anyone please help me with my problem.

this is code i am using now(I tried a few different code for update(count) on this page and then i decided to try with cfhttp...):

CODE
<cfparam name="URL.idscripts" default="1" type="Any">
<cfset count = 1*1>
<cfhttp method="Post"
    url="http://counter.cfm">
       <cfhttpparam type="URL"
        value="#URL.idscripts#"
        name="ID">
        
      <cfhttpparam type="URL"
        value="#count#"
        name="count">    
</cfhttp>



page that counts:

CODE

<cfparam name="URL.ID" default="14" type="Any">
<cfparam name="URL.count" default="1" type="Any">

<cfset element = #URL.ID#>
<cfset rate = #URL.count#>
// get total votes and current rate
<cfquery datasource="" name="getTotalVotes">
SELECT total_votes, total_value, post_rate
FROM scripts
WHERE idscripts = #element#
</cfquery>
// calculate new rate
<cfset newRate = (#getTotalVotes.total_value# + #rate#)/(#getTotalVotes.total_votes# + 1)>
// update rate
<cfquery datasource="" name="updateRate">
UPDATE scripts
SET post_rate = #newRate#,
total_value= (#getTotalVotes.total_value#+#rate#),
total_votes= (#getTotalVotes.total_votes# + 1)
WHERE idscripts = #element#
</cfquery>


i repeat: When I delete google commercial any code works fine .
Help please.

User is offlineProfile CardPM
+Quote Post


pirula

RE: Problem With Google Adsense And Coldfusion Counter.

13 May, 2009 - 05:10 AM
Post #2

New D.I.C Head
*

Joined: 26 Apr, 2009
Posts: 20



Thanked: 1 times
My Contributions
I also tried to post simple counter on some page:

CODE

<cfquery name="dcounter" datasource="datasource">
UPDATE counter
SET count = count + 1
WHERE ID = "#URL.ID#"
</cfquery>


This is the simplest method for counter and should work. On my pages is messy and i do not know why. When i delete google commercials work just fine. I also tried to set MySLQ field as varchar and integer and again same counter is messy. Please any ideas?

This post has been edited by pirula: 13 May, 2009 - 05:21 AM
User is offlineProfile CardPM
+Quote Post

pirula

RE: Problem With Google Adsense And Coldfusion Counter.

13 May, 2009 - 02:56 PM
Post #3

New D.I.C Head
*

Joined: 26 Apr, 2009
Posts: 20



Thanked: 1 times
My Contributions
I find a solution:
your field in MySQL should be integer.

page one:(on this page you click on link that goes first to count.cfm and then code will redirect you to show.cfm)
link pageone.cfm(example):
count.cfm?ID=#download.ID#


count.cfm
CODE

<cfparam name="URL.ID" default="1">

  
       <cfquery name="updateHits" datasource="yourdatasource" >
          UPDATE download
          SET TOTALDOWNLOADS = TOTALDOWNLOADS + 1
          WHERE ID = <cfqueryparam value="#URL.ID#" cfsqltype="cf_sql_clob" maxlength="75">
      </cfquery>
      
      <cflocation  url="show.cfm?ID=#URL.ID#" addtoken="no">



and that work. If you have similar issue try this.

My question is about addtoken! I have cflocation tag on 2 places in my site
and addtoken is set to default (yes). Here i set to no and i am not passing cftoken and cfid with URL, everything is working fine and i can not feel difference. Should i set to yes or this is ok?

User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/7/09 11:16PM

Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month