include("../config.php"); ?>
アクセスログ echo $SITENAME; ?>
アクセスログ
errlogはこちら
詳しいaccesslogはこちら
$date=date("Y-m-d");
//print($date);
$year=$_GET["year"];
//echo $year;
$month=$_GET["month"];
if($month<10){$month="0".$month;}
//echo $month;
$day=$_GET["day"];
//echo $day;
$access_day=$year."-".$month."-".$day;
echo $access_day;
//exit;
$TABLE="log";
$DB="coolweb";
$DIR="log";
$DATE=$_GET["day"];
$link = mysql_connect('localhost', 'root', 'kudo0624');
$db_selected = mysql_select_db($DB, $link);
$sql = "SET NAMES utf8";
$result = mysql_query("$sql");
// if(!$access_day=""){
$SQL="SELECT * from ".$TABLE." where date='".$access_day."'";
// $SQL="SELECT * from ".$TABLE;
//" where date='2010-04-30'";
// }else{
// $SQL="SELECT * from ".$TABLE." where date='".$date."'";
// }
$result = mysql_query("$SQL");
while ($row = mysql_fetch_assoc($result)) {
// echo $row['log'];
$LOG=$row['log'];
}
// while ($row = mysql_fetch_assoc($result)) {
// echo "".$row['title']."
";
// echo $row['comment']."
";
// }
//echo $LOG;
//if($LOG=""){
//for($i=0;$i<30;$i++){echo "
";}
//}
$ac_arr = array($LOG);
$astring = join("", $ac_arr);
$astring = preg_replace("/(\n|\r|\t)/", "", $astring);
$records = preg_split("/([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/", $astring, -1, PREG_SPLIT_DELIM_CAPTURE);
$sizerecs = sizeof($records);
// now split into records
$i = 1;
$each_rec = 0;
while($i<$sizerecs) {
$ip = $records[$i];
$all = $records[$i+1];
// parse other fields
preg_match("/\[(.+)\]/", $all, $match);
$access_time = $match[1];
$all = str_replace($match[1], "", $all);
preg_match("/\"GET (.[^\"]+)/", $all, $match);
$http = $match[1];
$link = explode(" ", $http);
$all = str_replace("\"GET $match[1]\"", "", $all);
preg_match("/([0-9]{3})/", $all, $match);
$success_code = $match[1];
$all = str_replace($match[1], "", $all);
preg_match("/\"(.[^\"]+)/", $all, $match);
$ref = $match[1];
$all = str_replace("\"$match[1]\"", "", $all);
preg_match("/\"(.[^\"]+)/", $all, $match);
$browser = $match[1];
$all = str_replace("\"$match[1]\"", "", $all);
preg_match("/([0-9]+\b)/", $all, $match);
$bytes = $match[1];
$all = str_replace($match[1], "", $all);
print("
IP: $ip
Access Time: $access_time
Page: ");
print "".$link[0]."";
print("
Type: $link[1]
Success Code: $success_code
Bytes Transferred: $bytes
Referer: $ref
Browser: $browser
");
// advance to next record
$i = $i + 2;
$each_rec++;
}
?>