Login   Register  
PHP Classes
elePHPant
Icontem

File: TxtCrypt_Webpage_Example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Chao-Chyuan Shih  >  TxtCrypt  >  TxtCrypt_Webpage_Example.php  >  Download  
File: TxtCrypt_Webpage_Example.php
Role: Example script
Content type: text/plain
Description: Webpage Example
Class: TxtCrypt
Encrypt a file and hide it in a regular text file
Author: By
Last change:
Date: 9 years ago
Size: 1,150 bytes
 

Contents

Class file image Download
<?
  
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 == && $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 == && $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 />";
    }
?>