How to identify if Google Adsense code is submitted?

119 views Asked by At

​ How could I recognize or identify with PHP or Javascript if a submitted code is equals to a Google Adsense code?

For example, I submit several javascript codes onto my website through a form, and the program should recognize when I submit a Google Adsense Code. How could it be possible? And I mean I submit any adsense code, the software would recognize it. Thanks for everyone in advance for any idea!

I'd like to solve the problem, but have no idea how to start.

Some ways I started thinking of (please do not read this before you have an idea, or it will confuse you)

I submit a code, and PHP checks if the code contains usual elements from the AdSense code. I realized this trial is bad, because a code can contain elements of the adsense code, but that can be expanded with unique elements, so the code still passes the check.

Another way I started thinking was to write a program that limits the input of a code, and the limitation is about the length of the adsense code, but I realized, that adsense code length changes from time to time.

Another way I was thinking of was to check manually whether it is adsense code submitted or not. Worst solution.

1

There are 1 answers

4
Tschallacka On BEST ANSWER

step 1. harvest all the javascript strings from the code sample.
step 2. merge all strings into one big string.
step 3. check for references to google adsense api or api key (UA-something-1 or so)
step 4. reverse the string
step 5. repeat step 3
step 6. mark as suspicious if found a suspicious match
step 7. human check for false positive