Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Simple password protection for non-sensitive links

I’ve been looking at password protection for HTML and most of the protection listed appears to be overkill for my needs.

I just want to have some portfolio images (nothing that needs to be private and it doesn’t matter if any advanced programmer or someone that knows how to open the code can get into it because nothing is sensitive), I just don’t want the average user to access certain areas of site and only allow someone who I give the password (for example on my business card.)

Does anyone have any suggestions or direction I should look?

like image 516
Jeff Avatar asked Aug 14 '12 15:08

Jeff


1 Answers

Use javascript in your main page, something like this:

<body>
Enter password: <input id='password' type='text'  />
<a href="your_image_portfolio.html" onclick="javascript:return validatePass()">enter your password and click this</a>
<script>
function validatePass(){
    if(document.getElementById('password').value == 'yourBussinessCardPassword'){
        return true;
    }else{
        alert('wrong password!!');
        return false;
    }
}
</script>
</body>

It's very insecure, but it will do what you want for non technical users...

like image 181
Frank Orellana Avatar answered Nov 15 '22 11:11

Frank Orellana