IP Addresses Page 4

By ServerWatch Staff (Send Email)
Posted Nov 23, 1998


Creating the link is as simple as reading the address file and writing the address out!

<%
set FileObject = server.CreateObject("Scripting.FileSystemObject")
in_file = "addr.ip"
temp = SERVER.MAPPATH(REQUEST.SERVERVARIABLES("PATH_INFO"))

'get the current directory
i = len(temp) - 1
j = i
done = 0
do while done = 0
    if mid(temp,i,1) = "\" then
        FTP_PATH = MID(TEMP,1, i)
        done = 1
   else
       i = i - 1
       if i = 0 then
         done = 1
      end if
  end if
loop

file_name = FTP_PATH & in_file ' create the full filename with path
on error resume next
Set InStream= FileObject.OpenTextFile (file_name, 1, False, False)

if err.number <> 0 then
   response.write ("Sorry, Bobs dynamic link server is not up") ' no file to read
else
   address =Trim( InStream.Readline )
   my_time =Trim( InStream.Readline )
   if address = "OUT" then ' OUT means we have signed out
      response.write ("Sorry, dynamic link was signed out " & my_time & "<br>")
      response.write ("I am probably still at work, try again later")
else
   %>  ' we have a good address at this point so create a link
<p><a href="http://<%=address%>">A dynamic link: up since <%=my_time%></a> 
<%
END IF
END IF %>

It's that easy!

 

Page 4 of 4


Comment and Contribute

Your name/nickname

Your email

(Maximum characters: 1200). You have characters left.


 

 


Thanks for your registration, follow us on our social networks to keep up-to-date