Page 1 of 1

Radio Buttons as password?

Posted: Tue May 30, 2006 12:19 pm
by thx1138
Hey phper's

Developing an interesting site for a client. We are wondering how one might go about creating a form with radio buttons which can be used like a combination lock to other parts of the site. Basically can you turn a form with multiple radio buttons into a password script?

Any ideas or examples would be awesome..
:wink:

THX1138

Posted: Tue May 30, 2006 1:11 pm
by tecktalkcm0391
I don't know about what you going for but you could have something like this:

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

</head>

<body>
<table cellspacing="0" cellpadding="0" width="350" border="0">
  <tbody>
    <tr>
      <td></td>
    </tr>
  </tbody>
</table>
<table cellspacing="0" cellpadding="0" width="350" border="0">
  <tbody>
    <tr>
      <td width="150"><a href="http://www.openthesafe.com" target="_blank"><img src="http://www.openthesafe.com/safe-closed.jpg" alt="<empty>" width="150" height="150" border="0" /></a></td>
      <td valign="top" align="middle" width="200"><form action="http://www.openthesafe.com/safe_process.php" method="post" name="safeform" target="_blank" id="safeform">
        <table cellspacing="0" cellpadding="0" width="190" border="0">
          <tbody>
            <tr>
              <td colspan="3" height="19"><strong>Enter Combination: </strong></td>
            </tr>
            <tr>
              <td width="20%">1st</td>
              <td width="46%">Number</td>
              <td width="38%"><input tabindex="2" maxlength="5" size="4" value="15" name="guess1" />
              </td>
            </tr>
            <tr>
              <td width="20%">2nd</td>
              <td width="46%">Number</td>
              <td width="38%"><input tabindex="2" maxlength="5" size="4" value="6" name="guess2" />
              </td>
            </tr>
            <tr>
              <td width="20%">3rd</td>
              <td width="46%">Number</td>
              <td width="38%"><input tabindex="2" maxlength="5" size="4" value="2006" name="guess3" />
              </td>
            </tr>
          </tbody>
        </table>
        <table cellspacing="0" cellpadding="0" width="190" border="0">
          <tbody>
            <tr>
              <td><div align="center">
                <input tabindex="0" type="hidden" maxlength="1" size="1" name="formok" />
                <input tabindex="0" type="hidden" maxlength="1" size="1" value="20060401224720-580400" name="safeid" />
                <input id="submit" tabindex="15" type="submit" value="Open The Safe" name="submit" />
              </div></td>
            </tr>
          </tbody>
        </table>
      </form></td>
    </tr>
    <tr>
      <td colspan="2"><div align="right"><a href="http://www.openthesafe.com" target="_blank">Make Your Own Safe - Click   Here</a></div></td>
    </tr>
  </tbody>
</table>
</body>
</html>

Posted: Tue May 30, 2006 1:21 pm
by Christopher
The idea with radio buttons is that you will have several <input> tags that all share the same name (FYI checkboxes work the same way). The browser will sort out which one is "checked." It will look something like this:

Code: Select all

<form action="myformpage.php" method="post>
Choose a number:
<input type="radio" name="mynumber" value="1"/>One
<input type="radio" name="mynumber" value="2"/>Two
<input type="radio" name="mynumber" value="3"/>Three

<input type="submit" name="submit" value="Submit"/>One
</form>
PHP will give you the value of the one they clicked on in the variable $_POST['mynumber'].

Re: Radio Buttons as password?

Posted: Tue May 30, 2006 1:27 pm
by aerodromoi
thx1138 wrote:Hey phper's

Developing an interesting site for a client. We are wondering how one might go about creating a form with radio buttons which can be used like a combination lock to other parts of the site. Basically can you turn a form with multiple radio buttons into a password script?

Any ideas or examples would be awesome..
:wink:

THX1138
I don't think radio buttons will work for this one, as they allow for one choice only (there might be a workaround for that involving javascript, though). However, you might want to try out checkboxes.

aerodromoi

Check boxes it is....:-(

Posted: Wed May 31, 2006 8:19 am
by thx1138
OK, I have tried to fiqure out a way to do this with radio buttons, no luck.

Now I am setting it up with check boxes, I am not sure how to pass on two required variables
in order to make the "lock" work. I can easily make one check box be required to gain access,
however I cannot get two (Multiple) check boxes as in a combination to work?

here is part of the code:

Code: Select all

[size=9]<?php
include("config.php");
$cookuser = $_COOKIE["cookuser"];
//$cookpass = $_COOKIE["cookpass"];
//$adminpass = md5($adminpass);
if($cookuser) {
    if(($cookuser == $adminuser) or ($cookuser == $adminuser4)){
    echo("<title>BLABLA</title>
 unlocked information then is displayed here...[/size]
Basically all this does is make it so my 1st or 4th check box allows users access to the BLABLA information.
How do I go about requiring BOTH 1st AND 4th being required? I have swithched the or to an and but that just lets either work....?


Thanks for any guidance... I know I am missing something fairly basic because I am a
worthless script kiddie! :oops:

THX1138

Posted: Thu Jun 01, 2006 2:18 am
by acidHL
Paste all your code, its a simple solution so its probably just a small error.

Posted: Thu Jun 01, 2006 2:28 am
by Chris Corbyn
I don't see why you can't use radio buttons.

Just have 10 values with five options each (Not sure how many combinations that gives you).

So you'd basically have a 10 by 5 grid and can only select one option fom each row.

Posted: Fri Jun 02, 2006 9:12 pm
by n00b Saibot
d11wtq wrote:So you'd basically have a 10 by 5 grid and can only select one option fom each row.
10 x 5 grid of checkboxes = 50 options to choose from = greater fun :) yaay!!!

Posted: Sat Jun 03, 2006 12:02 am
by tecktalkcm0391
did you look at my earlier post? how would that work? or do you just want radio/checkboxes

Posted: Sat Jun 03, 2006 1:51 am
by Christopher
The thing about using checkboxes for a password is that is it binary, so the number of check boxes dictates the number of possible combinations:

1 = 2 combinations
2 = 4 combinations
3 = 8 combinations
4 = 16 combinations
5 = 32 combinations
6 = 64 combinations
7 = 128 combinations
8 = 256 combinations
9 = 512 combinations
10 = 1024 combinations

To contrast that, if you had three selects with 0 to 9 in each it would only take three selects to get close to that number of combinations:

1 = 10 combinations
2 = 100 combinations
3 = 1000 combinations
4 = 10000 combinations

Further contrast that, if you had three selects with A to Z in each it would only take two selects to get close to that number of combinations, three would create many more combinations, and four gets you to half a million:

1 = 26 combinations
2 = 676 combinations
3 = 17576 combinations
4 = 456,976 combinations