<?php
require_once 'lib/crypt.class.php';
$key = $_POST['key'];
$string = $_POST['string'];
$requestedAction = $_POST['requestedAction'];
$crypt = new crypt();
$crypt->Key = $key;
// Check requested action
if ( $requestedAction == 'encrypt' )
{
$newString = $crypt->encrypt( $string );
}
else
{
$newString = $crypt->decrypt( $string );
}
echo $newString;
?>