Using ToLogFile()

Contents of this folder :

Here are the contents of "logs/mylog.txt" file: (deleted when filesize > 20000 bytes)
<%response.write("Ahem ... you have nothing to do here!!")
response.end%>
[ 22-03-2025 07:37:22 ]     A visitor from 195.191.219.130
[ 23-03-2025 03:05:13 ]     A visitor from 217.113.194.41
[ 23-03-2025 05:10:49 ]     A visitor from 217.113.194.75
[ 23-03-2025 20:16:14 ]     A visitor from 18.215.77.19
[ 24-03-2025 10:45:04 ]     A visitor from 195.191.219.130
[ 25-03-2025 02:43:27 ]     A visitor from 195.191.219.130
[ 26-03-2025 02:52:04 ]     A visitor from 185.191.171.6
[ 26-03-2025 03:10:39 ]     A visitor from 216.244.66.230
[ 26-03-2025 06:40:09 ]     A visitor from 195.191.219.130
[ 26-03-2025 20:31:12 ]     A visitor from 54.36.148.175
[ 27-03-2025 00:05:06 ]     A visitor from 54.36.148.127
[ 27-03-2025 14:36:31 ]     A visitor from 54.36.148.176
[ 27-03-2025 16:11:53 ]     A visitor from 54.36.148.42
[ 27-03-2025 20:21:39 ]     A visitor from 18.213.102.186
[ 27-03-2025 22:13:00 ]     A visitor from 54.36.148.208
[ 27-03-2025 23:11:10 ]     A visitor from 54.36.148.232
[ 27-03-2025 23:57:27 ]     A visitor from 54.36.148.123
[ 28-03-2025 05:03:36 ]     A visitor from 195.191.219.130
[ 29-03-2025 03:44:43 ]     A visitor from 54.221.203.24
[ 29-03-2025 03:46:24 ]     A visitor from 18.215.49.176
[ 29-03-2025 03:48:44 ]     A visitor from 18.214.186.220
[ 29-03-2025 20:45:38 ]     A visitor from 154.54.249.200
[ 29-03-2025 20:57:51 ]     A visitor from 217.113.194.76
[ 29-03-2025 21:00:04 ]     A visitor from 217.113.194.78
[ 30-03-2025 05:06:28 ]     A visitor from 195.191.219.130
[ 30-03-2025 06:35:58 ]     A visitor from 54.36.149.3
[ 30-03-2025 06:48:54 ]     A visitor from 54.36.149.12
[ 31-03-2025 04:27:57 ]     A visitor from 85.208.96.200
[ 31-03-2025 09:54:31 ]     A visitor from 85.208.96.200
[ 31-03-2025 10:37:20 ]     A visitor from 185.191.171.4
[ 31-03-2025 11:06:22 ]     A visitor from 195.191.219.130
[ 31-03-2025 17:22:44 ]     A visitor from 85.25.185.79
[ 01-04-2025 14:44:24 ]     A visitor from 57.141.0.12
[ 02-04-2025 04:17:29 ]     A visitor from 195.201.199.99
[ 03-04-2025 05:13:11 ]     A visitor from 57.141.0.23
[ 04-04-2025 02:22:51 ]     A visitor from 37.27.51.146
[ 04-04-2025 02:22:56 ]     A visitor from 37.27.51.146
[ 04-04-2025 13:03:37 ]     A visitor from 57.141.0.9
[ 04-04-2025 16:14:40 ]     A visitor from 217.113.194.41
[ 04-04-2025 16:15:02 ]     A visitor from 217.113.194.36
[ 04-04-2025 16:18:15 ]     A visitor from 217.113.194.33
[ 04-04-2025 23:18:57 ]     A visitor from 54.36.149.74
[ 04-04-2025 23:39:44 ]     A visitor from 54.36.148.111
[ 04-04-2025 23:43:00 ]     A visitor from 54.36.148.165
[ 04-04-2025 23:53:59 ]     A visitor from 54.36.149.13
[ 05-04-2025 00:01:22 ]     A visitor from 51.15.217.228
[ 05-04-2025 05:40:25 ]     A visitor from 54.36.148.135
[ 05-04-2025 07:21:34 ]     A visitor from 217.113.194.72
[ 05-04-2025 07:29:24 ]     A visitor from 54.36.149.93
[ 06-04-2025 02:54:23 ]     A visitor from 185.191.171.17
[ 06-04-2025 08:51:42 ]     A visitor from 185.191.171.12
[ 06-04-2025 09:35:14 ]     A visitor from 185.191.171.15
[ 06-04-2025 09:36:14 ]     A visitor from 85.208.96.198
[ 06-04-2025 11:52:08 ]     A visitor from 185.191.171.3
[ 06-04-2025 12:03:20 ]     A visitor from 85.208.96.204
[ 07-04-2025 06:04:05 ]     A visitor from 3.133.100.106

Here are the contents of 'default.asp':
<!-- The includefile is one level back from the "default.asp" file: -->
<!--#include file ="../../jakes_IO.asp"-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="da">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>Example use of the ToLogFile function</title>
    <link rel="stylesheet" type="text/css" href="/jake.css">
</head>
<body>
    <div align="center"><h1>Using ToLogFile()</h1></div>
    <b>Contents of this folder :</b><br>
    <% dim logstring
    
    logstring = "A visitor from " & request.servervariables("REMOTE_ADDR") & " "
    select case request.querystring("action")
        case "Button 1"
            logstring = logstring & "pressed button1"
        case "Button 2"
            logstring = logstring & "pressed button2"
        case "Button 3"
            logstring = logstring & "pressed button3"
        case "Say hello"
            logstring = logstring & "said 'Hello': )"
        case "Say bye"
            logstring = logstring & "said 'Bye': )"
        end select
        
        tologfile "logs/mylog.txt", logstring
        %>
    <form method="get" action="default.asp?action=button1"><input type="submit" name="action" value="Button 1">
    <input type="submit" name="action" value="Button 2">
    <input type="submit" name="action" value="Button 3">
    <input type="submit" name="action" value="Say hello">
    <input type="submit" name="action" value="Say bye">
    </form>
    
    <p><b>Here are the contents of "logs/mylog.txt" file:</b> (deleted when filesize > 20000 bytes)
    <br><span style="display:block;border:1px solid black;background:#DEF;padding:10px;font-size:11px;">
    <%
        response.write(stringToHTML(getFileContents("logs/mylog.txt")))
        if getsize("logs/mylog.txt") > 20000 then delete("logs/mylog.txt")
    %>
    </span>

    <p><b>Here are the contents of 'default.asp':</b>
    <br><span style="display:block;border:1px solid black;background:#FDE;padding:10px;font-size:11px;">
    <%
        response.write(stringToHTML(getFileContents("default.asp")))
    %>
    </span>


</body>
</html>