PDA

View Full Version : Stop the blank page problem


tigerincanada
23rd June 2006, 05:40 AM
Problem: If an affiliate screws up a banner ID, or is still using an out-of-date banner ID, or an invalid affiliate ID, /scripts/t.php returns a blank page.

Solution: Add one line at the top of the script to ensure that the visitor is always redirected to the main site even if there is a problem recording the click. If the click is recorded, PHP overwrites this header with the correct destination URL.


require_once('global.php');

// This 302 redirect is sent to the browser if any step throws an error.
header('Location: '.$GLOBALS['Auth']->getSetting('Aff_main_site_url'));



I've used a 302 because it is possible that the affiliate manager will later fix the problem and thus the same URL might then go to a different landing page.