Shawn, just wondering, what is that txt file for? I see it stores all the links but why? Hope you can take some time to explain if you don't mind thanks
It's a cache file so you don't have to get the links off digitalpoint.com for each and every pageview on your site.
The ads server sends you a timeout (I think it might be 30 min. right now, but Shawn can change that dynamically depending on server load) and whenever that time period passes, the code retrieves a new ad from the server, saves it in the cache file and dumps the oldest ad from the file.
thank exam. there're tags like <id>32547<ad_break> how would a server know which page is it? They're saved after a visitor clicks on the ad, so does the server store all links and then assigns a number to each one or somehting like that..?
As others have said, the .txt file stores settings (which can be set on the server's end if needed). The "id" tags have nothing to do with what page an ad is displayed on, that's the internal system ID for the ad (for tracking impressions). As far as how it knows what ad to display on what page (if you are running static ads), I'm a mother f'ing genius and came up with a way to do it without needing to store a file that cross references every page/ad. This is the "magic" line of code that does it (from ad_network PHP file): $ads_next = (hexdec(substr(md5($_SERVER['SERVER_NAME'] . $_SERVER['SCRIPT_NAME'] . $_SERVER['PATH_INFO'] . $_SERVER['QUERY_STRING']), 0, 6)) % (count($ads) - 1 - $ads_x)) + 1; PHP:
thanks Shawn, nice idea, I thought about hash, but didn't know how to implement it. PS. Can I take the master of the universe title if it's not in use now? ADDED: another little question then Shawn, the txt file probable contains just a part of the database, so is it so and how is it selected? Or does it contain it all? And how frequently is it updated? thanks
thanks, Shawn, last little question, why should it be on every page of the site. As I see it, it may still work if it's not on every page, cause the hash function and the formula doesn't depend on the number of pages, but only on the number of links..? thanks