www.webdeveloper.com
Results 1 to 4 of 4

Thread: Textbox password?

  1. #1
    Join Date
    Aug 2007
    Posts
    2

    Textbox password?

    I inserted a text box input form into a page. Entering anything into the text box and pressing enter triggers the action which is to open another page.
    Here is the raw html:
    _______________________________
    <FORM action=new web address">
    <TABLE cellSpacing=0 cellPadding=0 border=0>
    <TBODY>
    <TR>
    <TD bgColor=black><INPUT style="WIDTH: 184px; COLOR: lime; HEIGHT: 22px; BACKGROUND-COLOR: black; size: maxLength=25 size=23 border=0 10 new? courier font-family: HEIGHT=" WIDTH="41" 41?></TD>
    <TD vAlign=center bgColor=#000000></FORM></TD></TR></TBODY></TABLE>
    -------------------------------------------

    What I want to happen is to set a key or password. When the key or password is entered into the text box then the next page can be accessed. If it is incorrect, you get re-directed back to the same page.

    Is this possible? If so, what codes will I have to add to make this work?
    Thank you in advance.

  2. #2
    Join Date
    Jun 2007
    Posts
    48
    Well you need to do scripting to achieve that. If you are using PHP or you could do it in CGI or whatever. So your page is sent to the script and the script reads the value entered in the box and checks if it is the right password and then redirects to the next page.

    But if you want to do it with just that plain html file, then you could do it with javascript shortly like this:

    <form action="newpage" onSubmit="if(this.pass.value!='magic'){return false;}">
    <input name="pass" type="text" value="Enter the password here">
    </form>

    But this is strongly not advised since you will be putting in your password in the html code which can easily be viewed in any browser. Its best to script using CGI or PHP or the likes.

  3. #3
    Join Date
    Aug 2007
    Posts
    2
    Thamba,

    Thank you, that it exactly what I needed to make the page do what I want!

    I read up on the security things you mentioned before posting, so I am aware of what you mean. I tried a solution that worked for someone else, but the site I am using (www.FreeWebs.com) is fairly primitive to the free sites. With a paid site the author has more control.

    The script that worked for someone else (in a similar situation) did not work for me. It seems that Freewebs.com does not agree with that type of code. And the password and information that I am using is not of high priority.

    Thank you again!

  4. #4
    Join Date
    Aug 2007
    Location
    Amherst, Ohio
    Posts
    51
    well, if freewebs accepts php these days

    <?php
    if(isset($_POST['submit'])) {
    if($_POST['pass'] == "desired key") {
    actions here;
    }
    else {
    die("Incorrect Password");
    }
    }
    ?>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles