Search code examples
phpmysqlhyperlinkfopenexecute

PHP Executes File Twice When Link Is Clicked


I'm having a weird issue on my site. Whenever a link is clicked the file is being executed twice. The only reason that I noticed this was because when I would submit a search request for keywords, I log the search in our MySQL database. The database was always saving two records (there was a time stamp and the records were added sometimes in the same second, but usually only a second apart). I knew that I was the only one on the site and that the query wasn't getting called in a loop. So I did a fopen($file, 'a') to see how many lines of code would be added and there were most of the time two lines of code added. The only way that I could get one record to add was if I ran the same search 2-3 times in a row.

So the only thing I can think of is that we have goodle ads on our site. the only thing I can imagine that's happening is that when I click the link, the javascript that's tied to the ad also follows the same link.

Any other brilliant ideas?


Solution

  • Should I be scared?

    I commented out the code for google ads as soon as I wrote this post (and saw @cillosis suggested).

    I don't have the problem anymore. It totally was Google though. This was in my apache access log every time I'd run a search.

    66.249.73.87 - - [16/May/2012:12:38:45 -0500] "GET /search.php?page_num=1&keywords=stylist&city=&state=AL&cat= HTTP/1.1" 200 14185 "-" "Mediapartners-Google"
    

    I'm scared.....