kab_184
08-19-2003, 11:03 AM
hi
i got this code working fine
<%
dim iplg, logFile8
set iplg=createObject("scripting.FileSystemObject")
set logFile8=iplg.openTextFile(server.mappath("IPLOG.txt"),8)
logFile8.write Request.ServerVariables("Remote_Addr") & vbcrlf
logFile8.close
set logFile8=nothing
set iplg=nothing
%>
but
1- now i think this script doesnt do one things.. what if the "iplog.txt " file doesnot exist in the specified address? it would give errors?? what code lines shall i have to add to check that iplog.txt file is present and if not present it should automatically create the iplog.txt file.what lines should be added in the following
<%
dim iplg, logFile8
set iplg=createObject("scripting.FileSystemObject")
set logFile8=iplg.openTextFile(server.mappath("IPLOG.txt"),8)
logFile8.write Request.ServerVariables("Remote_Addr") & vbcrlf
logFile8.close
set logFile8=nothing
set iplg=nothing
%>
2-another thing i thought was what if 2 or more people were accessing the same file at the same time? wont it give error if iplog.txt file was already opened to log ip of first visitor while the second visitors was trying to write its ip in the same file... i mean one file "iplog.txt" file being accessed by 2 or more users at the same time.will iplog.txt file can write 2 more different ip at the same time?what code should be edited /added to achive this?
3- i want to create iplog.txt file separate for each day. For this i think server date can be used can it?
for example if the date on server is 07/22/2003 how can i make an iplog file wiht the name 07222003iplog.txt . i mean adding the server date as suffix or prefix to create txt file automatically .
so next day as the derver date changes the next iplog file is created as" 08222003iplog.txt" and all the ip addresses are written in that file on that day and date. That will surelymake my life easier as ip addresses shall be written as daily log files instead of one signle file automatically.... so can this be done in asp...what changes shall i have to make to the followiong code to achive this
<%
dim iplg, logFile8
set iplg=createObject("scripting.FileSystemObject")
set logFile8=iplg.openTextFile(server.mappath("IPLOG.txt"),8)
logFile8.write Request.ServerVariables("Remote_Addr") & vbcrlf
logFile8.close
set logFile8=nothing
set iplg=nothing
%>
please help me as this is more complex for me ..
thank you
i got this code working fine
<%
dim iplg, logFile8
set iplg=createObject("scripting.FileSystemObject")
set logFile8=iplg.openTextFile(server.mappath("IPLOG.txt"),8)
logFile8.write Request.ServerVariables("Remote_Addr") & vbcrlf
logFile8.close
set logFile8=nothing
set iplg=nothing
%>
but
1- now i think this script doesnt do one things.. what if the "iplog.txt " file doesnot exist in the specified address? it would give errors?? what code lines shall i have to add to check that iplog.txt file is present and if not present it should automatically create the iplog.txt file.what lines should be added in the following
<%
dim iplg, logFile8
set iplg=createObject("scripting.FileSystemObject")
set logFile8=iplg.openTextFile(server.mappath("IPLOG.txt"),8)
logFile8.write Request.ServerVariables("Remote_Addr") & vbcrlf
logFile8.close
set logFile8=nothing
set iplg=nothing
%>
2-another thing i thought was what if 2 or more people were accessing the same file at the same time? wont it give error if iplog.txt file was already opened to log ip of first visitor while the second visitors was trying to write its ip in the same file... i mean one file "iplog.txt" file being accessed by 2 or more users at the same time.will iplog.txt file can write 2 more different ip at the same time?what code should be edited /added to achive this?
3- i want to create iplog.txt file separate for each day. For this i think server date can be used can it?
for example if the date on server is 07/22/2003 how can i make an iplog file wiht the name 07222003iplog.txt . i mean adding the server date as suffix or prefix to create txt file automatically .
so next day as the derver date changes the next iplog file is created as" 08222003iplog.txt" and all the ip addresses are written in that file on that day and date. That will surelymake my life easier as ip addresses shall be written as daily log files instead of one signle file automatically.... so can this be done in asp...what changes shall i have to make to the followiong code to achive this
<%
dim iplg, logFile8
set iplg=createObject("scripting.FileSystemObject")
set logFile8=iplg.openTextFile(server.mappath("IPLOG.txt"),8)
logFile8.write Request.ServerVariables("Remote_Addr") & vbcrlf
logFile8.close
set logFile8=nothing
set iplg=nothing
%>
please help me as this is more complex for me ..
thank you