Html + javascript + css?

Hey I’m trying to create a password system that only I can access

Here is my code:

<!DOCTYPE html>
<script type="text/javascript" src="new 2.js"></script>
<link type="text/css" rel="stylesheet" href="new 3.css"/>
		<form name="pass">
			<label for="username">Admin username:</label>
			<input type="text" name="username" />
			<label for="password">Admin password:</label>
			<input type="text" name="password" />
		<button  name= "submit" type="button" onClick="processInfo()">Submit</button>
<div id="letter"></div>


		and css:
	var aun = document.pass.username.value;
	var ap = document.pass.password.value;

function processInfo(){
if(aun === "username" && ap === "password"){
		document.getElementById("letter").innerHTML = 'Acces Granted';
		document.getElementById("letter").innerHTML = 'Acces Denied';



I put your code in a bin, put your variable declaration inside the function, seems to work fine.

CAUTION: this method is highly insecure. Please don’t use it on a actual website

1 Like

Im using it to create an interface in which only i can log into as to get information from the site.

The user can read all the files that you send to them, so password checking and restricted resources have to be managed by the server.

So you’d send the password to the server, which would apply a hashing algorithm to see if your password becomes the same hash as the correct password turns into when hashed. If it matches, the server then sends the restricted resource to you.

All of this should be done on an encrypted connection as otherwise anyone in-between can read it all. This requires that the client already knows and trusts the server, or some third party that vouches for the server so that all the data can be verified to not have been modified/created by anyone other than the trusted server.

It’s easy to mess up online security!

Websites are files, html + css + js. Lets say you have a server, which hosts a website, and i make a request to your server (i want to visit your webpage), the html + css + js files required are send to my computer, my browser loads them, and draws the webpage.

Oops, now the js file with your password + username is in my browser, and i can just view the file.

I would really use a server side language (serverside js, php, python, ruby) to do this, so the password is stored on your computer. Also, encryption would be a great idea

Thanks So much. I have been talking to a web developer and he didn’t mention this.