[BETA]Http Referrers 0.1.1

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
Maller
Registered User
Posts: 10
Joined: Wed Aug 10, 2005 2:44 pm

Post by Maller »

Is it possible that during your busy holiday you could find the time to fix your download link ?¿
User avatar
itsonlybarney
Registered User
Posts: 238
Joined: Sun Apr 10, 2005 5:06 am
Location: /home/Sydney/public_html
Contact:

Post by itsonlybarney »

Bicet wrote: Yep, but you must also consider, that it's August, and where I live, there are some day during the year, called Holidays...


sorry i didn't realise you were on holidays.....

i'm in full swing of study during august.....
Enjoy talking about trains?
Bicet
Registered User
Posts: 58
Joined: Mon Nov 15, 2004 6:52 am
Location: IperUranium
Contact:

Post by Bicet »

Maller wrote: Is it possible that during your busy holiday you could find the time to fix your download link ?¿


If I got enough time I will fix it. (anyway the link it's fixed, my hoster was attacked and the site went down)

@itsonlybarney
I've finished my exams on July, fortunately.
Latest Mods:
[ Lo-Fi Mod 1.0.0 rc1 | phpBB XS 2 ]
User avatar
beggers
Registered User
Posts: 1257
Joined: Fri Nov 23, 2001 8:19 pm
Location: Las Vegas
Contact:

Post by beggers »

Sorry, I am a little confused. Is there still some problem with this mod or is it working properly? Thanks.
Doe Ray Me
Registered User
Posts: 457
Joined: Mon Jun 16, 2003 5:25 am
Name: Ethan Shand

Post by Doe Ray Me »

beggers wrote: Sorry, I am a little confused. Is there still some problem with this mod or is it working properly? Thanks.


Working fine on my site

http://lyrical-warriors.rr7.co.uk/forum/referrers.php
Bicet
Registered User
Posts: 58
Joined: Mon Nov 15, 2004 6:52 am
Location: IperUranium
Contact:

Post by Bicet »

The mod is working fine at the moment, but I cannot develop it now, cause I'm on vacation, and after for one year I don't have any other holiday, that's all.
Latest Mods:
[ Lo-Fi Mod 1.0.0 rc1 | phpBB XS 2 ]
dakar
Registered User
Posts: 39
Joined: Thu Sep 16, 2004 8:41 pm

Post by dakar »

Great mod! Very clean and efficient running.

Just one simple question, how would it best be modified to add a rel="nofollow" to each URL displayed? I'd rather not have any outbound links to a bad neighborhood, and no real need to ban it via robots.txt, from google.

Obviously the line in referrers.php

Code: Select all

'URL' => '<a href="' . $row['referrer_url'] .'">' . $url_name . '</a>',
I'm just not 100% sure on what characters need to be escaped and what doesn't.
User avatar
*=Matt=*
Registered User
Posts: 389
Joined: Mon Dec 20, 2004 11:56 pm
Location: Oakdale, Wisconsin

Post by *=Matt=* »

This is a very nice mod but i didnt like on my site it would count referrers from a different page on my site like someone on the forums goes to the home page it would count that. Well after looking around i have made this part to the functions_referrers.php

Code: Select all

<?php
/***************************************************************************
 *                              referers.php
 *                       -------------------
 *   begin                : Mon Jul 11 2005
 *   copyright            : (C) 2005 The phpBB XS Group
 *   email                : bicet@gmail.com
 *
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 ***************************************************************************/
if ( !defined('IN_PHPBB') )
{
	die("Hacking attempt");
}

if ($_SERVER['HTTP_REFERER'] && !eregi($_SERVER['HTTP_HOST'] . $board_config['script_path'], $_SERVER['HTTP_REFERER']))
{
	$referrer_url = $_SERVER['HTTP_REFERER'];
	$referrer_host = str_replace ("http://", "", $referrer_url);
	$referrer_host = substr($referrer_host, 0, strpos($referrer_host, "/"));

	if  ( !($referrer_host=="$board_config['server_name']") )
	{
		$sql = "SELECT * FROM " . REFERRERS_TABLE . " 
			WHERE referrer_url = '$referrer_url'";
		if (!$result = $db->sql_query($sql))
		{
			message_die(GENERAL_ERROR, "Couldn't get referrers information", "", __LINE__, __FILE__, $sql);
		}
		$row = $db->sql_fetchrow($result);
		if (!$row)
		{
			$sql = "INSERT INTO " . REFERRERS_TABLE . " (referrer_host, referrer_url, referrer_ip, referrer_hits, referrer_firstvisit, referrer_lastvisit) 
				VALUES ('$referrer_host', '$referrer_url', '$user_ip', 1, '" . time() . "', '" . time() . "')";
				
			if (!$result = $db->sql_query($sql))
			{
				message_die(GENERAL_ERROR, "Couldn't insert new referrer", "", __LINE__, __FILE__, $sql);
			}
		}
		else 
		{
			$sql = "UPDATE " . REFERRERS_TABLE . " 
				SET referrer_hits = referrer_hits + 1, referrer_lastvisit = " . time() . ", referrer_ip = '$user_ip' 
				WHERE referrer_url='$referrer_url'"; 
				
			if (!$result = $db->sql_query($sql))
			{
				message_die(GENERAL_ERROR, "Couldn't update referrers information", "", __LINE__, __FILE__, $sql);
			}
		}
	}
}
?>

This well only count referrers out side your domain name

If you want to see mine you can go here http://www.glitchplay.com/stats/referrers/
dakar
Registered User
Posts: 39
Joined: Thu Sep 16, 2004 8:41 pm

Post by dakar »

Got it sorted,

change

Code: Select all

'URL' => '<a href="' . $row['referrer_url'] .'">' . $url_name . '</a>', 
to

Code: Select all

'URL' => '<a href="' . $row['referrer_url'] .'" rel="nofollow">' . $url_name . '</a>', 
Geez in 12 hours already caught half a dozen referrer spams from casinos and crap.
Dagon
Registered User
Posts: 422
Joined: Tue Jun 03, 2003 8:59 pm

Post by Dagon »

What I would really like to see is one link to delete the whole list. :)
Dagon
Registered User
Posts: 422
Joined: Tue Jun 03, 2003 8:59 pm

Post by Dagon »

Oh yea, I hate referrer spam. I unlinked all of the URLs for everyone but the admin instead of doing the nofollow.


FIND:

Code: Select all

		$url_name = ( strlen($row['referrer_url']) > 50 )?substr ($row['referrer_url'], 0, 50).'...' :$row['referrer_url'];// Cut Url name if it is longer than 50 chars
AFTER, ADD:

Code: Select all

    	if ( $userdata['user_level'] != ADMIN )
		{
				$referrer_address = $url_name;
		}
		else
		{
				$referrer_address = '<a href="' . $row['referrer_url'] .'">' . $url_name . '</a>';
		}
FIND:

Code: Select all

			'URL' => '<a href="' . $row['referrer_url'] .'">' . $url_name . '</a>',
REPLACE WITH:

Code: Select all

			'URL' => $referrer_address,
Dagon
Registered User
Posts: 422
Joined: Tue Jun 03, 2003 8:59 pm

Post by Dagon »

*=Matt=* wrote: This is a very nice mod but i didnt like on my site it would count referrers from a different page on my site like someone on the forums goes to the home page it would count that. Well after looking around i have made this part to the functions_referrers.php

Code: Select all

<?php
/***************************************************************************
 *                              referers.php
 *                       -------------------
 *   begin                : Mon Jul 11 2005
 *   copyright            : (C) 2005 The phpBB XS Group
 *   email                : bicet@gmail.com
 *
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 ***************************************************************************/
if ( !defined('IN_PHPBB') )
{
	die("Hacking attempt");
}

if ($_SERVER['HTTP_REFERER'] && !eregi($_SERVER['HTTP_HOST'] . $board_config['script_path'], $_SERVER['HTTP_REFERER']))
{
	$referrer_url = $_SERVER['HTTP_REFERER'];
	$referrer_host = str_replace ("http://", "", $referrer_url);
	$referrer_host = substr($referrer_host, 0, strpos($referrer_host, "/"));

	if  ( !($referrer_host=="$board_config['server_name']") )
	{
		$sql = "SELECT * FROM " . REFERRERS_TABLE . " 
			WHERE referrer_url = '$referrer_url'";
		if (!$result = $db->sql_query($sql))
		{
			message_die(GENERAL_ERROR, "Couldn't get referrers information", "", __LINE__, __FILE__, $sql);
		}
		$row = $db->sql_fetchrow($result);
		if (!$row)
		{
			$sql = "INSERT INTO " . REFERRERS_TABLE . " (referrer_host, referrer_url, referrer_ip, referrer_hits, referrer_firstvisit, referrer_lastvisit) 
				VALUES ('$referrer_host', '$referrer_url', '$user_ip', 1, '" . time() . "', '" . time() . "')";
				
			if (!$result = $db->sql_query($sql))
			{
				message_die(GENERAL_ERROR, "Couldn't insert new referrer", "", __LINE__, __FILE__, $sql);
			}
		}
		else 
		{
			$sql = "UPDATE " . REFERRERS_TABLE . " 
				SET referrer_hits = referrer_hits + 1, referrer_lastvisit = " . time() . ", referrer_ip = '$user_ip' 
				WHERE referrer_url='$referrer_url'"; 
				
			if (!$result = $db->sql_query($sql))
			{
				message_die(GENERAL_ERROR, "Couldn't update referrers information", "", __LINE__, __FILE__, $sql);
			}
		}
	}
}
?>

This well only count referrers out side your domain name

If you want to see mine you can go here http://www.glitchplay.com/stats/referrers/


Your code give me this error: Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/domain/public_html/includes/functions_referrers.php on line 31
User avatar
*=Matt=*
Registered User
Posts: 389
Joined: Mon Dec 20, 2004 11:56 pm
Location: Oakdale, Wisconsin

Post by *=Matt=* »

Sorry for teh wait... But yeah i see my mistake. here is a good code that i have tryed and tested.

Code: Select all

<?php
/***************************************************************************
 *                              referers.php
 *                       -------------------
 *   begin                : Mon Jul 11 2005
 *   copyright            : (C) 2005 The phpBB XS Group
 *   email                : bicet@gmail.com
 *
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 ***************************************************************************/
if ( !defined('IN_PHPBB') )
{
   die("Hacking attempt");
}

if ($_SERVER['HTTP_REFERER'] && !eregi($_SERVER['HTTP_HOST'] . $board_config['script_path'], $_SERVER['HTTP_REFERER']))
{
   $referrer_url = $_SERVER['HTTP_REFERER'];
   $referrer_host = str_replace ("http://", "", $referrer_url);
   $referrer_host = substr($referrer_host, 0, strpos($referrer_host, "/"));

   if  ( !($referrer_host==$board_config['server_name']) )
   {
      $sql = "SELECT * FROM " . REFERRERS_TABLE . "
         WHERE referrer_url = '$referrer_url'";
      if (!$result = $db->sql_query($sql))
      {
         message_die(GENERAL_ERROR, "Couldn't get referrers information", "", __LINE__, __FILE__, $sql);
      }
      $row = $db->sql_fetchrow($result);
      if (!$row)
      {
         $sql = "INSERT INTO " . REFERRERS_TABLE . " (referrer_host, referrer_url, referrer_ip, referrer_hits, referrer_firstvisit, referrer_lastvisit)
            VALUES ('$referrer_host', '$referrer_url', '$user_ip', 1, '" . time() . "', '" . time() . "')";
            
         if (!$result = $db->sql_query($sql))
         {
            message_die(GENERAL_ERROR, "Couldn't insert new referrer", "", __LINE__, __FILE__, $sql);
         }
      }
      else
      {
         $sql = "UPDATE " . REFERRERS_TABLE . "
            SET referrer_hits = referrer_hits + 1, referrer_lastvisit = " . time() . ", referrer_ip = '$user_ip'
            WHERE referrer_url='$referrer_url'";
            
         if (!$result = $db->sql_query($sql))
         {
            message_die(GENERAL_ERROR, "Couldn't update referrers information", "", __LINE__, __FILE__, $sql);
         }
      }
   }
}
?>
User avatar
LaZeR
Registered User
Posts: 671
Joined: Sat Jun 29, 2002 8:38 pm
Contact:

Post by LaZeR »

Slick mod and nice interface. Thanks also to Matt, Dagon, and Dakar for the tweaks. :)
romans1423
Registered User
Posts: 1552
Joined: Sat Nov 02, 2002 4:44 pm
Location: Connersville, IN
Name: Rick Beckman
Contact:

Post by romans1423 »

Any chance that it could be integrated somehow with this: Referral Karma; I ended up with a huge ban list in my .htaccess file using the referral list MOD in this thread, and it seems like Referral Karma would help with that greatly.

However, out of the box, Referral Karma doesn't seem to work with phpBB, as it breaks the Admin Panel link's redirect. I'm sure it could be adapted, though...
Locked

Return to “[2.0.x] MODs in Development”