<?php session_start();?>
<?php
require("inc/function.php");
header("Content-Type:text/html;charset=gbk");
date_default_timezone_set('PRC');
?> 
<?php
//判断来源网址
if ($_SERVER['HTTP_REFERER'])
{
$url=$_REQUEST["url"];
//主域名
$url_axing=explode("/",$url);
$url_axing="http://".$url_axing[2];

axing_connect();
$sql="select * from come where come_url='$url' order by id desc limit 1";
$result=mysql_query($sql);
$myrow=mysql_fetch_assoc($result);
$come_time_last=$myrow[come_time];
mysql_close();
//计算时间差
$last_now_time=bcdiv((strtotime(date("Y-m-d H:i:s"))-strtotime($come_time_last)),60);

if ($last_now_time<$axing_time)
{
echo "友情提示：同一IP相隔 ".$axing_time." 分钟后点入才能有效！该IP上一次点入时间 ".$come_time_last." 距离现在 ".$last_now_time." 分钟";
}
else
{
if ($url_axing!="http://".$weburl)
{
echo "友情提示：本次点入有效，来源 ".$url;

axing_connect();
$now=date("Y-m-d H:i:s");
$sql="update base set cometime='$now' where url='$url_axing'";
$result=mysql_query($sql);

$sql="insert into come(come_time,come_ip,come_url) values('$now','$_SERVER[REMOTE_ADDR]','$url_axing')";
$result=mysql_query($sql);

mysql_close();
}
else
{
echo "友情提示：本次点入无效！";
}
}

}
?> 