File size: 1.55Kb
<?php
include "inc/data.php";
if (isset($_GET['sid'])) $sid = htmlspecialchars(substr(trim($_GET['sid']),0,5)); else exit;
if ($sid=="") exit;
$notes = file("inc/members/sid".$sid.".db");
if (nakrutka)
{
$date_data="inc/date.dat";
$ip_log="inc/data/ip_log_out_".$sid.".dat";
if (file_exists($ip_log)) $ip_file = file($ip_log);
$date=date("d-m-Y",time());
if (file_exists($date_data)) $a_date=file($date_data); else $a_date[]=-1;
if ($a_date[0]==$date):
if (strpos($ip_file[0], "$REMOTE_ADDR")>-1)
{
$record = explode("¤", trim($notes[0]));
Go_to_URL($record[0]);
exit;
}
$fu=fopen($ip_log,"a");
fwrite($fu,"$REMOTE_ADDR"."¤");
fclose($fu);
elseif ($a_date[0] != $date):
$fu=fopen($ip_log,"w");
fwrite($fu,"$REMOTE_ADDR"."¤");
fclose($fu);
$fd=fopen($date_data,"w");
flock($fd,2);
fputs($fd,$date);
flock($fd,3);
fclose($fd);
endif;
}
$IO_data="inc/data/io_".$sid.".dat";
if (file_exists($IO_data)) $io = file($IO_data);
if ($io)
{
$record = explode("¤", trim($io[0]));
$record[1]++;
$fopt = fopen ($IO_data, "w");
$io_result = $record[0]."¤".$record[1];
if ($fopt) $result = fwrite($fopt, $io_result);
fclose($fopt);
}
$record = explode("¤", trim($notes[0]));
Go_to_URL($record[0]);
function Go_to_URL($url) {
echo "<scr"."ipt language=\"javascript\">document.location.replace('".$url."');</scr"."ipt>";
?>
<noscript>
<?php header("location: $url"); ?>
</noscript>
<?php } ?>