<?
 
  include_once("./TxtCrypt_Class.php");
 
 
  if ($argc == 6 && strcmp($argv[1], "-e") == 0) {
 
    $txEnc = new TxtCrypt();
 
    if ($txEnc->Encrypt($argv[2], $argv[3], $argv[4], $argv[5]) == false)
 
      echo $txEnc->GetErrorMessage()."\n";
 
    else
 
      echo "File ".$argv[3]." was encrypted and save as ".$argv[4]."\n";
 
    }
 
  else if ($argc == 5 && strcmp($argv[1], "-d") == 0) {
 
    $txEnc = new TxtCrypt();
 
    if ($txEnc->Decrypt($argv[2], $argv[3], $argv[4]) == false)
 
      echo $txEnc->GetErrorMessage()."\n";
 
    else
 
      echo "File ".$argv[2]." was decrypted and save as ".$argv[3]."\n";
 
    }
 
  else {
 
    echo "Usage:\n";
 
    echo "   php -f TxtCrypt_CommandLine_Example.php -e CarrierFile InFile OutFile Key\n";
 
    echo "   php -f TxtCrypt_CommandLine_Example.php -d InFile OutFile Key\n";
 
    }
 
?>
 
 |