Peruttu

Referer Script

Hello, i got a code from [url][url removed, login to view][/url] wich i need to get modified to my needs

first the code

[PHP]<?php

require('[url removed, login to view]');

// Find out or base pure referer.

$ref = $_SERVER['HTTP_REFERER'];

// Split our URL into bits.

$url = explode("/",$ref);

// Take the 3rd part of the url (the main site)

$surl = $url[2];

// Check to see if it contains the www. at the begining

$found = ereg('\www.',$surl);

if ($found) {

$url = $surl;

} else {

$url = 'www.'.$surl;

}

$query = "SELECT website, hits FROM referers WHERE website = '$url'";

$result = mysql_query($query);

$num = mysql_num_rows($result);

if ($num == 1) {

$site = mysql_fetch_array($result, MYSQL_ASSOC);

if ($site['website'] != 'www.') {

if ($site['website'] != '[url removed, login to view]') {

$hits = $site['hits'] + 1;

$website = $site['website'];

$query = "UPDATE referers SET hits = $hits WHERE website = '$website'";

$result = mysql_query($query);

}

}

} else {

if (!empty($surl)) {

$query = "INSERT INTO referers (website, hits) VALUES ('$url', '1')";

$result = mysql_query($query);

}

}

$query = "SELECT * FROM referers ORDER BY hits DESC LIMIT 10"; // Change the limit to the top XX that you want to show.

$result = mysql_query($query);

while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {

echo '<a href="http://'.$row['website'].'">'.$row['website'].'</a> - <b>'.$row['hits'].'</b><br />';

}

?>

[/PHP]

what i need is the following:

instead of displaying just the [url removed, login to view] referer info i want [url removed, login to view] also if the referer is [url removed, login to view] i want it to display as [url removed, login to view]

the referrer url must already exist on the database, or else it will get ignored, which brings me to the next point, add a referer manually using a text field.

and last but not least, i need unique hits?

thank you!

Phil

Taidot: PHP

Näytä lisää: referer script, php referer script, referers script, top referer script, top query, set bits, referer url php, just the begining, get site hits, get hits on website, get hits on my website, 1 bits, php top referer script, php referers referer, display referrer script, modify referer script, query select website hits referers website url, script display referer, php display referer text, what is a subfolder, row b, Phil, order split, desc, referers

About the Employer:
( 0 reviews ) Oslo, Norway

Projektin tunnus: #394014