#native_company# #native_desc#

Encode and decode sessions values

By Amigura
on February 13, 2007

Version: 1

Type: Class

Category: Other

License: GNU General Public License

Description: This is a simple class that can be used to encode and decode session values to make it harder to obtain private session values for people with access to session data.

It uses base64 encoding and mcrypt_encrypt encryption to set the values of one or more session variables values.

The class may also retrieve the value of an encoded session variable and decode it.

It can be easley modified to work with of varibles.

base64 encode and decode sessions v1

author:  Amigura
website: http://www.amigura.co.uk/php_blog/

class encode_session { 

var $enc_val;
var $dec_val;
    function encode($set_ses) 
	foreach($set_ses as $key=>$value){
  $_SESSION[$key] = base64_encode($value);
// set encoded var to display 
  $this->$enc_val.=$key = base64_encode($value).'<br>';
	function decode($get_ses) 
    { $dec_ses = $_SESSION[$get_ses];
// set decoded var to display 
    $this->$dec_val= base64_decode($dec_ses);