![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | 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 Specs![]() |
| | #2 (permalink) |
| | 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 Specs![]() |
| | #3 (permalink) |
| | 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 Specs![]() |
![]() |
| 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 | |||