Windows Vista Forums

encoder.vbs and HTML
  1. #1


    Benny Pedersen Guest

    encoder.vbs and HTML

    Hi

    A friend of mine need a HTML page with password to open another HTML
    page.
    To avoid anyone to just say "View Source", I tried to encode the line
    Sub R:If login.Value="123"Then MsgBox"Okay"
    (got it converted to a VBE file, but the VBE code didn't worked in the
    HTML file?



    <html><head><title>Index</title>
    <script type="text/vbScript">
    Sub R:If login.Value="123"Then MsgBox"Okay"
    End Sub
    </script>
    </head>

    <body>
    <input type="password" name="login" size="20"> <input type="button"
    onClick="R">
    </body>
    </html>


    Benny,
    PS. This is the "Encoder.vbs" file:
    Option Explicit
    dim oEncoder, oFilesToEncode, file, sDest
    dim sFileOut, oFile, oEncFile, oFSO, i
    dim oStream, sSourceFile
    set oFilesToEncode = WScript.Arguments
    set oEncoder = CreateObject("Scripting.Encoder")
    For i = 0 to oFilesToEncode.Count - 1
    set oFSO = CreateObject("Scripting.FileSystemObject")
    file = oFilesToEncode(i)
    set oFile = oFSO.GetFile(file)
    Set oStream = oFile.OpenAsTextStream(1)
    sSourceFile=oStream.ReadAll
    oStream.Close
    sDest = oEncoder.EncodeScriptFile(".vbs",sSourceFile,0,"")
    sFileOut = Left(file, Len(file) - 3) & "vbe"
    Set oEncFile = oFSO.CreateTextFile(sFileOut)
    oEncFile.Write sDest
    oEncFile.Close
    Next

      My System SpecsSystem Spec

  2. #2


    Joe Fawcett Guest

    Re: encoder.vbs and HTML

    I believe you can use encoded files, obviously the security is really only
    minimal. But you'll need to change the mime type of the script block.
    You'll have to search for the correct mime type. Using the older style
    language attribute I think it was:
    [script language="vbscript.encode"]

    --

    Joe Fawcett (MVP - XML)
    http://joe.fawcett.name

    "Benny Pedersen" <b.pedersen@xxxxxx> wrote in message
    news:50d8331e-1b52-4533-9d98-1f3954541a23@xxxxxx

    > Hi
    >
    > A friend of mine need a HTML page with password to open another HTML
    > page.
    > To avoid anyone to just say "View Source", I tried to encode the line
    > Sub R:If login.Value="123"Then MsgBox"Okay"
    > (got it converted to a VBE file, but the VBE code didn't worked in the
    > HTML file?
    >
    > <html><head><title>Index</title>
    > <script type="text/vbScript">
    > Sub R:If login.Value="123"Then MsgBox"Okay"
    > End Sub
    > </script>
    > </head>
    >
    > <body>
    > <input type="password" name="login" size="20"> <input type="button"
    > onClick="R">
    > </body>
    > </html>
    >
    >
    > Benny,
    > PS. This is the "Encoder.vbs" file:
    > Option Explicit
    > dim oEncoder, oFilesToEncode, file, sDest
    > dim sFileOut, oFile, oEncFile, oFSO, i
    > dim oStream, sSourceFile
    > set oFilesToEncode = WScript.Arguments
    > set oEncoder = CreateObject("Scripting.Encoder")
    > For i = 0 to oFilesToEncode.Count - 1
    > set oFSO = CreateObject("Scripting.FileSystemObject")
    > file = oFilesToEncode(i)
    > set oFile = oFSO.GetFile(file)
    > Set oStream = oFile.OpenAsTextStream(1)
    > sSourceFile=oStream.ReadAll
    > oStream.Close
    > sDest = oEncoder.EncodeScriptFile(".vbs",sSourceFile,0,"")
    > sFileOut = Left(file, Len(file) - 3) & "vbe"
    > Set oEncFile = oFSO.CreateTextFile(sFileOut)
    > oEncFile.Write sDest
    > oEncFile.Close
    > Next



      My System SpecsSystem Spec

  3. #3


    Benny Pedersen Guest

    Re: encoder.vbs and HTML


    Thanks Joe

    Yes it worked when I substituted the <script type="text/vbscript">
    with language
    vbscript.encode instead.

    The encoded part of the code should not be [MsgBox "Okay"] but
    If login.Value = "123" Then Window.Location("private.html")
    or something like. Maybe it is Document.url.location.reload(page),
    hmm, don't know, but sure is that I got a lot of errors when I tried
    the hyperlink instead of the MsgBox. The MsgBox work fine
    ?

    Benny,
    www.fineraw.com

    On 27 Maj, 11:23, "Joe Fawcett" <joefawc...@xxxxxx> wrote:

    > I believe you can use encoded files, obviously the security is really only
    > minimal. But you'll need to change the mime type of the script block.
    > You'll have to search for the correct mime type. Using the older style
    > language attribute I think it was:
    > [script language="vbscript.encode"]
    >
    > --
    >
    > Joe Fawcett (MVP - XML)http://joe.fawcett.name
    >
    > "Benny Pedersen" <b.peder...@xxxxxx> wrote in message
    >
    > news:50d8331e-1b52-4533-9d98-1f3954541a23@xxxxxx
    >
    >
    >

    > > Hi
    >

    > > A friend of mine need a HTML page with password to open another HTML
    > > page.
    > > To avoid anyone to just say "View Source", I tried to encode the line
    > > Sub R:If login.Value="123"Then MsgBox"Okay"
    > > (got it converted to a VBE file, but the VBE code didn't worked in the
    > > HTML file?
    >

    > > <html><head><title>Index</title>
    > > <script type="text/vbScript">
    > > Sub R:If login.Value="123"Then MsgBox"Okay"
    > > End Sub
    > > </script>
    > > </head>
    >

    > > <body>
    > > <input type="password" name="login" size="20"> <input type="button"
    > > onClick="R">
    > > </body>
    > > </html>
    >

    > > Benny,
    > > PS. This is the "Encoder.vbs" file:
    > > Option Explicit
    > > dim oEncoder, oFilesToEncode, file, sDest
    > > dim sFileOut, oFile, oEncFile, oFSO, i
    > > dim oStream, sSourceFile
    > > set oFilesToEncode = WScript.Arguments
    > > set oEncoder = CreateObject("Scripting.Encoder")
    > > For i = 0 to oFilesToEncode.Count - 1
    > > * *set oFSO = CreateObject("Scripting.FileSystemObject")
    > > * *file = oFilesToEncode(i)
    > > * *set oFile = oFSO.GetFile(file)
    > > * *Set oStream = oFile.OpenAsTextStream(1)
    > > * *sSourceFile=oStream.ReadAll
    > > * *oStream.Close
    > > * *sDest = oEncoder.EncodeScriptFile(".vbs",sSourceFile,0,"")
    > > * *sFileOut = Left(file, Len(file) - 3) & "vbe"
    > > * *Set oEncFile = oFSO.CreateTextFile(sFileOut)
    > > * *oEncFile.Write sDest
    > > * *oEncFile.Close
    > > Next- Skjul tekst i anførselstegn -
    >
    > - Vis tekst i anførselstegn -

      My System SpecsSystem Spec

encoder.vbs and HTML problems?

Similar Threads
Thread Thread Starter Forum Replies Last Post
working on html objects using HTML DOM, VBscript Rama VB Script 3 18 Aug 2008
Using Riva Encoder with Vista Ddronron Vista General 1 24 Jun 2007
WINDOWS MEDIA ENCODER Adele Clingman Vista music pictures video 6 22 Feb 2007
Vista x64 and Mainconcepts MCE Encoder PsyberX Vista hardware & devices 4 21 Feb 2007
Media Encoder 9 Charlie Vista General 2 06 Jun 2006