Thread: VBScript help

    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2012
    Posts
    1
    Rep Power
    0

    VBScript help


    Hey guys.

    Hope everyone here had a great 4th of July holiday!

    I am building an internal site that of course is only accessible via intranet. Its primary coding is very simple. Its HTML based with some Javascript and some VBScript. I will be honest. I am not an expert programmer by any means. So here is the issue.

    We have no access to the server logs as we do not admin the logs nor are we allowed to request them. We are basically borrowing the space.

    My management wants to have each page, when accessed or clicked on (either one) to log the hit to a csv file and a txt file saved on the server. I know a lot of people dont think VBScript is the way to go. This is what is needed in each column in the log:

    Date\Time stamp \ Hostname \ NT Login \ Current page name that was loaded or clicked on from my menu (without the full URL)

    We are in a Windows XP\7 Environment. We know this server supports IIS. We are also currently using SSI for our DHMTL menu. I was hoping someone could help me use the DHTML menu as an "onclick" so that any option clicked on the menu by the client would log the above information to a specific file. We are very limited on the access we have on the server. Any advice or assistance would be helpful. I am pretty much stuck here. I need the HTML page to somehow call a VBS Script file, and when called have the VBS file log the data I posted above.

    I am not very skilled in VBS at all and this is simply a last minute side project they want to test out. So if someone could help me with this that would be excellent. Thank you in advance.
  2. #2
  3. No Profile Picture
    Stumpier old Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2003
    Posts
    14,409
    Rep Power
    4538
    Start by locating the vbscript and IIS documentation in the msdn library and read up on what you can and can't do. It sounds like you're asking for the ability for your client computer to run a script on the server, and you can't do that unless you use some server stuff like active server pages, php, etc.

    If this is important why don't you get a site where you have access to the server log files.
    ======
    Doug G
    ======
    It is a truism of American politics that no man who can win an election deserves to. --Trevanian, from the novel Shibumi
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2011
    Posts
    289
    Rep Power
    44
    I don't know if your server supports ASP code, but the following demonstrates how a web page would append to a text file on the server using ASP. In this case, the server is taking comma separated SQL string information sent to it using a "Post" function and adds it to a text file. Another program periodically polls the file, recovers the SQL data, adds it to a database, and deletes the line. Logfile entries would be simpler and would not utilize the "Post" function, but you get the idea.

    J.A. Coutts
    Code:
    <html>
    <body>
    
    <form action="mantapost.asp" method="post">
    <input type="text" name="query">
    </form>
    
    <%
    Dim ObjFSO
    Dim objFile
    If Request.Form<>"" Then
      Response.Write("Requested: " & Now & "<br>")
      Set objFSO = CreateObject("Scripting.FileSystemObject")
      Set objFile = objFSO.OpenTextFile(Server.MapPath("..\..\..\MantaData\Query.sql"), 8)
      objFile.WriteLine(Request.Form)
      objFile.Close
      Set objFile = Nothing
      Set objFSO = Nothing
      Response.Write("Processed: " & Now)
    End If
    %>
    
    </body>
    </html>

IMN logo majestic logo threadwatch logo seochat tools logo