471,851 Members | 1,032 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,851 software developers and data experts.

Password Problem

I am new to javascript..

i have a made a form simply containing username textfield, the password text field and the submit button..

when the user click on the submit button i want to them to go to a certain url if the password is correct ...

i want the password to be stored in a separate javascript file ....is that possible

plz can anybody teach me how to do it ...
Apr 11 '09 #1
5 1169
8,658 Expert Mod 8TB
I strongly recommend doing the password check on the server. Although there is a possibility to use md5 and sha1 hash functions* (link).

* never store the passwords in plain text, better store its hash value somewhere and compare it with the hashed return of the supposed to be password from the input.
Apr 11 '09 #2
I just don't know how to do that ..could you provide me the code plz
Apr 11 '09 #3
8,658 Expert Mod 8TB
Javascript or server side?
Apr 11 '09 #4
server side .. if its not much trouble for you
Apr 11 '09 #5
8,658 Expert Mod 8TB
basicly it runs like that (I'm using PHP here)
Expand|Select|Wrap|Line Numbers
  1. if ( hash(HASH_TYPE, $_POST['password']) == STORED_PW_HASH )
  2.   // I use 'ripemd256', at least use 'sha256'
  3.   // HASH_TYPE & STORED_PW_HASH may as well be class constants
  4. {
  5.     // do allowed things like setting $_SESSION etc.
  6. }
Apr 11 '09 #6

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

11 posts views Thread by John Victor | last post: by
6 posts views Thread by John Morgan | last post: by
4 posts views Thread by Jonathan Dienst | last post: by
7 posts views Thread by Dino M. Buljubasic | last post: by
6 posts views Thread by Frank L | last post: by
5 posts views Thread by John | last post: by
3 posts views Thread by Noel S Pamfree | last post: by
reply views Thread by YellowAndGreen | last post: by
reply views Thread by aboka | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.