File size: 2.28Kb
<?php
#-----------------------------------------------------#
# ********* WAP-MOTORS WebMod ********* #
#-----------------------------------------------------#
# Original Made by : VANTUZ #
# E-mail : [email protected] #
# Site : http://pizdec.ru #
# WAP-Site : http://visavi.net #
# ICQ : 36-44-66 #
#-----------------------------------------------------#
# WebMod Made by : X-ray (Юрий) #
# E-mail : [email protected] #
# Site : http://city.zugdidi.us #
# WAP-Site : http://zugdidi.us #
#-----------------------------------------------------#
# Вы не имеете право вносить изменения в код скрипта #
#-----------------------------------------------------#
$ref_from = $_SERVER['HTTP_REFERER'];
if (ereg ("^http",$ref_from)){
$ref_from=str_replace("http://","",$ref_from);
$ref_from=str_replace("https://","",$ref_from);
$ref_from=strtok($ref_from,'/');
$ref_from=strtok($ref_from,'?');
$ref_from=check($ref_from);
$lines=file(BASEDIR."local/referer.dat");
$count=count($lines);
for ($rb=0; $rb<$count; $rb++) {
$dt=explode("|",$lines[$rb]);
if ($dt[0]==$ref_from) {
$rlinn=(int)$rb; $ref_count=$dt[3];}}
if(!empty($ref_from)){
if($rlinn>0){
$ref_count=$ref_count+1;
$time=time();
$t=$ref_from.'|'.$time.'|'.$ip.'|'.$ref_count.'|';
$reffile=file(BASEDIR."local/referer.dat");
$fp=fopen(BASEDIR."local/referer.dat","a+");
flock ($fp,LOCK_EX);
ftruncate ($fp,0);
for ($ri=0;$ri< sizeof($reffile);$ri++) {if ($rlinn!=$ri) {fputs($fp,$reffile[$ri]);} else {fputs($fp,"$t\r\n");}}
fflush ($fp);
flock ($fp,LOCK_UN);
fclose($fp);}
else{
$time=time();
$t=$ref_from.'|'.$time.'|'.$ip.'|1|';
$fp = fopen(BASEDIR."local/referer.dat","a+");
flock ($fp,LOCK_EX);
fputs($fp,"$t\r\n");
fflush ($fp);
flock ($fp,LOCK_UN);
fclose($fp);
$reffile=file(BASEDIR."local/referer.dat");
$ri = count($reffile);
if ($ri>=$config_referer) {
$fp=fopen(BASEDIR."local/referer.dat","w");
flock ($fp,LOCK_EX);
unset($reffile[0]);
unset($reffile[1]);
fputs($fp, implode("",$reffile));
flock ($fp,LOCK_UN);
fclose($fp);}
}}}
?>