echo ('
');
require ('config.php');
$debug = 0;
function getrootaddress ($address)
{
$slash_slash_pos = strpos ($address, "://");
$protocol = substr($address, 0, $slash_slash_pos+3);
$return_val = substr($address, $slash_slash_pos + 3);
$slash_pos = strpos ($return_val, "/");
if ($slash_pos)
{
$return_val = $protocol.substr($return_val, 0, $slash_pos);
}
else
{
$return_val = $protocol.$return_val;
}
return($return_val);
} //getrootaddress
function add_link ($in_link, $out_link, $userIP, $date)
{
$out_link_short = getrootaddress($out_link);
if ($debug == 1)
{
echo ("$out_link
");
echo ("$out_link_short
");
}
// check if we already have a hit for today and this IP
mysql_query("SELECT id FROM hits_in WHERE out_link='$out_link' AND ip='$userIP' AND date = '$date' LIMIT 1") or die ("couldn't check ip");
$row=mysql_fetch_array($result);
if ($row)
{
$duplicate = 1;
}
else
{
$duplicate = 0;
}
// add the new hit
mysql_query("INSERT into hits_in (in_link, out_link, ip, date) VALUES ('$in_link','$out_link_short','$userIP', '$date')")
or die ("unable to insert into hits_in");
if ($duplicate == 0)
{
$result = mysql_query("SELECT * FROM links WHERE out_link='$out_link_short'") or die ("out_link_short query failed");
$row=mysql_fetch_array($result);
if ($row)
{
$id = $row["id"];
$in_count = $row["in_count"] + 1;
mysql_query("UPDATE links set in_count = $in_count WHERE id=$id") or die ("failed to update in_count");
}
else
{ // add to the database
mysql_query("INSERT into links (in_link, out_link) VALUES ('$in_link','$out_link_short')") or die ("failed to add $out_link_short");
}
} //dumplicate
} //add_link
$userIP=getenv("REMOTE_ADDR");
$date = date("Y-m-d");
$Connection=mysql_connect($db_host, $db_user, $db_pass) or
die ("Failed to connect to $db_host");
mysql_select_db ($db_name) or die ("Failed to select $db_name");
if (isset($_POST['manual_out_link']))
{
$manual_out_link = $_POST['manual_out_link'];
if ($debug == 1)
{
echo ("Got Manual - $manual_out_link");
}
$slash_slash_pos = strpos ($manual_out_link, "://");
$protocol = substr($manual_out_link, 0, $slash_slash_pos+3);
if ($protocol == "http://")
{
add_link ("manual", $manual_out_link, $userIP, $date);
if ($debug == 1) { echo ("-- $manual_out_link link will be added"); }
}
}
else if (isset($_SERVER['HTTP_REFERER']))
{
$out_link = $_SERVER['HTTP_REFERER'];
$in_link = $out_link;
add_link ($in_link, $out_link, $userIP, $date);
}
else
{
// did not get referrer
}
echo ('
Most Hits In:
");
echo ('
$out_link"); if ($meta_description != "") { echo (" - $meta_description"); } echo ("
"); } echo ('Lastest Hits In:
");
echo ('
$out_link"); // if ($meta_description != "") // { // echo (" - $meta_description"); // } echo ("
"); } echo ('Simply send traffic to this page from any subpage on your website and your link will be displayed here. This is a great way to easily increase your google pagerank rating and generate extra traffic for your site. My auto link dump code differs from the traidtional link dump in that no registration is required. I automatically add your link based on the http referer tag.
'); echo ('You can also use this page as a traditional link dump. More details on how to do this will be posted here soon.
'); echo (' '); echo ('This code is currently being beta tested and some features have not been finished. When it is complete I will release the code under the GPL
'); echo ('