SlideShare a Scribd company logo
1 of 13
Download to read offline
! 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
(/
m
e
m
b
e
rs
/
8
6
4
3
9
7
/r
aj
e
s
a
n
t
h
u)
https://www.daniweb.com/programming/web-development/code/330933/a-simple-html-login-page-using-javascript 16/04/2016, 6:22 PM
Page 2 of 13
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
(/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
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
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
" 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
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
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
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
Submit your Reply Alt+S
2 (/programming/web-development/code/330933/a-simple-html-login-
page-using-javascript/2)
→ (/programming/web-development/code/330933/a-simple-html-
login-page-using-javascript/2)
Page 1
https://www.daniweb.com/programming/web-development/code/330933/a-simple-html-login-page-using-javascript 16/04/2016, 6:22 PM
Page 11 of 13
$ 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
© 2002 - 2016 DaniWeb® LLC • 3825 Bell Blvd., Bayside, NY 11361 •
Vendor Program (/home/vendors) API (/api/home)
Terms of Service (/home/tos)
516 222-1700 (tel:516 222-
1700)
https://www.daniweb.com/programming/web-development/code/330933/a-simple-html-login-page-using-javascript 16/04/2016, 6:22 PM
Page 13 of 13

More Related Content

What's hot

oAuth end point
oAuth end pointoAuth end point
oAuth end pointGiri Raj
 
Lession 2 starting with mssqlserver
Lession 2 starting with mssqlserverLession 2 starting with mssqlserver
Lession 2 starting with mssqlserverĐỗ Đức Hùng
 
TYCS Visual Basic Practicals
TYCS Visual Basic PracticalsTYCS Visual Basic Practicals
TYCS Visual Basic Practicalsyogita kachve
 
Concrete5 Multiple Reflected XSS Advisory
Concrete5 Multiple Reflected XSS AdvisoryConcrete5 Multiple Reflected XSS Advisory
Concrete5 Multiple Reflected XSS AdvisoryMinded Security
 
Concrete5 Sendmail RCE Advisory
Concrete5 Sendmail RCE AdvisoryConcrete5 Sendmail RCE Advisory
Concrete5 Sendmail RCE AdvisoryMinded Security
 
Introduction to ASP.NET MVC 2
Introduction to ASP.NET MVC 2Introduction to ASP.NET MVC 2
Introduction to ASP.NET MVC 2Joe Wilson
 
TYCS Ajax practicals sem VI
TYCS Ajax practicals sem VI TYCS Ajax practicals sem VI
TYCS Ajax practicals sem VI yogita kachve
 

What's hot (9)

oAuth end point
oAuth end pointoAuth end point
oAuth end point
 
Lession 2 starting with mssqlserver
Lession 2 starting with mssqlserverLession 2 starting with mssqlserver
Lession 2 starting with mssqlserver
 
TYCS Visual Basic Practicals
TYCS Visual Basic PracticalsTYCS Visual Basic Practicals
TYCS Visual Basic Practicals
 
Concrete5 Multiple Reflected XSS Advisory
Concrete5 Multiple Reflected XSS AdvisoryConcrete5 Multiple Reflected XSS Advisory
Concrete5 Multiple Reflected XSS Advisory
 
XSS Exploitation
XSS ExploitationXSS Exploitation
XSS Exploitation
 
Concrete5 Sendmail RCE Advisory
Concrete5 Sendmail RCE AdvisoryConcrete5 Sendmail RCE Advisory
Concrete5 Sendmail RCE Advisory
 
Introduction to ASP.NET MVC 2
Introduction to ASP.NET MVC 2Introduction to ASP.NET MVC 2
Introduction to ASP.NET MVC 2
 
Fast by Default
Fast by DefaultFast by Default
Fast by Default
 
TYCS Ajax practicals sem VI
TYCS Ajax practicals sem VI TYCS Ajax practicals sem VI
TYCS Ajax practicals sem VI
 

Similar to A simple html login page using java s

User authentication module using php
User authentication module using phpUser authentication module using php
User authentication module using phpRishabh Srivastava
 
Private slideshow
Private slideshowPrivate slideshow
Private slideshowsblackman
 
What Web Developers Need to Know to Develop Windows 8 Apps
What Web Developers Need to Know to Develop Windows 8 AppsWhat Web Developers Need to Know to Develop Windows 8 Apps
What Web Developers Need to Know to Develop Windows 8 AppsDoris Chen
 
Easy logins for JavaScript web applications
Easy logins for JavaScript web applicationsEasy logins for JavaScript web applications
Easy logins for JavaScript web applicationsFrancois Marier
 
Scout xss csrf_security_presentation_chicago
Scout xss csrf_security_presentation_chicagoScout xss csrf_security_presentation_chicago
Scout xss csrf_security_presentation_chicagoknaddison
 
OWASP Top 10 - DrupalCon Amsterdam 2019
OWASP Top 10 - DrupalCon Amsterdam 2019OWASP Top 10 - DrupalCon Amsterdam 2019
OWASP Top 10 - DrupalCon Amsterdam 2019Ayesh Karunaratne
 
02 banking trojans-thomassiebert
02 banking trojans-thomassiebert02 banking trojans-thomassiebert
02 banking trojans-thomassiebertgeeksec80
 
Security: Odoo Code Hardening
Security: Odoo Code HardeningSecurity: Odoo Code Hardening
Security: Odoo Code HardeningOdoo
 
AFUP Lorraine - Symfony Webpack Encore
AFUP Lorraine - Symfony Webpack EncoreAFUP Lorraine - Symfony Webpack Encore
AFUP Lorraine - Symfony Webpack EncoreEngineor
 
CICONF 2012 - Don't Make Me Read Your Mind
CICONF 2012 - Don't Make Me Read Your MindCICONF 2012 - Don't Make Me Read Your Mind
CICONF 2012 - Don't Make Me Read Your Mindciconf
 
Everybody loves html5,h4ck3rs too
Everybody loves html5,h4ck3rs tooEverybody loves html5,h4ck3rs too
Everybody loves html5,h4ck3rs tooNahidul Kibria
 
DrupalCon Dublin 2016 - Automated browser testing with Nightwatch.js
DrupalCon Dublin 2016 - Automated browser testing with Nightwatch.jsDrupalCon Dublin 2016 - Automated browser testing with Nightwatch.js
DrupalCon Dublin 2016 - Automated browser testing with Nightwatch.jsVladimir Roudakov
 

Similar to A simple html login page using java s (20)

Micro frontends
Micro frontendsMicro frontends
Micro frontends
 
Java script
Java scriptJava script
Java script
 
User authentication module using php
User authentication module using phpUser authentication module using php
User authentication module using php
 
The Devil and HTML5
The Devil and HTML5The Devil and HTML5
The Devil and HTML5
 
Private slideshow
Private slideshowPrivate slideshow
Private slideshow
 
What Web Developers Need to Know to Develop Windows 8 Apps
What Web Developers Need to Know to Develop Windows 8 AppsWhat Web Developers Need to Know to Develop Windows 8 Apps
What Web Developers Need to Know to Develop Windows 8 Apps
 
Easy logins for JavaScript web applications
Easy logins for JavaScript web applicationsEasy logins for JavaScript web applications
Easy logins for JavaScript web applications
 
Scout xss csrf_security_presentation_chicago
Scout xss csrf_security_presentation_chicagoScout xss csrf_security_presentation_chicago
Scout xss csrf_security_presentation_chicago
 
Synapse india basic php development part 2
Synapse india basic php development part 2Synapse india basic php development part 2
Synapse india basic php development part 2
 
OWASP Top 10 - DrupalCon Amsterdam 2019
OWASP Top 10 - DrupalCon Amsterdam 2019OWASP Top 10 - DrupalCon Amsterdam 2019
OWASP Top 10 - DrupalCon Amsterdam 2019
 
Webauthn Tutorial
Webauthn TutorialWebauthn Tutorial
Webauthn Tutorial
 
Java script
Java scriptJava script
Java script
 
Owasp top 10 2013
Owasp top 10 2013Owasp top 10 2013
Owasp top 10 2013
 
02 banking trojans-thomassiebert
02 banking trojans-thomassiebert02 banking trojans-thomassiebert
02 banking trojans-thomassiebert
 
Security: Odoo Code Hardening
Security: Odoo Code HardeningSecurity: Odoo Code Hardening
Security: Odoo Code Hardening
 
AFUP Lorraine - Symfony Webpack Encore
AFUP Lorraine - Symfony Webpack EncoreAFUP Lorraine - Symfony Webpack Encore
AFUP Lorraine - Symfony Webpack Encore
 
CICONF 2012 - Don't Make Me Read Your Mind
CICONF 2012 - Don't Make Me Read Your MindCICONF 2012 - Don't Make Me Read Your Mind
CICONF 2012 - Don't Make Me Read Your Mind
 
Java script
Java scriptJava script
Java script
 
Everybody loves html5,h4ck3rs too
Everybody loves html5,h4ck3rs tooEverybody loves html5,h4ck3rs too
Everybody loves html5,h4ck3rs too
 
DrupalCon Dublin 2016 - Automated browser testing with Nightwatch.js
DrupalCon Dublin 2016 - Automated browser testing with Nightwatch.jsDrupalCon Dublin 2016 - Automated browser testing with Nightwatch.js
DrupalCon Dublin 2016 - Automated browser testing with Nightwatch.js
 

Recently uploaded

VIP Call Girls Service Bhagyanagar Hyderabad Call +91-8250192130
VIP Call Girls Service Bhagyanagar Hyderabad Call +91-8250192130VIP Call Girls Service Bhagyanagar Hyderabad Call +91-8250192130
VIP Call Girls Service Bhagyanagar Hyderabad Call +91-8250192130Suhani Kapoor
 
Captivating Charm: Exploring Marseille's Hillside Villas with Our 3D Architec...
Captivating Charm: Exploring Marseille's Hillside Villas with Our 3D Architec...Captivating Charm: Exploring Marseille's Hillside Villas with Our 3D Architec...
Captivating Charm: Exploring Marseille's Hillside Villas with Our 3D Architec...Yantram Animation Studio Corporation
 
Cosumer Willingness to Pay for Sustainable Bricks
Cosumer Willingness to Pay for Sustainable BricksCosumer Willingness to Pay for Sustainable Bricks
Cosumer Willingness to Pay for Sustainable Bricksabhishekparmar618
 
Revit Understanding Reference Planes and Reference lines in Revit for Family ...
Revit Understanding Reference Planes and Reference lines in Revit for Family ...Revit Understanding Reference Planes and Reference lines in Revit for Family ...
Revit Understanding Reference Planes and Reference lines in Revit for Family ...Narsimha murthy
 
Fashion trends before and after covid.pptx
Fashion trends before and after covid.pptxFashion trends before and after covid.pptx
Fashion trends before and after covid.pptxVanshNarang19
 
VVIP Pune Call Girls Hadapsar (7001035870) Pune Escorts Nearby with Complete ...
VVIP Pune Call Girls Hadapsar (7001035870) Pune Escorts Nearby with Complete ...VVIP Pune Call Girls Hadapsar (7001035870) Pune Escorts Nearby with Complete ...
VVIP Pune Call Girls Hadapsar (7001035870) Pune Escorts Nearby with Complete ...Call Girls in Nagpur High Profile
 
SD_The MATATAG Curriculum Training Design.pptx
SD_The MATATAG Curriculum Training Design.pptxSD_The MATATAG Curriculum Training Design.pptx
SD_The MATATAG Curriculum Training Design.pptxjanettecruzeiro1
 
VIP College Call Girls Gorakhpur Bhavna 8250192130 Independent Escort Service...
VIP College Call Girls Gorakhpur Bhavna 8250192130 Independent Escort Service...VIP College Call Girls Gorakhpur Bhavna 8250192130 Independent Escort Service...
VIP College Call Girls Gorakhpur Bhavna 8250192130 Independent Escort Service...Suhani Kapoor
 
Call Girls in Okhla Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Okhla Delhi 💯Call Us 🔝8264348440🔝Call Girls in Okhla Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Okhla Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
call girls in Harsh Vihar (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Harsh Vihar (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Harsh Vihar (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Harsh Vihar (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
VIP Russian Call Girls in Gorakhpur Deepika 8250192130 Independent Escort Ser...
VIP Russian Call Girls in Gorakhpur Deepika 8250192130 Independent Escort Ser...VIP Russian Call Girls in Gorakhpur Deepika 8250192130 Independent Escort Ser...
VIP Russian Call Girls in Gorakhpur Deepika 8250192130 Independent Escort Ser...Suhani Kapoor
 
Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...
Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...
Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...home
 
Kala jadu for love marriage | Real amil baba | Famous amil baba | kala jadu n...
Kala jadu for love marriage | Real amil baba | Famous amil baba | kala jadu n...Kala jadu for love marriage | Real amil baba | Famous amil baba | kala jadu n...
Kala jadu for love marriage | Real amil baba | Famous amil baba | kala jadu n...babafaisel
 
MASONRY -Building Technology and Construction
MASONRY -Building Technology and ConstructionMASONRY -Building Technology and Construction
MASONRY -Building Technology and Constructionmbermudez3
 
The history of music videos a level presentation
The history of music videos a level presentationThe history of music videos a level presentation
The history of music videos a level presentationamedia6
 
Cheap Rate Call girls Kalkaji 9205541914 shot 1500 night
Cheap Rate Call girls Kalkaji 9205541914 shot 1500 nightCheap Rate Call girls Kalkaji 9205541914 shot 1500 night
Cheap Rate Call girls Kalkaji 9205541914 shot 1500 nightDelhi Call girls
 
NO1 Trending kala jadu Love Marriage Black Magic Punjab Powerful Black Magic ...
NO1 Trending kala jadu Love Marriage Black Magic Punjab Powerful Black Magic ...NO1 Trending kala jadu Love Marriage Black Magic Punjab Powerful Black Magic ...
NO1 Trending kala jadu Love Marriage Black Magic Punjab Powerful Black Magic ...Amil baba
 
Call Girls in Kalkaji Delhi 8264348440 call girls ❤️
Call Girls in Kalkaji Delhi 8264348440 call girls ❤️Call Girls in Kalkaji Delhi 8264348440 call girls ❤️
Call Girls in Kalkaji Delhi 8264348440 call girls ❤️soniya singh
 
Raj Nagar Extension Call Girls 9711199012 WhatsApp No, Delhi Escorts in Raj N...
Raj Nagar Extension Call Girls 9711199012 WhatsApp No, Delhi Escorts in Raj N...Raj Nagar Extension Call Girls 9711199012 WhatsApp No, Delhi Escorts in Raj N...
Raj Nagar Extension Call Girls 9711199012 WhatsApp No, Delhi Escorts in Raj N...ankitnayak356677
 

Recently uploaded (20)

VIP Call Girls Service Bhagyanagar Hyderabad Call +91-8250192130
VIP Call Girls Service Bhagyanagar Hyderabad Call +91-8250192130VIP Call Girls Service Bhagyanagar Hyderabad Call +91-8250192130
VIP Call Girls Service Bhagyanagar Hyderabad Call +91-8250192130
 
Captivating Charm: Exploring Marseille's Hillside Villas with Our 3D Architec...
Captivating Charm: Exploring Marseille's Hillside Villas with Our 3D Architec...Captivating Charm: Exploring Marseille's Hillside Villas with Our 3D Architec...
Captivating Charm: Exploring Marseille's Hillside Villas with Our 3D Architec...
 
Cosumer Willingness to Pay for Sustainable Bricks
Cosumer Willingness to Pay for Sustainable BricksCosumer Willingness to Pay for Sustainable Bricks
Cosumer Willingness to Pay for Sustainable Bricks
 
Revit Understanding Reference Planes and Reference lines in Revit for Family ...
Revit Understanding Reference Planes and Reference lines in Revit for Family ...Revit Understanding Reference Planes and Reference lines in Revit for Family ...
Revit Understanding Reference Planes and Reference lines in Revit for Family ...
 
Fashion trends before and after covid.pptx
Fashion trends before and after covid.pptxFashion trends before and after covid.pptx
Fashion trends before and after covid.pptx
 
Call Girls Service Mukherjee Nagar @9999965857 Delhi 🫦 No Advance VVIP 🍎 SER...
Call Girls Service Mukherjee Nagar @9999965857 Delhi 🫦 No Advance  VVIP 🍎 SER...Call Girls Service Mukherjee Nagar @9999965857 Delhi 🫦 No Advance  VVIP 🍎 SER...
Call Girls Service Mukherjee Nagar @9999965857 Delhi 🫦 No Advance VVIP 🍎 SER...
 
VVIP Pune Call Girls Hadapsar (7001035870) Pune Escorts Nearby with Complete ...
VVIP Pune Call Girls Hadapsar (7001035870) Pune Escorts Nearby with Complete ...VVIP Pune Call Girls Hadapsar (7001035870) Pune Escorts Nearby with Complete ...
VVIP Pune Call Girls Hadapsar (7001035870) Pune Escorts Nearby with Complete ...
 
SD_The MATATAG Curriculum Training Design.pptx
SD_The MATATAG Curriculum Training Design.pptxSD_The MATATAG Curriculum Training Design.pptx
SD_The MATATAG Curriculum Training Design.pptx
 
VIP College Call Girls Gorakhpur Bhavna 8250192130 Independent Escort Service...
VIP College Call Girls Gorakhpur Bhavna 8250192130 Independent Escort Service...VIP College Call Girls Gorakhpur Bhavna 8250192130 Independent Escort Service...
VIP College Call Girls Gorakhpur Bhavna 8250192130 Independent Escort Service...
 
Call Girls in Okhla Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Okhla Delhi 💯Call Us 🔝8264348440🔝Call Girls in Okhla Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Okhla Delhi 💯Call Us 🔝8264348440🔝
 
call girls in Harsh Vihar (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Harsh Vihar (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Harsh Vihar (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Harsh Vihar (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
VIP Russian Call Girls in Gorakhpur Deepika 8250192130 Independent Escort Ser...
VIP Russian Call Girls in Gorakhpur Deepika 8250192130 Independent Escort Ser...VIP Russian Call Girls in Gorakhpur Deepika 8250192130 Independent Escort Ser...
VIP Russian Call Girls in Gorakhpur Deepika 8250192130 Independent Escort Ser...
 
Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...
Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...
Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...
 
Kala jadu for love marriage | Real amil baba | Famous amil baba | kala jadu n...
Kala jadu for love marriage | Real amil baba | Famous amil baba | kala jadu n...Kala jadu for love marriage | Real amil baba | Famous amil baba | kala jadu n...
Kala jadu for love marriage | Real amil baba | Famous amil baba | kala jadu n...
 
MASONRY -Building Technology and Construction
MASONRY -Building Technology and ConstructionMASONRY -Building Technology and Construction
MASONRY -Building Technology and Construction
 
The history of music videos a level presentation
The history of music videos a level presentationThe history of music videos a level presentation
The history of music videos a level presentation
 
Cheap Rate Call girls Kalkaji 9205541914 shot 1500 night
Cheap Rate Call girls Kalkaji 9205541914 shot 1500 nightCheap Rate Call girls Kalkaji 9205541914 shot 1500 night
Cheap Rate Call girls Kalkaji 9205541914 shot 1500 night
 
NO1 Trending kala jadu Love Marriage Black Magic Punjab Powerful Black Magic ...
NO1 Trending kala jadu Love Marriage Black Magic Punjab Powerful Black Magic ...NO1 Trending kala jadu Love Marriage Black Magic Punjab Powerful Black Magic ...
NO1 Trending kala jadu Love Marriage Black Magic Punjab Powerful Black Magic ...
 
Call Girls in Kalkaji Delhi 8264348440 call girls ❤️
Call Girls in Kalkaji Delhi 8264348440 call girls ❤️Call Girls in Kalkaji Delhi 8264348440 call girls ❤️
Call Girls in Kalkaji Delhi 8264348440 call girls ❤️
 
Raj Nagar Extension Call Girls 9711199012 WhatsApp No, Delhi Escorts in Raj N...
Raj Nagar Extension Call Girls 9711199012 WhatsApp No, Delhi Escorts in Raj N...Raj Nagar Extension Call Girls 9711199012 WhatsApp No, Delhi Escorts in Raj N...
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
  • 11. Submit your Reply Alt+S 2 (/programming/web-development/code/330933/a-simple-html-login- page-using-javascript/2) → (/programming/web-development/code/330933/a-simple-html- login-page-using-javascript/2) Page 1 https://www.daniweb.com/programming/web-development/code/330933/a-simple-html-login-page-using-javascript 16/04/2016, 6:22 PM Page 11 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
  • 13. © 2002 - 2016 DaniWeb® LLC • 3825 Bell Blvd., Bayside, NY 11361 • Vendor Program (/home/vendors) API (/api/home) Terms of Service (/home/tos) 516 222-1700 (tel:516 222- 1700) https://www.daniweb.com/programming/web-development/code/330933/a-simple-html-login-page-using-javascript 16/04/2016, 6:22 PM Page 13 of 13