Home » questions » What is a good JavaScript code for a log-in page?

What is a good JavaScript code for a log-in page?

2006-08-02 19:46:22, Category: Programming & Design
It needs to be made using cookies and JavaScript and variables; something that is basic yet still partially secure. It doesn't need to be the most secure thing in the world. Only JavaScript though, no ASP or PHP because it needs to be something I can understand. Thank you so much!

Answers

  1. bryanchen

    On 2006-08-02 19:56:17


    Firstly, I think if you can understand JavaScript, PHP would be a breeze for you! Javascript-protected paged are generally insecure. This is because mostly, the password can be readable by people if they know where to look. Even if it opens a prompt before loading the actual page, it is still insecure simply because the page has already been loaded and its source can be inspected to retrieve the password. But if I had to use JavaScript, I'd go with script that prompts the user for a username and password, then redirects the user to the protected page that is named something like -.html. This is because the username and password is not embedded within the code itself. This will circumvent most users from knowing the username and password. Hope this helps! Have fun with programming!! In response to the above reply... Basic Authentication may or may not be allowed, depending on your web host. Generally in Linux servers with appropriate options on, you'll just have to create a file called .htaccess in your directory. There is no such thing as cannot be done. Mostly, it's a balance between issues like speed, security, complexity and functionality.
  2. sheeple_rancher

    On 2006-08-02 19:54:35


    You cannot log into anything with javascript alone. You need something on the server to receive login info and do something with it. Period. That means asp, php or other, but not javascript. At best, you can have a 'basic authorization' setup and use javascript to pass name and password. But this only gives users password-controlled access to a directory, nothing more. You would have no user tracking. (Maybe that is enough for you - to have private pages). What you might want to consider is finding pre-written scripts that you can simply install and use (no programming).