Greenguy's Board

Greenguy's Board (http://www.greenguysboard.com/board/index.php)
-   Programming & Scripting (http://www.greenguysboard.com/board/forumdisplay.php?f=15)
-   -   Top Referrers Script (http://www.greenguysboard.com/board/showthread.php?t=1816)

spacemanspiff 2003-10-24 12:23 PM

Top Referrers Script
 
I'm looking for a good way to add a "top referrers" section to a page. I'd don't want to have to use referrer codes, I would like to be able to exclude url's like search engines and such, and no sign up necessity would be great. ie. "just send hits to bla-bla.com and you'll be ranked in the top referrers section." If it could reset every 24 hours, without me having to get into anything dangerous like cron, that would be awesome

Thanks
SS

MrMaryLou 2003-10-24 12:28 PM

This one Kicks Ass :) http://www.cgiman.com/autorefs.shtml

BNS 2003-11-03 05:42 PM

does anyone know if there is any free script similar to autorefs?
i need it for something relatively small to spend $300 on it.
|peace|

Auke 2003-11-15 10:17 AM

PHP Code:

//check if it is the first of the month.
//if so reset counter
$datum date("Y-m-d H:i:s");
$lastmonth date("m")-1;
$thisyear date("Y");

        
$getsites mysql_query("SELECT * FROM pages WHERE hitsin > '0' AND lasthit LIKE '$thisyear-0$lastmonth-%' LIMIT 1")or die(mysql_error());
         
$count_site mysql_num_rows($getsites);
            if(
$count_site == 1){//count
                
$allsites mysql_query("SELECT * FROM pages")or die(mysql_error());
                while(
$rowall mysql_fetch_array($allsites)){//while
                    
mysql_query("UPDATE pages SET hitsin = '0', lasthit WHERE accepted = 'y'")or die(mysql_error());                    
                }
//while
            
}//count

//register referer and ip adres
$refip getenv ("REMOTE_ADDR");
$referer getenv("HTTP_REFERER");
$c_url mysql_query("SELECT hitsin, lastip, lasthit FROM pages WHERE url = '$referer%'")or die("er is iets mis: ".mysql_error());
$tell mysql_num_rows($c_url);
    if(
$tell == 1){
    
$row mysql_fetch_array($c_url);
    
$lastip $row['lastip'];
    
$hitsnu $row['hitsin'];
        if(
$lastip == $refip){
        
$histnew $hitsnu;
        }else{
        
$hitsnew $hitsnu 1;
        }
    
$update_site mysql_query("UPDATE pages SET hitsin = '$hitsnew', lastip = '$refip', lasthit = '$datum' WHERE url = '$referer%' ")or die("er is iets mis: ".mysql_error());
    } 

This is a peace of a script i wrote and use to registrer referers.
If you can do a little of php scripting you can ajust it to your needs.

BNS 2003-11-15 01:52 PM

Hi,

thanx for script:)

if i am not asking too much, can you please give some example how exactly to use it? i see it has mysql queries, but where does it connect to db and for instance how does the output html look like?

tia,
BNS


All times are GMT -4. The time now is 09:21 AM.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
© Greenguy Marketing Inc