codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:



Home » Javascript » Article

Javascript Scripted Password Entry Login

Article by: Drew Bowman (1/6/2003)
Bookmark us now! Add to Favourites
Email a friend!Tell a friend
Summary: Create a password protected page using this neat javascript prompt.
Viewed: 176231 times Rating (105 votes): 
 3.9 out of 5
 Rate this Article  Read Comments  Post Comments

Javascript Scripted Password Entry Login

Live Demo

This javascript provides a way for internet users to login to a "secure page". This is achieved by sending a user to a filename based upon their username and password. If an incorrect username or password is entered the page is not loaded that sends the user to the "secure page".
Code
  • This is the code that should be placed on the initial webpage that you would like your users to login from:
  •  
Code of User-File
  • This file should be duplicated for every new user that you "add" to your acceptance list. Save this file using the format USERNAME~PASSWORD.htm Please note that if a value is set for the variable userFolder in the previous file these files must be saved in that relative directory.
  •  


Developer Notes
  • Variables userFolder - This variable specifies if the user-file is located in another directory other than the same directory as the login page. This should be relative (e.g. "users/" instead of "http://mysite.com/users/" ).
      HTMLextention - This specifies what extention the user-file (e.g. bob~1234.htm) uses. This should be ".htm" or ".html"
      inProgressMSG - This is the text that is shown when a user hits the "Login" button
      userFailMSG - This is the text that is shown when a user has entered an invalid username/password or the login script has timed out (default: 15 seconds)
      membersPage - Located in the user-file, this variable must be set to the URL of your "members page"
    Filenames To add users you must copy the user-file and rename it. The filename takes this form: username~password.ext, so to add user "John" with password "1234" you need to create the file john~1234.htm . Please note that if your server is case sensitive the user login page will be as well.





CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums
Rate this article:     Poor Excellent
View highlighted Comments
User Comments on 'Javascript Scripted Password Entry Login'
RELATED ARTICLES
Javascript - Enable and Disable form elements
by Jeff Anderson
This is a relatively little known and under-used feature of javascript which can be very useful in guiding a user through a form. Using the disabled tag, you can switch on and off elements in a form.
Check IsNumeric Function
by Jeff Anderson
A javascript validation function to check whether the details entered by a user are numeric.
Javascript Onload Event
by Jeff Anderson
Sometimes you need to perform an action immediatley after the page has loaded. That's when the onLoad Event Handler comes in handy
Javascript Get Selected Text
by Jeff Anderson
A cross-browser script to get text selected by the user
Form Validation Function
by Jeff Anderson
A javascript validation function that you can use to validate all types of forms.
JavaScript Field Is Empty Form Validation
by Jeff Anderson
This javascript function allows you to check whether a form field has been completed or not.
Check Email Validation Function
by Jeff Anderson
A javascript validation function to check whether the user has entered a valid email address in a form.
Javascript onUnload Event Handler
by Jeff Anderson
The onUnload Event Handler allows you to perform an action as the user leaves the page.
Multiple submit buttons on a single form
by Kiran Pai
This script shows you how to submit the contents of a form to different programs depending on which Submit button you press. Additionally it also shows how to call two different functions when you press the Submit button.
Simple date validation
by Chris Hogben
function that takes a date in three parts, day, month and year - returns true if it's a valid date.








Recent Forum Threads
• Global.Mapper.v15.2.3.b060614
• Geometric_Glovius_Pro_v3.6.1
• VERO.SurfCAM.v2014
• Schlumberger.Petrel.V2013.2
• Petrel.V2013.2
• Altair.HyperWorks.v12
• VoluMill.v6.1
• VoluMill.NEXION.6
• VERO.SurfCAM.v2014


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2014