Dip Switch
This little program encodes and decodes 8 on/off switches into a single integer. The idea is simple - each switch is a digit for the number in its binary form. It is converted into decimal and passed (for example by PHP POT method) to the decoding routine.
This is the clever bit: the routine for decoding queries an individual digit using the formula:

ds-query(i, j)
   {
   return floor($j / (2 ** $i)) % 2;
       }

Where j is the code and i the digit being queried. Since the returned valued is 0 or 1 it can be used as a boolean:

if (ds-query($digitNumber, $ds-code)) { }

The program is on http://flagpole.mhellis.com/

It can be used to calculate the code to be sent:

The program demonstrates the process using the method POST:
FlagPole
Published:

FlagPole

Published:

Creative Fields