<?php
function    crypto($mode,$string){
    $newData = '';
    $data = '';
    $origKey = 'mn6_;I7tT<4W\1|}r%uNqcFULO:*Y-!2dXl){58PCSkEaDhJf#KG=^~9AV&(,w/pj@bH3?$gRZ+0exoBQv]M.[>syiz';
    $origStandard = '!#$%&()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_abcdefghijklmnopqrstuvwxyz{|}~';
    //Create key and standard
    $len = strlen($origKey);
    $key = '';
    for($x=0;$x<$len;$x+=1){
        $key = $key.substr($origKey,$x,1);
        $key = $key." ";
    }
    $len = strlen($origStandard);
    $standard = '';
    for($x=0;$x<$len;$x+=1){
        $standard = $standard.substr($origStandard,$x,1);
        $standard = $standard." ";
    }
    if($mode == 'encode'){
        $newData = '';
        $data = base64_encode($string);
        $data = $string;
        $len = strlen($data);
        for($x = 0;$x<$len;$x+=1){
            $bit = substr($data,$x,1);
            $loc = strpos($standard,$bit);
            $newbit = substr($key,$loc,1);
            $newData = $newData . $newbit;
        }
    }
    if($mode == 'decode'){
        $len = strlen($string);
        for($x = 0;$x<$len;$x+=1){
            $bit = substr($string,$x,1);
            $loc = strpos($key,$bit);
            $newbit = substr($standard,$loc,1);
            $data = $data . $newbit;
        }
        $newData = base64_decode($data);
        $newData = $data;
    }
    return $newData;
        }
//Testing section
//$var = "john@john-byrne.info";
//echo $var." => ";
//$newvar = crypto("encode", $var);
//echo $newvar." => ";
//$btfvar = crypto("decode",$newvar);
//echo $btfvar;
//Usage and syntax
/***
 * Designed to work with email addresses.
 * Assign the results of the call to a variable, ie:
 * $result = crypto($mode,$string);
 * The syntax is:
 * $result string
 * $mode "encode" or "decode"
 * $string string (an email address)
 * Example:
 *
 * $mode = 'encode';
 * $string = 'john@john-byrne.info';
 * $result = crypto($mode, $string)
 */
?>