- Readme First! - Read and follow the rules, otherwise your posts will be closed
There are currently, 55 guest(s) and 1 member(s) that are online. You are Anonymous user. You can register for free by clicking here
Nuke Cops :: View topic - List only unique http referrers [ ]
Author
Message
Prophet
Captain
Joined: Mar 14, 2004
Posts: 422
Location: Florida, USA, Earth, Space
Posted:
Sat Oct 02, 2004 3:50 pm
Open index.php in the root Nuke directory.
Around lines 25 through 36 find the following...
Code:
if ($httpref==1) {
$referer = $_SERVER["HTTP_REFERER"];
$referer = check_html($referer, nohtml);
if ($referer=="" OR eregi("^unknown", $referer) OR substr("$referer",0,strlen($nukeurl))==$nukeurl OR eregi("^bookmark",$referer)) {
} else {
$result = $db->sql_query("INSERT INTO ".$prefix."_referer VALUES (NULL, '$referer')");
}
$numrows = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_referer"));
if($numrows>=$httprefmax) {
$result2 = $db->sql_query("DELETE FROM ".$prefix."_referer");
}
}
Replace with the following...
Code:
if ($httpref==1) {
$url = $_SERVER["HTTP_REFERER"];
$url = check_html($url, nohtml);
if ($url=="" OR eregi("^unknown", $url) OR substr("$url",0,strlen($nukeurl))==$nukeurl OR eregi("^bookmark",$url)) {
echo "";
} elseif ($db->sql_numrows($db->sql_query("SELECT url FROM ".$prefix."_referer WHERE url='$url'")) > 0) {
echo "";
} else {
$result = $db->sql_query("INSERT INTO ".$prefix."_referer VALUES (NULL, '$url')");
}
$numrows = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_referer"));
if($numrows>=$httprefmax) {
$result2 = $db->sql_query("DELETE FROM ".$prefix."_referer");
}
}
This will stop duplicate referrers from being stored in the database.
_________________ - Prophet
Get the Last Visit module (and others modules I designed) from my website! FREE! http://jasonlau.biz
Media Embedding
Mesum
Support Staff
Joined: Mar 11, 2003
Posts: 842
Location: Chicago
Posted:
Sat Oct 02, 2004 5:12 pm
Prophet
Captain
Joined: Mar 14, 2004
Posts: 422
Location: Florida, USA, Earth, Space
Posted:
Sat Oct 02, 2004 7:20 pm
I forgot to mention to NOT use this code if you use a block or module that lists top referrers.
_________________ - Prophet
Get the Last Visit module (and others modules I designed) from my website! FREE! http://jasonlau.biz
Media Embedding
Mesum
Support Staff
Joined: Mar 11, 2003
Posts: 842
Location: Chicago
Posted:
Sat Oct 02, 2004 7:50 pm
Prophet
Captain
Joined: Mar 14, 2004
Posts: 422
Location: Florida, USA, Earth, Space
Posted:
Sat Oct 02, 2004 8:17 pm
If MSA uses it's own database and does not share data with the nuke_referer table then it shouldn't be affected.
Any module or block that shares data from the nuke_referer table is affected by this modification.
I don't use any other blocks/modules that use that table, other than the http referers admin module. I don't know about you, but I get tired of wading through the redundant urls.
_________________ - Prophet
Get the Last Visit module (and others modules I designed) from my website! FREE! http://jasonlau.biz
Media Embedding
jib_intelli
Captain
Joined: Jun 10, 2004
Posts: 338
Location: Lucknow, India
Posted:
Fri Mar 04, 2005 7:23 am
Does this work with PHPNuke 7.6?
_________________ It is not our abilities which decide what we truly are, it is our choices.
Prophet
Captain
Joined: Mar 14, 2004
Posts: 422
Location: Florida, USA, Earth, Space
Posted:
Fri Mar 04, 2005 2:24 pm
Yes, I believe it will work for PHP-Nuke Version 7.6.
_________________ - Prophet
Get the Last Visit module (and others modules I designed) from my website! FREE! http://jasonlau.biz
Media Embedding
Luciel
Sergeant
Joined: Aug 28, 2004
Posts: 119
Posted:
Mon Mar 14, 2005 7:53 am
I was looking in my index.php (nuke 7.5) and its kinda different:
if ($httpref==1) {
$referer = $_SERVER["HTTP_REFERER"];
$referer = check_html($referer, nohtml);
if ($referer=="" OR eregi("^unknown", $referer) OR substr("$referer",0,strlen($nukeurl))==$nukeurl OR eregi("^bookmark",$referer)) {
} else {
$sql = "INSERT INTO ".$prefix."_referer VALUES (NULL, '$referer')";
$result = $db->sql_query($sql);
}
$sql = "SELECT * FROM ".$prefix."_referer";
$result = $db->sql_query($sql);
$numrows = $db->sql_numrows($result);
if($numrows>=$httprefmax) {
$sql = "DELETE FROM ".$prefix."_referer";
$result = $db->sql_query($sql);
}
}
Any suggestions?
Prophet
Captain
Joined: Mar 14, 2004
Posts: 422
Location: Florida, USA, Earth, Space
Posted:
Mon Mar 14, 2005 12:54 pm
Luciel wrote:
I was looking in my index.php (nuke 7.5) and its kinda different:
Any suggestions?
You can replace it with the code I previously posted.
_________________ - Prophet
Get the Last Visit module (and others modules I designed) from my website! FREE! http://jasonlau.biz
Media Embedding
Luciel
Sergeant
Joined: Aug 28, 2004
Posts: 119
Posted:
Tue Mar 15, 2005 1:16 am
kk, ill do it later today and post the result
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum