tigerincanada
6th July 2006, 05:54 AM
This is a mod for /scripts/sb.php to ensure that a banner impression always returns a real image if the affiliate or banner isn't found, and when tracking impressions for text ads.
...
// Use an output buffer to detect whether or not we have found an image
ob_start();
$bannerViewer = QUnit_Global::newObj('Affiliate_Scripts_Bl_BannerV iewer');
$bannerViewer->setExtraData($data1);
// check if this affiliate and banner exist
// IMPORTANT! we have to check for affiliate first
if(!$bannerViewer->checkUserExists($affiliateID))
{
$errorMsg = "Show banner: Affiliate with ID '$affiliateID' doesn't exist";
LogError($errorMsg, __FILE__, __LINE__);
}
elseif(!$bannerViewer->checkBannerExists($bannerID))
{
$errorMsg = "Show banner: Banner with ID '$bannerID' doesn't exist";
LogError($errorMsg, __FILE__, __LINE__);
}
else
{
// redirect to destination page
$bannerViewer->redirect();
}
// If there isn't an image in the buffer yet, send the blank GIF
if(ob_get_length() < 1) {
header("content-type: image/gif");
@readfile("blank.gif");
}
...
// Use an output buffer to detect whether or not we have found an image
ob_start();
$bannerViewer = QUnit_Global::newObj('Affiliate_Scripts_Bl_BannerV iewer');
$bannerViewer->setExtraData($data1);
// check if this affiliate and banner exist
// IMPORTANT! we have to check for affiliate first
if(!$bannerViewer->checkUserExists($affiliateID))
{
$errorMsg = "Show banner: Affiliate with ID '$affiliateID' doesn't exist";
LogError($errorMsg, __FILE__, __LINE__);
}
elseif(!$bannerViewer->checkBannerExists($bannerID))
{
$errorMsg = "Show banner: Banner with ID '$bannerID' doesn't exist";
LogError($errorMsg, __FILE__, __LINE__);
}
else
{
// redirect to destination page
$bannerViewer->redirect();
}
// If there isn't an image in the buffer yet, send the blank GIF
if(ob_get_length() < 1) {
header("content-type: image/gif");
@readfile("blank.gif");
}