Raj Nagar Extension Call Girls 9711199012 WhatsApp No, Delhi Escorts in Raj N...
A simple html login page using java s
1. ! Start New Discussion within our Web Development Community (/programming/web-
development/6/contribute)
Programming (/programming/4)
/ Web Development (/programming/web-development/6)
/ Code Snippets (/programming/web-development/code/_/6)
A Simple HTML Login page using JavaScript
5 Years Ago (https://www.daniweb.com/programming/web-development/code/330933/a-simp…
The Code Given is for only beginners in HTML
1.The code implements a simple login form
2.It checks whether the password and usernames are matching or not
3.While you are using replace the predefined username and password that I'v given
that is replace "myuserid" and "mypswrd" with your own userid and password.
4.just copy the file and paste it in the notepad.
5.and save it with an extension of .html or .htm
6.select 'All Files' from the popupmenu shown at the bottom of notepad before
saving.
7.Now you will get a document that has the symbol of internet explorer.
8.just open that file and if the computer ask for script activation press ok.
9.Now run your page
10.You can customize the page by applying CSS.
Try it....
It's Your friend,,,
Rajeesh.N.Santhu
Comments
" almostbob (/members/473744/almostbob): if BS were music this would be mozart's 40 in G
" iConqueror (/members/1109289/iconqueror): good stuff
— rajesanthu # -8 (/members/864397/rajesanthu) 27 posts since Dec 2010
https://www.daniweb.com/programming/web-development/code/330933/a-simple-html-login-page-using-javascript 16/04/2016, 6:22 PM
Page 1 of 13
3. 1. <html>
2. <head>
3. <title>
4. Login page
5. </title>
6. </head>
7. <body>
8. <h1 style="font-family:Comic Sans Ms;text-align="center";font-size
:20pt;
9. color:#00FF00;>
10. Simple Login Page
11. </h1>
12. <form name="login">
13. Username<input type="text" name="userid"/>
14. Password<input type="password" name="pswrd"/>
15. <input type="button" onclick="check(this.form)" value="Login"/>
16. <input type="reset" value="Cancel"/>
17. </form>
18. <script language="javascript">
19. function check(form)/*function to check userid & password*/
20. {
21. /*the following code checkes whether the entered userid and passw
ord are matching*/
22. if(form.userid.value == "myuserid" && form.pswrd.value == "mypswr
d")
23. {
24. window.open('target.html')/*opens the target page while Id & p
assword matches*/
25. }
26. else
27. {
28. alert("Error Password or Username")/*displays error message*/
29. }
30. }
31. </script>
32. </body>
33. </html>
$ javascript (/tags/javascript) login (/tags/login) password (/tags/password)
select (/tags/select) internet (/tags/internet)
https://www.daniweb.com/programming/web-development/code/330933/a-simple-html-login-page-using-javascript 16/04/2016, 6:22 PM
Page 3 of 13
4. (/members/867469/sachin-bhosale) sachin bhosale (/members/867469/sachin-bho…
well this is good worked but can you give example as we have to create switch case
with something like goto..
(/members/867226/rizvihaider72) rizvihaider72 2 (/members/867226/rizvihaider7…
Good for begginers
__________________
Comments
" iConqueror (/members/1109289/iconqueror): agreed
(/members/896242/rmlalchan) rmlalchan (/members/896242/rmlalchan) 5 Years A…
Quick and simple. I like it. Be nice to add multiple user logins.
(/members/1050840/yeminhtet) yeminhtet (/members/1050840/yeminhtet) 3 Year…
History Audiobooks »
Free Audiobook With 30 Day Trial!
Listen On Smartphone Or Tablet.
mobile.audible.com
https://www.daniweb.com/programming/web-development/code/330933/a-simple-html-login-page-using-javascript 16/04/2016, 6:22 PM
Page 4 of 13
5. really thank u
(/members/329818/riahc3) riahc3 45 (/members/329818/riahc3) 3 Years Ago (htt…
But........really it has no point :S
More than login page, it shows how a if works.
(/members/544941/vgkarthi) vgkarthi (/members/544941/vgkarthi) 3 Years Ago (htt…
Good for begginers
(/members/773289/f-3000) F-3000 (/members/773289/f-3000) 3 Years Ago (https://…
As a beginner's study-case, this is nice, thumbs up for that, but...
Where's the mention about that storing login-information in javascript is anything
but secure? This stuff is useful only for a toy or studying how things work, and
should never be actually used on a real web-page, and this should be clearly
mentioned somewhere in the original post. If you think that "every people will
realize things like that", you're so absolutely wrong.
@riahc3:
I've been working with javascript for years, but "this.form" inside input-element is
new thing for me.
(/members/143811/midimagic) MidiMagic 579 (/members/143811/midimagic) 3 …
https://www.daniweb.com/programming/web-development/code/330933/a-simple-html-login-page-using-javascript 16/04/2016, 6:22 PM
Page 5 of 13
6. Anyone can read the javascript source code from the web page, and figure out the
password.
Comments
" F-3000 (/members/773289/f-3000): A point I should have mentioned in my reply.
(/members/1054871/dados) dados (/members/1054871/dados) 3 Years Ago (https:…
huhhh.. then is not secure...
(/members/1090812/jtutuncumacias) jtutuncumacias (/members/1090812/jtutuncu…
Is there a more secure way to do this? As mentioned before, one can open the page
in inspect element and see the username and password. I was thinking a separate
JavaScript file where multiple users can be saved and stored with less risk. Can
anyone help me out?
(/members/94719/pritaeas) pritaeas 1,880 (/members/94719/pritaeas) 2 Years Ag…
Still the same problem that all files are readable. You'll need to use a server-side
script to validate.
Comments
I was thinking a separate JavaScript file where multiple users can be saved
and stored with less risk.
%
&
https://www.daniweb.com/programming/web-development/code/330933/a-simple-html-login-page-using-javascript 16/04/2016, 6:22 PM
Page 6 of 13
7. " iConqueror (/members/1109289/iconqueror): agreed
(/members/1091535/andrew5) Andrew_5 (/members/1091535/andrew5) 2 Years A…
ANY clientside validation of users MUST be considered visible. In order to be secure,
the connection must be encrypted (https) AND validation done on the server. For
low value, low risk applications, https might be skipped, but clientside login
validation is as safe as taping your house key to the outside of your door.
(/members/1092161/topdude155) topdude155 (/members/1092161/topdude155) …
1. <script type = "text/javascript">
2.
3. // Note: Like all Javascript password scripts, this is hopelessly insec
ure as the user can see
4. //the valid usernames/passwords and the redirect url simply with View S
ource.
5. // And the user can obtain another three tries simply by refreshing the
page.
6. //So do not use for anything serious!
7.
8. var count = 2;
9. function validate() {
10. var un = document.myform.username.value;
11. var pw = document.myform.pword.value;
12. var valid = false;
13.
14. var unArray = ["username1", "username2", "username3", "username4"]; //
as many as you like - no comma after final entry
15. var pwArray = ["password1", "password2", "password3", "password4"]; //
the corresponding passwords;
16.
17. for (var i=0; i <unArray.length; i++) {
18. if ((un == unArray[i]) && (pw == pwArray[i])) {
19. valid = true;
20. break;
21. }
22. }
23.
https://www.daniweb.com/programming/web-development/code/330933/a-simple-html-login-page-using-javascript 16/04/2016, 6:22 PM
Page 7 of 13
8. 23.
24. if (valid) {
25. alert ("Login was sucessfully processed. You will be redirected to the
members page now.");
26. window.location = "http://www.google.com";
27. return false;
28. }
29.
30. var t = " tries";
31. if (count == 1) {t = " try"}
32.
33. if (count >= 1) {
34. alert ("Invalid username and/or password. You have " + count + t + " l
eft.");
35. document.myform.username.value = "";
36. document.myform.pword.value = "";
37. setTimeout("document.myform.username.focus()", 25);
38. setTimeout("document.myform.username.select()", 25);
39. count --;
40. }
41.
42. else {
43. alert ("Still incorrect! You have no more tries left!");
44. document.myform.username.value = "No more tries allowed!";
45. document.myform.pword.value = "";
46. document.myform.username.disabled = true;
47. document.myform.pword.disabled = true;
48. return false;
49. }
50.
51. }
52.
53. </script>
54.
55. <form name = "myform">
56. <p>ENTER USER NAME <input type="text" name="username"> ENTER PASSWORD <
input type="password" name="pword">
57. <input type="button" value="Check In" name="Submit" onclick= "validate(
)">
58. </p>
59.
60. </form>
(/members/1109108/harpriyagill7) harpriya.gill.7 (/members/1109108/harpriyagill7) …
https://www.daniweb.com/programming/web-development/code/330933/a-simple-html-login-page-using-javascript 16/04/2016, 6:22 PM
Page 8 of 13
9. thnx... i felt it really helpful as m jus a beginner
(/members/1109763/sud4u) Sud4U (/members/1109763/sud4u) 1 Year Ago (https:…
suppose if we have a login screen on domain.com and we redirect the page to
domain.com/dashboard after login. Here domain.com/dashboard can still be
accessed if the visitor puts that in browser directly.
Any solution for that.
Further the password would be still visible from the source code.
(/members/473744/almostbob) almostbob 866 (/members/473744/almostbob) …
Sud, the op is long gone, its three years old
the code, was garbage then, is garbage now
Clientside is not where login is managed,
thats a server function
every blog or cms includes user management, from wordpress up down and
sideways, to custom written applications
Comments
" JorgeM (/members/929775/jorgem): garbage is exactly what i was thinking. This example
shouldnt even be used for testing purposes. People...do not create login forms with a javascript
authentication scheme. No!
scrat@1 -3 (/members/1112610/scrat1) 1 Year Ago (https://www.daniweb.com/progra…
https://www.daniweb.com/programming/web-development/code/330933/a-simple-html-login-page-using-javascript 16/04/2016, 6:22 PM
Page 9 of 13
10. how can i add email in place of username ????
Comments
" diafol (/members/120589/diafol): read the posts
(/members/1026332/mattster) mattster 195 (/members/1026332/mattster) 1 Ye…
^ Read what they are saying: this is garbage, start looking at a server-side language.
(/members/1120496/satishmuktawar) satish.muktawar -3 (/members/1120496/sat…
heir am tring to write username and password but still it is not accepting why?
Comments
" diafol (/members/120589/diafol): read the posts
https://www.daniweb.com/programming/web-development/code/330933/a-simple-html-login-page-using-javascript 16/04/2016, 6:22 PM
Page 10 of 13
12. $ ajax (/tags/ajax) asp (/tags/asp) asp.net (/tags/asp.net) html (/tags/html) internet (/tags/internet)
javascript (/tags/javascript) jquery (/tags/jquery) jsp (/tags/jsp) mysql (/tags/mysql) php (/tags/php)
File Upload not
working for audio
and video files
ASP.net Jquery Modal
Pop Up Help
Codeigniter - Clone
form field, entering
in dat...
Populating High
Charts Pie Chart via
PHP & MySQL
problem to insert
data into database
using chec...
Form Inside Table
Getting Messed Up
About Us (/home/about) Contact Us (/home/contact)
Donate (/home/donate) Advertising (/home/advertising)
https://www.daniweb.com/programming/web-development/code/330933/a-simple-html-login-page-using-javascript 16/04/2016, 6:22 PM
Page 12 of 13