Example #1
0
<?php

require_once "record_visitors.php";
$visitor = new guest_info();
//$log_string = date('Y-m-d H:i:s')."\t".$visitor->GetIP()."\t".$visitor->GetOS()."\t".$visitor->GetBrowser()."\t".$visitor->GetLang()."\n";
$log_string = date('Y-m-d H:i:s') . "\t" . "visit-home-page\t" . $visitor->GetIP() . "\t" . $visitor->GetOS() . "\t" . $visitor->GetBrowser() . "\t" . $visitor->GetLang() . "\t" . $visitor->GetIPLoc_sina($visitor->GetIP()) . "\n";
$fp = fopen('visitor.log', 'a');
if (flock($fp, LOCK_EX)) {
    fwrite($fp, $log_string);
    flock($fp, LOCK_UN);
}
fclose($fp);
?>
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="Introduction for KEMY">
    <meta name="author" content="ETAF">
    <link rel="icon" type="image/x-icon" href="favicon.ico">
    <title>Machine Learned AQM scheme</title>

    <!-- Bootstrap core CSS -->
    <!--<link href="../../dist/css/bootstrap.min.css" rel="stylesheet">-->
    <link href="http://cdn.bootcss.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet">

    <!-- Custom styles for this template -->
    <link href="./media/jumbotron-narrow.css" rel="stylesheet">
Example #2
0
<?php

$filename = $_GET["filename"];
$filePath = '/downloads/' . $filename;
require_once "record_visitors.php";
$visitor = new guest_info();
$log_string = date('Y-m-d H:i:s') . "\t" . "download " . $filename . "\t" . $visitor->GetIP() . "\t" . $visitor->GetOS() . "\t" . $visitor->GetBrowser() . "\t" . $visitor->GetLang() . "\t" . $visitor->GetIPLoc_sina($visitor->GetIP()) . "\n";
$fp = fopen('visitor.log', 'a');
/*if( flock($fp,LOCK_EX))*/
//{
//fwrite($fp,$log_string);
//flock($fp, LOCK_UN);
/*}*/
fwrite($fp, $log_string);
fclose($fp);
header('Content-type: application/octet-stream');
//header('Content-Disposition: attachment; filename="' . basename($file) . '"');
header('Content-Disposition: attachment; filename="' . $filename . '"');
//让Xsendfile发送文件
header('X-Accel-Redirect: ' . $filePath);