¥È¥Ã¥×   ÊÔ½¸ Åà·ë º¹Ê¬ ¥Ð¥Ã¥¯¥¢¥Ã¥× źÉÕ Ê£À½ ̾Á°Êѹ¹ ¥ê¥í¡¼¥É   ¿·µ¬ °ìÍ÷ ñ¸ì¸¡º÷ ºÇ½ª¹¹¿·   ¥Ø¥ë¥×   ºÇ½ª¹¹¿·¤ÎRSS

PHP/¥µ¥ó¥×¥ë/¥¢¥¯¥»¥¹¥í¥°

Last-modified: 2018-11-14 (¿å) 15:23:57 (2214d)
Top / PHP / ¥µ¥ó¥×¥ë / ¥¢¥¯¥»¥¹¥í¥°

PHP/¥µ¥ó¥×¥ë

¥¢¥¯¥»¥¹¥í¥°Äɵ­¤ª¤è¤Óɽ¼¨¥µ¥ó¥×¥ë

<html>
<head><title>Access Log</title></head>

<body>
<?php
    define("LOG_FILE_NAME", "./log/accesslog.log");

    print("<h1>Access Log</h1>\n");
    print("now: " . date("Y-m-d H:i:s ") . "<br /><br />\n");

    $fp = @fopen(LOG_FILE_NAME, "a+") or die("¥¨¥é¡¼¡§¥í¥°¥Õ¥¡¥¤¥ë¤¬¸«¤Ä¤«¤ê¤Þ¤»¤ó¡£" . LOG_FILE_NAME);
    flock($fp, LOCK_EX);
    fputs($fp, date("Y-m-d H:i:s ") . $_SERVER['REMOTE_ADDR'] . "\n");
    flock($fp, LOCK_UN);

    rewind($fp);
    while (!feof($fp)) {
        $line = fgets($fp);
        print($line . "<br />");
    }
    fclose($fp);
?>
</body>
</html>