PDA

View Full Version : script / program to check for ad codes



Squad-Host.com
March 21st, 2009, 13:54
Well i am wondering if there is any scripts / programs out there that will check for ad codes on the sites that i host, i don't want one to force teh ads, just want one that will tell me what users are not placing the ads on site, and what not. does any thing like this exists, i once used a free host that had something like this.

GlennBeforeTime
March 22nd, 2009, 21:18
You can always get a script made in PHP which loads up the page's HTML and searches for your ad code.

TSO
March 22nd, 2009, 21:55
Glenn, would that be very hard to do?

Would anyone here be willing to create something like that (for pay, of course)?

GlennBeforeTime
March 22nd, 2009, 23:56
Not really. It could be quite simple using an Explode code.



<?php
$adcode="<a href=linkto>linkto, the best ad in the world</a>";
$f = fopen("http://website.com/", 'r');
$fr = fread($f, "30000"); //Read 29 KB of the website.
$x = explode($addcode,$fr);
if(count($x) >= 2){
//There is at least 1 instance of the add code within the website.
}
?>

It's a little basic and not terribly effective, there'd need to be a !eof loop to read the whole site, if you wanted to scan every page on a website, that would kill your server load and would require a much more sophisticated script then that being presented.

This script is basic, yet sophisticated enough to search through the first 29KB of a website and look for the add code, then return with an IF statement to do what you want. It can be modded to do a wee bit more but meh, I just wrote this as I was typing.

The presented script has not been tested

~ServerPoint~
March 23rd, 2009, 03:15
Well i am wondering if there is any scripts / programs out there that will check for ad codes on the sites that i host, i don't want one to force teh ads, just want one that will tell me what users are not placing the ads on site, and what not. does any thing like this exists, i once used a free host that had something like this.
Why don't forbid users to do so. I mean leave no ability to do so?

GlennBeforeTime
March 23rd, 2009, 05:07
Why don't forbid users to do so. I mean leave no ability to do so?

Perhaps OP wants to reward those who display ads but runs a non compulsory ads hosting service.

JonnyH
March 23rd, 2009, 10:10
This would be a good way to build a ads system that doesn't use root to force ads. Willingly let the user put the code where they want and the script checks it every month say.

DevGFX
March 23rd, 2009, 21:53
When I provided free hosting with ads, I just send e-mail's to all my clients saying accounts will be terminated within 24 hours if ads are not placed on every page.

It worked 90% of the time :D