note 34802 deleted from function.base64-encode by didou

From: Date: Thu, 07 Aug 2003 10:26:40 +0000
Subject: note 34802 deleted from function.base64-encode by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-53565@lists.php.net to get a copy of this message
Note Submitter: dhirendrak@yahoo.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. 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

« previous php.notes (#53565) next »