PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Romeu Gamelas   SRCrypt   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example file
Class: SRCrypt
Encrypt and decrypt data using a secret key
Author: By
Last change:
Date: 14 years ago
Size: 457 bytes
 

Contents

Class file image Download
<?php
 
require("srcrypt.class.php");
  include(
"sampleKey.php");
 
$cr = new SRCrypt($key);
 
$cr->encrypt(file_get_contents("testfile.txt"));
?>
<h2>Once encrypted your file will look like this:</h2>

<textarea cols="100" rows="5"><?php echo $cr->result;?></textarea>
<?php
  $cr
->decrypt($cr->result);
  if(
$cr->error) die($cr->error);
?>
<h2>Decrypt back to get this</h2>
<textarea cols="100" rows="50"><?php echo $cr->result;?></textarea>