Code: [Select]<?php $text = 'A secret.'; if(!isset($chars)) { // 3 different symbols (or combinations) for obfuscation // these should not appear within the original text $sym = array('¶', '¥xQ', '|'); foreach(range('a','z') as $key=>$val) $chars[$val] = str_repeat($sym[0],($key + 1)).$sym[1]; $chars[' '] = $sym[2]; unset($sym); } // encrypt function encrypt($data) { $data = strtr(strtolower($data), $GLOBALS['chars']); return $data; } // decrypt function decrypt($data) { $charset = array_flip($GLOBALS['chars']); $charset = array_reverse($charset, true); $data = strtr($data, $charset); unset($charset); return $data; } $text = encrypt($text); echo 'encrypted: '.$text.'<br />'; // echo 'decrypted: '.decrypt($text); ?>
test:#6/1?2#2?2/5?6/5?6/5?6/5?6/5?6/5?6#4?4? #5?5/1?2#7?7/1?2 #7/3?4#7?7/1?2#5/1?2#4?4... #4?4/1?2#6/1?2#6/1?2#6/1?2#6/1?2
#6/4?5#2?2/5?6/5?6/5?6/5?6#4?4? #3?3/2?3#3?3/2?3#4?4.... /4?5#4?4#2?#7?7#6?6?#5?5#2?2/2?3/5?6#4?4-#4?4#6?6/1?2 #1?1/4?5#7?7/4?5#4?4....