I' ve abandoned the class and now i'm using two functions i've made directly from the examples in the manual
function encryptData($text, $key){
/*
$iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB);
echo "<br /> size = ".$iv_size;
$iv = mcrypt_create_iv($iv_size);
echo "<br /> iv = ".$iv;
*/
$crypttext = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $key, $text, MCRYPT_MODE_ECB, 'lIuKvV6mC9DU5HTKWWaczwlCRAkRNGkB');
return $crypttext;
}
function decryptData($text, $key){
/*
$iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB);
echo "<br /> size = ".$iv_size;
$iv = mcrypt_create_iv($iv_size);
echo "<br /> iv = ".$iv;
*/
$decrypttext = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $key, $text, MCRYPT_MODE_ECB, 'lIuKvV6mC9DU5HTKWWaczwlCRAkRNGkB');
return $decrypttext;
}
to update the database I use this
$client_vars = encryptData($_POST['client_vars'], $_SESSION['key']);
which results in this
UPDATE clients SET client_name='AFP CONSEIL' , client_vars='‰~ ì8Þ*-…Ï !ј Ê¿æk ’â¬:Õ?Ž ´' WHERE client_id='31' LIMIT 1
and in the db table i have this
‰~ ì8Þ*-…Ï
!ј
Ê¿æk ’â¬:Õ?Ž ´
when i try to display it with this ($client_vars is the data from the mysql SELECT)
bin2hex(decryptData($client_vars, $_SESSION['key']));
i just get
6a2a1ce12aed0e15959d98dc0f0698e054854d6f001ea49190c8f8ce9ec30464
where am i going wrong ????!!!!!!!!
helppppppp ..................