The variables in this script: $s1, $s2, and $s3 will need to be changed by you. More specifically, you'll need to change the contents between the str_split(" and ");. These characters are the ones allowed to be encoded, so pick ones that work for you. Also, they each MUST be in a different order, or it defeats the purpose of the code itself. They also must be the same length. Enjoy.
Code: Select all
<?PHP
$sequence = str_split(312);
$s1 = str_split("abcdefghijklmnopqrstuvwxyz1234567890!@#$%^&*()_+{}:\"<>?-=[];',./\| ");
$s2 = str_split("qazwsxedcrfvtgbyhnujmikolp,./;'[]\=-)(*&^%$# @!?><\":|}{+_0123456789");
$s3 = str_split("poiuytrewqasdfghjklmnbvcxz/']\.;[,=-)(*&^!@#$%<>:{?\"}| _+1324576809");
$string = str_split(strtolower($_GET['s']));
$b = 0;
$encrypted = NULL;
for($a = 0; $a < count($string); $a++)
{
if($b > 2)
$b = 0;
if($b == 0)
{
$key = array_search($string[$a], $s3);
if($key === FALSE)
die("Invalid characters in string.");
$encrypted .= "$key:";
}
if($b == 1)
{
$key = array_search($string[$a], $s1);
if($key === FALSE)
die("Invalid characters in string.");
$encrypted .= "$key:";
}
if($b == 2)
{
$key = array_search($string[$a], $s2);
if($key === FALSE)
die("Invalid characters in string.");
$encrypted .= "$key:";
}
$b++;
}
$len = strlen($encrypted)-1;
$encrypted = substr($encrypted, 0, $len);
echo $encrypted;
?>