"Programming" open Source (opensource)-Reverse link (referrers) system

Source: Internet
Author: User
Tags date count functions one table servervariables
Programming | link | link reverse link (referrers) system can display the reverse link very well, at present the newest source (referer) that displays on many sites is using Stephen's referrer statistic system, such as Booso reverse link (referrers) Statistical system, there is also a Zhu Zhunwei of the Reverse Link Statistics Service does not know that it is not his own implementation.
In short, the Internet to provide these backlinks (referrers) system is not a good service, that is, poor customization, so, simply, I am tired of spending a day to write a, and open the source code, basically the structure and functions are used, but still need to improve.
Because I do not support ASP + Access host, so I can not provide services, I hope that some colleagues can provide this service? Or CSDN will offer this service to me? The effect chart is as follows:



Basic architecture:

Using ASP + Access

Use the following script to increase the reverse link record on the page that needs to be counted
<script language=javascript src= "/lib/refadd.js" ></script>


Use the following script to add a reverse link display to the page you want to display
<script language=javascript src= "/lib/refcnt.js" ></script>

Database:

The database needs only one table

ID: Integer
IP: String (255)
Agent: String (255)
To: String (255)
Name: String (255)
From: string (255)
Date: datetime
Where the value of the "Name" field is the result of the from processing, such as from= "http://www.google.com/" then Name= "Google"

Analysis:

Just a simple SQL query is required:
SELECT [Name],count (*) from [referrer] GROUP by [NAME] ORDER by COUNT (*) DESC "

If you want, you can also add the necessary conditions, such as displaying records with access times greater than 3 times:
SELECT [Name],count (*) from [referrer] GROUP by [NAME] has a count (*) >3 ORDER by Count (*) DESC "

Basic functions:

Reverse Link record
Reverse Link display (supports multiple parameters)

File list:


Lib/refadd.asp
Lib/refadd.js
Lib/refcnt.asp
Lib/refcnt.js
Lib/refcon.asp
Lib/images/percent.gif
Dat/refdb.mdb
Source:

Because CSDN does not provide the file downloading function, therefore I also need to find a place to upload the source code, does not know where has, everybody colleague please inform to know

Default.asp
<title>top refering sites</title>
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<body>
<script language=javascript src= "/lib/refadd.js" ></script>
<script language=javascript src= "/lib/refcnt.js" ></script>
</body>

Refadd.asp
<% @language =javascript%>
<!--#include file= "refcon.asp"-->
<%
function Makeurl (Sname,surl)
{
if (Surl.indexof ("http://") = = 0)
{
sURL = surl.substring (7);
}
Return "<a href=\\\" http://"+ sURL +" \\\ ">" + sname+ "</a>";
}
function GetName (SIP, sURL)
{
var sname = Surl.tolowercase ();
if (sname = "")
{
sname = Makeurl ("Direct Refrence", SIP);
}
Else
{
if (Sname.indexof ("http://") = = 0)
{
sname = sname.substring (7);
}
if (Sname.indexof ("www.") = = 0)
{
sname = sname.substring (4);
}
var nindex = Sname.indexof ("/");
if (nindex > 0)
{
sname = sname.substring (0, nindex);
}

if (Sname.indexof (".") = = 0)
{
sname = Makeurl ("Not avalible", surl);
}
Else
{
if (Sname.indexof ("google") = = 0)
{
sname = Makeurl ("Google", sURL);
}
Else
if (Sname.indexof ("yahoo") = = 0)
{
sname = Makeurl ("Yahoo", sURL);
}
Else
{
sname = Makeurl (sURL, sURL);
}
}
}
Return sname.substring (0,255);
}

var NCT = parseint ("" + request.querystring ("ct")); if (isNaN (NCT)) NCT = 8;
var SIP = "" + Request.ServerVariables ("remote_addr"); if (sip = = "undefined" | | | sip = = "Null") sip = "";
var SQL = "SELECT [ID] from [referrer] WHERE [ip]= ' + SIP +] ' and DATEDIFF (' H ', [Date],now ()] <" + NCT;
var ORS = Oconnect.execute (SQL)

if (ors.eof && ors.bof)
{
var SRF = "" + request.querystring ("fr"); if (SRF = = "Undefined" | | SRF = = "Null") SRF = "";
var STO = "" + Request.QueryString ("to"); if (STO = = "Undefined" | | STO = = "Null") STO = "";
var SAG = "" + Request.ServerVariables ("http_user_agent");

SRF = srf.substring (0,255);
STO = sto.substring (0,255);
SAG = sag.substring (0,255);

SQL = "INSERT into [referrer] ([date],[ip],[name],[from],[to],[agent]) VALUES ("
+ "Now ()"
+ ", '" + SIP + "' &qu



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.