How can I create a password protected login system in html | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

How can I create a password protected login system in html

I've created a simple login system but I want to give a specific password to it without which one cannot go ahead So can anyone pls tell a solution I am ready to use javascript for it

28th Nov 2019, 3:22 PM
Atharva Varule
Atharva Varule - avatar
11 Answers
+ 1
Atharva Varule th JS code: In the HTML there are two main containers: The sign_in page wraps the whole sign_in page (the input, and the sign_in text). And the content page. The content page is your content -your website. Also there is the submit button: <button onclick = “check()”> Submit </button> In the JS, I selected the sign_inPage (the container), and the input (where you enter the password). When you click the button, function check(){ if (input.value == “ABC”){ document.body.removeChild(sign_inPage } that means: If (the input value is ABC){remove the sign_inPage} you can change the “ABC” to anything you want, and whatever you change it to will be the password. let me know if u have any questions
30th Nov 2019, 4:40 PM
Ginfio
Ginfio - avatar
+ 1
I’ve made something like that before. If we are on the same page: So there’s a password box, and you’ll have to tell them the passeeord if they want to access the content. This is what my code looks like: https://code.sololearn.com/W74zppj0I2MF/?ref=app Let me knownif you have any questions or if you want me to walk you through. The password for my code is: h5qk40
28th Nov 2019, 3:35 PM
Ginfio
Ginfio - avatar
+ 1
That code isn't working It's showing some error
28th Nov 2019, 5:09 PM
Atharva Varule
Atharva Varule - avatar
+ 1
Atharva Varule , hmm, it works for me on my phone (ios). Let me try to code another one...
28th Nov 2019, 5:14 PM
Ginfio
Ginfio - avatar
+ 1
Atharva Varule What about this one?: https://code.sololearn.com/WTrxQYE8Puky/?ref=app The password is “ABC” (capital, no space).
28th Nov 2019, 6:54 PM
Ginfio
Ginfio - avatar
+ 1
Can you pls explain me the js code u used ??
30th Nov 2019, 1:13 PM
Atharva Varule
Atharva Varule - avatar
+ 1
You can create an HTML page but need scripting languages to add functionalities. If you want to make a login system, you can use PHP and SQL to create a user login system that stores passwords in a database.
30th Nov 2019, 3:13 PM
Ashish Neupane
Ashish Neupane - avatar
+ 1
Ok Thanks a lot Ginfio No other question sir
7th Dec 2019, 2:13 PM
Atharva Varule
Atharva Varule - avatar
+ 1
Thanks a lot ashish neupane
7th Dec 2019, 2:13 PM
Atharva Varule
Atharva Varule - avatar
0
Yes it's working
30th Nov 2019, 12:55 PM
Atharva Varule
Atharva Varule - avatar
0
Thanks a lot Ginfio 🙏🙏
30th Nov 2019, 12:56 PM
Atharva Varule
Atharva Varule - avatar