Html + javascript + css?

html-css
javascript

#1

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

Here is my code:
Html:

<!DOCTYPE html>
	<html>
	<head> 
<script type="text/javascript" src="new 2.js"></script>
<link type="text/css" rel="stylesheet" href="new 3.css"/>
	</head>
	
	<body>
		<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>
		</form>


</body>

</html>
		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';
	}
	else
	{
		document.getElementById("letter").innerHTML = 'Acces Denied';
	}; 

	

};

Js webpage
#2

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


#3

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


#4

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!


#5

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


#6

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