Click to See Complete Forum and Search --> : Textbox password?


frankp9826
08-10-2007, 04:34 PM
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.

thamba
08-10-2007, 06:29 PM
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.

frankp9826
08-11-2007, 12:35 AM
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!

afigueroa
08-11-2007, 01:15 AM
well, if freewebs accepts php these days

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