Location: PHPKode > scripts > OTP_TS > otp_ts/example_form.php
<?php

include ('class.OTP_TS.php');

if ($_POST[password] && $_POST[data])
{
   $OTP_TS = &new OTP_TS();
   switch ($_POST[op])
   {
      case "encoded":
       $code = base64_encode($OTP_TS->cipher_OTP_TS($_POST[password], $_POST[data]));
      break;

      case "decoded":
       $code = stripslashes($OTP_TS->cipher_OTP_TS($_POST[password], base64_decode($_POST[data])));       
      break;
 
      default:
       $code = ''; 
      break;
   }
}

echo '<form method="post" action="otp.php">';
echo '<textarea name="data" cols="50" rows="10" wrap="virtual">'.$code.'</textarea><br />';
echo 'Your password: <input type="password" name="password" /> ';
echo '<select name="op">';
echo '<option value="encoded">Encoded</option>';
echo '<option value="decoded">Decoded</option>';
echo '</select> ';
echo '<input type="submit" value="OK" />';

?>
Return current item: OTP_TS