Location: PHPKode > scripts > TxtCrypt > txtcrypt/TxtCrypt_Webpage_Example.php
<?
  include_once("./TxtCrypt_Class.php");

  $type = 0;            // default to encryption
  $carrierFile = "";
  $inFile = "";
  $outFile = "";
  $key = "";

  if (isset($_REQUEST['decrypt'])) $type = 1;  // for decryption
  if (isset($_REQUEST['carrier'])) $carrierFile = $_REQUEST['carrier'];
  if (isset($_REQUEST['infile'])) $inFile = $_REQUEST['infile'];
  if (isset($_REQUEST['outfile'])) $outFile = $_REQUEST['outfile'];
  if (isset($_REQUEST['key'])) $key = $_REQUEST['key'];

  if ($type == 0 && $carrierFile != "" && $inFile != "" && $outFile != "" && $key != "") {
    $txEnc = new TxtCrypt();
    if ($txEnc->Encrypt($carrierFile, $inFile, $outFile, $key) == false)
      echo $txEnc->GetErrorMessage()."<br />";
    else
      echo "File ".$inFile." was encrypted and save as ".$outFile."<br />";
    }
  else if ($type == 1 && $inFile != "" && $outFile != "" && $key != "") {
    $txEnc = new TxtCrypt();
    if ($txEnc->Decrypt($inFile, $outFile, $key) == false)
      echo $txEnc->GetErrorMessage()."<br />";
    else
      echo "File ".$inFile." was decrypted and save as ".$outFile."<br />";
    }
?>
Return current item: TxtCrypt