note 34803 deleted from function.base64-decode by danbrown
| From: | danbrown@php.net | Date: | Fri, 14 Nov 2008 21:03:32 +0000 |
| Subject: | note 34803 deleted from function.base64-decode by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-146566@lists.php.net to get a copy of this message | ||
Note Submitter: dhirendrak at yahoo dot com
----
Heading : Your customizable encode
and decode function.
A customizable encoded and decode
Function which can encode and decode
the data. You need to pass variable to
the encode function to encrypt and
whenever you want you can get the
data by using decode function.
Cracking / hacking of encoded value
is impossible, until user know the
actual coding.
<?php
function encoded($ses)
{
$sesencoded = $ses;
$num = mt_rand(3,9);
for($i=1;$i<=$num;$i++)
{
$sesencoded =
base64_encode($sesencoded);
}
$alpha_array =
array('Y','D','U','R','P',
'S','B','M','A','T','H');
$sesencoded =
$sesencoded."+".$alpha_array[$num];
$sesencoded =
base64_encode($sesencoded);
return $sesencoded;
}//end of encoded function
function decoded($str)
{
$alpha_array =
array('Y','D','U','R','P',
'S','B','M','A','T','H');
$decoded =
base64_decode($str);
list($decoded,$letter) =
split("\+",$decoded);
for($i=0;$i<count($alpha_array);$i++)
{
if($alpha_array[$i] == $letter)
break;
}
for($j=1;$j<=$i;$j++)
{
$decoded =
base64_decode($decoded);
}
return $decoded;
}//end of decoded function
?>
http://members.lycos.co.uk/dhirendrak