Jump to content

[SOLVED] Help putting html into small php code


Padgoi

Recommended Posts

Ok, so I have this php code that tracks external referrals:

 

<?

$domain = 'YourDomain.com';
$file = "referral_tracker.html";

$ref = $_SERVER['HTTP_REFERER'];

$thisDomain = strpos($ref, $domain);

if ($thisDomain === false) {
if ($ref == '') {
$ref = 'UnknownLocation';
}
$saveRef = true;
} else {
$saveRef = false;
}

if ($saveRef == true) {

$to = $ref;

$fp = fopen($file, "r");
$gf = fread($fp, filesize($file));
fclose ($fp);

$arr = explode("<br />", $gf);
$n = "";

foreach ($arr as $line) {
$line = trim($line);

if ($line != "") {
$sub = explode(" ", $line);

if ($to == $sub[0]) {
$tracked = true;
$sub[1]++;
}
$n .= $sub[0] . " " . $sub[1] . "<br />";
}
}

if ($tracked != true) {
$n .= $to . " 1<br />";
}

$fp = fopen($file, "w");
fputs($fp, $n, strlen($n));
fclose($fp);

}
?>

 

I want to put this html into the script so that it looks organized:

 

<div style='border: 3px dotted #0af; font-family: Tahoma; padding: 20px; padding-top: 0; font-size: 12px; background-color: #fafafa; margin: 50px;'><p><h2>REFERERERS (NEWEST FIRST)</h2></p>

 

I tried putting that into the referral_tracker.html file but whenever a new referral is added, the div style information is reset.  Can anyone help me with this, I would be very appreciative.  Thanks in advance.

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.