note 34803 added to function.base64-decode

From: Date: Thu, 07 Aug 2003 06:19:31 +0000
Subject: note 34803 added to function.base64-decode
Groups: php.notes 
Request: Send a blank email to php-notes+get-53552@lists.php.net to get a copy of this message
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. 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 ---- Manual Page -- http://www.php.net/manual/en/function.base64-decode.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+34803 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+34803&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+34803&report=yes

« previous php.notes (#53552) next »