<?php
include "encode.class.php"; //include the class file
//Some styles for the encoded/decoded strings
$html .= "<style>\n";
$html .= "span { background: #FAFCFE; border: 1px dotted #000; color: #465584; font-family: Courier New, Verdana, Arial; margin: 5 auto 5 auto; margin-left: 10px; padding-top: 5px; padding-left: 5px; padding-right: 5px; padding-bottom: 5px; width: 98%; }\n";
$html .= "</style>\n";
echo $html;
$ptc = new Protector; //initiate the object
// ** Enter the string to encode here
$ptc->ToEncode = "This is the string to encode <br> with a break";
/*
Set the pattern for encoding/decoding,
the pattern can only consist of "E", "R", "I" 's
and cannot contain spaces, and all letters must have a colon (:)
seperating them, example below
E: Encode with Base64
R: Reverse String
I: Inverse Case
Anything else will be ingnored
VALID: E:R:I:E:E:R:E:I:E:R
INVALID: ERIIREREER
Tips: do not repeat the R or I in the pattern, as it will cancel it out and slow up the process.
*/
$ptc->MakePattern( 5 ); // Make random Pattern
//$ptc->Pattern = "E:E:R:F:I:E";
$ptc->Debug(); //Set debugging on, will pring result of each step in encoding and decoding
$newstr = $ptc->Encode(); //Make an encoded string
$ptc->ToDecode = $newstr; //Set the string to decode
//$ptc->DecodePattern = "E:R:I"; //only required if you are only decoding, else it will get pattern from encoding
// SHOULD be the same used to encode, not the reverse, as the program will reverse it
$ptc->Decode(); //Get the decoded string
//Print out the encoded string, and decoded string
echo "<pre>Encoded (Pattern: {$ptc->Pattern})\n<span>{$ptc->Encoded}</span>\n";
echo "\r\n<pre>Decoded (Pattern: {$ptc->PatternFlip})\n<span>{$ptc->Decoded}</span>";
?>
|