Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - encoder.vbs and HTML

Reply
 
Old 05-26-2009   #1 (permalink)
Benny Pedersen


 
 

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
Old 05-27-2009   #2 (permalink)
Joe Fawcett


 
 

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
Quote:

> 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
Old 05-27-2009   #3 (permalink)
Benny Pedersen


 
 

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:
Quote:

> 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
>
>
>
Quote:

> > Hi
>
Quote:

> > 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?
>
Quote:

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

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

> > 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
Reply

Thread Tools


Similar Threads
Thread Forum
Windows Media Encoder Media Center
Riva FLV Encoder APPCRASH Software
working on html objects using HTML DOM, VBscript VB Script
Media Player Encoder Vista General
Media Encoder 9 Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46