Need help! Web-based LAN Scanner

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jhayzapi
    New Member
    • Sep 2007
    • 2

    Need help! Web-based LAN Scanner

    Guys, im just a newbie here, i have a school project and its a web-based project that scans all Internet Protocol (IP) in a Local Area Network (LAN) and displays a green light image if the workstation is online and red light image if offline, this is my coding:[code=asp]
    <% Response.Buffer = true %>
    <%
    url = "192.168.0. 1"

    Set objWShell = CreateObject("W Script.Shell")
    Set objCmd = objWShell.Exec( "ping " & url)
    strPResult = objCmd.StdOut.R eadall()
    set objCmd = nothing: Set objWShell = nothing

    strStatus = "offline"
    if InStr(strPResul t,"TTL=")>0 then strStatus = "online"

    response.write url & " is " & strStatus

    %>[/code]
    if the ip is offline then the output here is:
    192.168.0.1 is offline
    my question is... if there's any code that changes the value of 'strStatus' into image that is located in 'Images\offline .gif' ? Btw, im using ASP VBScript.

    Thanks in advance guys.
    Last edited by jhardman; Sep 26 '07, 07:09 PM. Reason: put code in code tags. please use code tags in the future, notice the button marked --#--
  • jhardman
    Recognized Expert Specialist
    • Jan 2007
    • 3405

    #2
    ASP's output is generally just printing out HTML code. In your case you are printing out the word "offline" or "online" but you could just as easily print out any HTML code including an image tag. So why don't you say [code=asp]strStatus = "<img src='...'>"[/code] instead of [code=asp]strStatus = "offline"[/code]?

    Jared

    Comment

    • jhayzapi
      New Member
      • Sep 2007
      • 2

      #3
      Originally posted by jhardman
      ASP's output is generally just printing out HTML code. In your case you are printing out the word "offline" or "online" but you could just as easily print out any HTML code including an image tag. So why don't you say [code=asp]strStatus = "<img src='...'>"[/code] instead of [code=asp]strStatus = "offline"[/code]?

      Jared

      Thanks, already tried it and it works!

      Comment

      Working...