Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 4 of 8 FirstFirst ... 23456 ... LastLast
Results 46 to 60 of 115
  1. #46
    Senior Coder
    Join Date
    Jun 2002
    Location
    41° 8' 52" N -95° 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Since this is so popular and simple, yet people somehow still have problems getting it to work, I've also added a VBScript file you can run, which will prompt you for the username, password, and URL of the protected page.

    It will then create the javascript password file for people unfamiliar with javascript. All you need to do then, is put the password file in the same directory as login.htm and auth.htm.

    The URL is not validated, so if the resulting password file doesn't work, you probably typed the URL wrong.

    The .zip file is attached to this message.

    Just double click on the "PasswordHelper.vbs" VBScript file and follow the instructions to create your password file(s). You need to run this file locally, and then upload the password file(s) to your website.

    Note: VBScript is a ©Microsoft technology, so this file will only work on Windows!

    This file is safe to run. If you get any warnings, or are concerned, you can open the .vbs file with notepad, and make sure that the code matches the following:

    Code:
    
    Option Explicit
    Dim UserName, Password, RedirectPage
    Dim fs, f
    While NOT IsAlphaNumeric(Username)
    	If Username <> "" AND NOT IsAlphaNumeric(Username) Then
    		MsgBox "Username must be alphanumeric, without spaces!",16,"Password Helper"
    	End If
    	Username = InputBox("Enter Username:","Password Helper")
    Wend
    While NOT IsAlphaNumeric(Password)
    	If Password <> "" AND NOT IsAlphaNumeric(Password) Then
    		MsgBox "Password must be alphanumeric, without spaces!",16,"Password Helper"
    	End If
    	Password = InputBox("Enter Password:","Password Helper")
    Wend
    While RedirectPage = ""
    	RedirectPage = InputBox("Please enter the URL of the password protected page:","Password Helper")
    Wend
    Set fs = CreateObject("Scripting.FileSystemObject")
    Set f = fs.OpenTextFile(LCase(Trim(Username)) & LCase(Trim(Password)) & ".js",2,True)
    f.WriteLine("auth = true;")
    f.Write("redirect = """ & RedirectPage & """;")
    Set f = Nothing
    Set fs = Nothing
    MsgBox "Password file created!",0,"Password Helper"
    
    Function IsAlphaNumeric(str)
    	Dim ianRegEx
    	Set ianRegEx = New RegExp
    	ianRegEx.Pattern = "^[a-zA-Z0-9]+$"
    	ianRegEx.Global = True
    	IsAlphaNumeric = ianRegEx.Test(str)
    End Function
    
    Attached Files Attached Files
    Last edited by whammy; 07-20-2003 at 06:08 PM.
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)

  2. #47
    New Coder
    Join Date
    Feb 2003
    Location
    Maryland
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    cool!

    very cool idea, the whole client side password protection thing-- personally ill stick with server side, but for using javascript thats amazing. the only other script ive see that would do that is one that encoded the passwords.

    anyway, just a few things anyone who has that might want to try:

    1. Try using cookies. Have it check the cookie, and if either the cookie doesnt exist, have it send them off some where in the internet, or have 1000000000000 windows pop up, or just send them to the bad password page.

    when it sends you to whatever the user's script(ie, BenastanFool.js), have this at the beginning:

    var username = "Benastan"
    var password = "Fool"
    expiredate = new Date
    expiredate.setMonth(expiredate.getMonth()+6)
    document.cookie = "username="+username+"; expires="+expiredate.toGMTString()
    document.cookie = "password="+username+"; expires="+expiredate.toGMTString()

    this way, you can access the username and password for the user in virtually any programming language!!!

    2. i can see that you obviously just threw this together, so im just gonna recommend a little style thing for anyone who will use it:

    change the html for the sign in page to:

    <html>
    <head>
    <title>Sign In</title>
    </head>
    <body>
    <table style="border: 1px solid black;">
    <form name="form1" method="post" action="">
    <tr><td colspan=2>Sign In:<font style="font-size: 10px;">Enter your username and password to sign in</font>
    <tr><td>Username: <td><input name="Login" type="text" id="Login">
    <tr><td>Password: <td><input name="Password" type="password" id="Password">
    <tr><Td colspan=2><center><input type="submit" name="Button" value="Sign In"

    onclick="self.location='chkpwd.htm?'+document.form1.Login.value+document.form1.Password.value"></center>
    </form>
    </body>
    </html>

    i forgot what else i was gonna say, oops... oh well, if you object to my new formatting for it, tell me, ill only be sad for a bit , if you actually read this entry, thank you for reading it!
    me...

  3. #48
    New Coder
    Join Date
    Aug 2003
    Location
    Liverpool
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i set up my page to test it and now when i click the login button it comes up error on page in the bottom left

    here is the link

    Can anyone tell me what I did wong?

  4. #49
    Senior Coder
    Join Date
    Jun 2002
    Location
    41° 8' 52" N -95° 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You have this:

    <INPUT type="password" ...>

    Which isn't valid HTML.
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)

  5. #50
    New Coder
    Join Date
    Aug 2003
    Location
    Liverpool
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Originally posted by Borgtex
    yes, you only need to use this attribute in the password input:

    <INPUT type="password" ...>

    this is what i added as Borgtex suggested.

    did I add it into the wrong place?

  6. #51
    Senior Coder
    Join Date
    Jun 2002
    Location
    41° 8' 52" N -95° 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    No... but it's not correct HTML. What he meant by "..." was put any other attributes there that need to go there, in place of "...".

    If you look at the original example code, you'll see what I mean. It works - because it's coded correctly. Better yet, download the .zip file I provided that has the XHTML compatible code and the password helper.

    <td>Password: </td><td><input type="text" name="pass" /></td>

    all you need to do is change the input type to "password" instead of "text"
    Last edited by whammy; 08-25-2003 at 12:41 AM.
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)

  7. #52
    New Coder
    Join Date
    Aug 2003
    Location
    Liverpool
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thank you for your help guys.......it now works fine.

    but how about the security issue? does anyone know how to fix this?

  8. #53
    Senior Coder
    Join Date
    Jun 2002
    Location
    41° 8' 52" N -95° 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    What security issue?
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)

  9. #54
    New Coder
    Join Date
    Aug 2003
    Location
    Liverpool
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    sorry, i posted this in the wrong thread

  10. #55
    New to the CF scene
    Join Date
    Oct 2003
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Many many thanks...

    Borgtex,

    I don't know much , but i do know this is a great script for certain useage.

    Thank you very much.

    exothermic

  11. #56
    New Coder
    Join Date
    Mar 2003
    Location
    Sweden
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Frames?

    I got Four frames in my website:
    1. Meny (left)
    2. News (right)
    3. Logo (up)
    4. Mainpage (in the middle)


    my password log in is in the mainpage and when the ppl log in then i dont want the page.htm (the page the ppl come to when they log in correct) only be in the middle beacuse i want to change the Meny (1) and news (2).

    My question is can I make the page.htm not framed. I mean so it will be the only page open!

  12. #57
    New to the CF scene
    Join Date
    Apr 2004
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    not sure if anyone will respond. . .BUT. . .

    was wondering if anyone knew why I can use this and easily link to any page so long as I use the http://www. . . format, but as soon as I try to link within my site I somehow can't. Why can I not redirect to /Homepage.html for example? This is how I use EVERY other link on my site. . .why is it not working here?

  13. #58
    New Coder
    Join Date
    Aug 2004
    Posts
    24
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Cool

    yeh i had the same problem when i was editing the code of the .js file. and me not being a JS person took a while to figure it out. i did eventually find out how to do it.
    eg. say you have the login.htm in folder "welcome" and you want to redirect to a folder under "welcome" named "me". open your .js and it should say

    auth = true;
    redirect = "******.htm";

    all you need to do is in the redirect part type

    auth = true;
    redirect = "me/******.htm";

    ------Heres an example site structure---------------

    ____________WELCOME_________
    ---------------||||||-------------//////:dont mind the "......"
    ||..........................................||
    .js file...................................."me"
    login.htm.................................||
    .........................................******.htm

    when you enter the username and password, login.htm will goto the .js file and look at the { redirect = "me/******.htm"; } when you added the "me/" into the redirect, it will then goto the folder named "me" in the same 'level' and will then look for the page you want to goto.

    NOTE: i think the login and .js file has to be in a higher level than the page you want to redirect to.

    hopefully i made sence for you.
    cheers

    AnniHilatE

    PS. see the script in action. http://gamingexperts.cjb.net
    goto members login and use { User=member, Pass=12345 }

  14. #59
    New to the CF scene
    Join Date
    Oct 2004
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Script help

    Wonder if anyone can help please.

    I have very little experience of js,and web design in general,and desp for help.

    Looking to create a secure login for a newletter site which will be online hopefully next week. It must be fairly secure for a number of reasons and with the option of user/password change at any time,although probably once a month. THe Whammy vb script was recommended,but I have tried everything to get it working without success.
    Downloaded script,set user/password ok. and homepage url.

    If I go into the login html file it DOES take me straight into my site,and to test if the wrong user/password is enetered into the login html it will not.

    I have a site which will be coming down this weekend,and just trying to test the script on this,so I know what to do when newsletter is up.

    Currently it uses index.html as the inital ftp load file. I have tried setting this to login html,tried all js as initial files,but still nothing.

    As the login file does not link to my index file,could this be the problem.

    I know I am missing something and its probably simple,but desp for some advise.

    My site at present was created using mindmanager

    http://homepage.ntlworld.com/brian.parker2/

    Please.

  15. #60
    Regular Coder
    Join Date
    Nov 2002
    Location
    Carmel California
    Posts
    471
    Thanks
    0
    Thanked 1 Time in 1 Post
    Well it really depends on your host, if you have access to server side languages, such as php, asp, perl, python, java etc you can do this more securely and with more conventional methods (also not to mention easier to change access lists) but if you don't this would be your alternative.
    Last edited by kwhubby; 10-23-2004 at 12:39 AM.
    Kris Hubby
    kwhubby site


 
Page 4 of 8 FirstFirst ... 23456 ... LastLast

LinkBacks (?)

  1. 02-22-2014, 07:13 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •