[ // SmartDesk's Personal Web Server - Log List // (c) 1997-98 SmartDesk, Inc., All Rights Reserved // Main Routine _apGenerate( ) session = new( "session", param( 1 ), param( 2 ) ) if ( ! session.secure( "Server.Logs.Access" ) ) return( 0 ) end webLogCacheFlush( session.websrvr ) path = webServerBaseDir( session.websrvr ) filename = fileFixPath( path + '\sdwebsrv.log' ) if ( ! fileExists( filename ) ) session.error( "No log data available, try flushing the log data cache from the system area of the mini-console..." ) return(0) end ]>
<[ hfile = fopen( filename, 0 ) if ( hfile < 1 ) session.error( "Unable to open " + filename + " file." ) return( 0 ) end buf_size = 50000 len = flen( hfile ) if ( len < buf_size ) fclose( hfile ) data = fileReadAscii( filename ) else fseek( hfile, -1 * buf_size, 2 ) data = fread( hfile, buf_size ) fclose( hfile ) end ! "Log File: " + lower( filename ) ! "Log Size: " + strcommas( "" + len ) + " bytes
" data = strswap( data, "\n", "" ) cnt = chrcount( "\r", data ) for ( i=cnt; i>0; i-- ) ! strextract( data, "\r", i ) end if ( len > buf_size ) ! "...
" end ]>