|
# ***********************************
# ログファィル読み込み
# ***********************************
function lb_GetLog( ) {
global $logfile;
if ( file_exists( $logfile ) ) {
$fline = file( $logfile );
foreach( $fline as $buffer ) {
$Name = strtok( $buffer, "\t" );
$Doc = strtok( "\t" );
print $Name . " > " . $Doc . "<br>";
}
}
else {
print "ログファイルが存在しません";
}
}
# ***********************************
# ログファィル書き込み
# ***********************************
function lb_PutLog( ) {
global $logfile;
global $maxlog;
global $UserName;
global $TextData;
if ( file_exists( $logfile ) ) {
$fline = file( $logfile );
$linecnt = count( $fline );
if ( $linecnt >= $maxlog ) {
$linecnt = $linecnt - 1;
}
$fp = fopen( $logfile, "w" );
fputs( $fp, $_POST[$UserName] . "\t" . $_POST[$TextData] . "\n" );
for( $i = 0; $i < $linecnt; $i++ ) {
fputs( $fp, $fline[$i] );
}
fclose( $fp );
}
else {
print "ログファイルが存在しません";
}
}
| |