• GoDaddy Community
  • Websites + Marketing | Website Builders
  • Websites + Marketing | Website Builders

    Showing results for 
    Show  only  | Search instead for 
    Did you mean: 
    Go to solution

    Password Protect HTML Code

    Okay. So beyond the ABSOLUTE PATHETIC reality that GoDaddy does not support password protected pages unless you use your own code, I was able to get the following HTML code to password protect a page.


    However... it only displays the page "in-frame", meaning inside the current page, which looks absolutely horrible. So... I am hoping someone can tell me what code, and where, to insert some HTML code to make the page, after the user inputs the correct password, into a new window.


    Any ideas?? Please? 

    GoDaddy staff - feel free to help... since you product absolutely sucks.



    Code I Have ------------>


    <script type = "text/javascript">

    var count = 2;
    function validate() {
    var un = document.myform.username.value;
    var pw = document.myform.pword.value;
    var valid = false;

    var unArray = ["Philip", "Max", "Sarah", "Michael"];
    var pwArray = ["Password1", "Password2", "Password3", "Password4"];

    for (var i=0; i <unArray.length; i++) {
    if ((un == unArray[i]) && (pw == pwArray[i])) {
    valid = true;

    if (valid) {
    alert ("Login was successful");
    window.location = "successfullocation.html";
    return false;

    var t = " tries";
    if (count == 1) {t = " try"}

    if (count >= 1) {
    alert ("Invalid username and/or password. You have " + count + t + " left.");
    document.myform.username.value = "";
    document.myform.pword.value = "";
    setTimeout("document.myform.username.focus()", 25);
    setTimeout("document.myform.username.select()", 25);
    count --;

    else {
    alert ("Still incorrect! You have no more tries left!");
    document.myform.username.value = "No more tries allowed!";
    document.myform.pword.value = "";
    document.myform.username.disabled = true;
    document.myform.pword.disabled = true;
    return false;



    <form name = "myform">
    <p>ENTER USER NAME <input type="text" name="username"> ENTER PASSWORD <input type="password" name="pword">
    <input type="button" value="Check In" name="Submit" onclick= "validate()">


    1 REPLY 1
    Super User III Super User III
    Super User III

    Re: Password Protect HTML Code

    I hate to be the bearer of bad news but you can't actually do password protection with "client-side" code, what you've posted is fake and only gives the illusion of security.  You wouldn't have access to add your own "server-side" code or databases with GoCentral, which is what's needed to do your own password protection.


    Though GoCentral does have it's own implementation of password protection with members only pages.  Keep in mind that GoCentral is intended to be a simple way to make a basic website, so this feature is limited.  If you need a more robust solution for user management you may want to look into a platform designed around that, like WordPress.