I had this working ok. It still works on a Win95 system but on win2k it is getting program errors every time this script runs - stays up but takes a dump every time with a Program Error box saying error log being created.
The script is used to log the page and document.referrer (from javascript - I don't see this in php docs so did what I knew) then xfer from the portal page to the real site entry page.
I've left out the db functions. The script is also used as a dummy image for page counting but fails in either role. Strangely the data is all logged ok.
Script extract ==>
// Get any parameters passed
$mgsub = trim($mgsub);
if ($mgsub == "advertise") $mgsub = "?content=advertise";
if ($mgsub == "freeads") $mgsub = "?content=freeads";
if ($mgsub == "sites") $mgsub = "?content=sites";
if ($mgsub == "vans") $mgsub = "?content=vans";
if ($mgsub == "gps") $mgsub = "?content=gps";
$mgloc = trim($mgloc).$mgsub;
$ref = trim($ref);
$page = trim($page);
// Do any updates
if (($page) or ($ref)) $link = do_connect();
if ($page)
{
$doit = upd_page($page);
$doit = upd_tots('page');
$doit = log_page($page);
}
if ($ref)
{
$doit = upd_referrer($ref);
$doit = upd_tots('ref');
}
mysql_close($link);
if ($mgloc) header ("Location: $mgloc");
else header ("Location: ../images/spacer.gif");
exit;