Re: [PHP] base64 encode question
Sn!per wrote: encoded value is: YToyOntzOjQ6InRpbWUiO2k6MTIwNzIwODk4MjtzOjQ6Imhvc3QiO3M6MTQ6IjE5Mi4xNjguMTAuMTAwIjt9 encoded value is: YToyOntzOjQ6InRpbWUiO2k6MTIwNzIwODk4NDtzOjQ6Imhvc3QiO3M6MTQ6IjE5Mi4xNjguMTAuMTAwIjt9 encoded value is: YToyOntzOjQ6InRpbWUiO2k6MTIwNzIwODk4NTtzOjQ6Imhvc3QiO3M6MTQ6IjE5Mi4xNjguMTAuMTAwIjt9 Hi, They are not the same! If you look closely enough, only one digit in the value is different. So the base64 encoded value has to differ only some values, not the whole string. 4MjtzO is different than 4NDtzO is different than 4NTtzO You see? So, the whole string is different and thus unique. Hope this helps! -- Aschwin Wesselius /'What you would like to be done to you, do that to the other'/
[PHP] base64 encode question
Hi all, I have a short script that I want to store the last login time and the host IP number (harcoded for the moment). Those two variables are stored in $last_login, which is an array. [EMAIL PROTECTED] test]# cat lt.php time(), 'host' => "192.168.10.100"); $serialize_last_login = serialize($last_login); print "$serialize_last_login\n"; $encoded_serialize_last_login = base64_encode($serialize_last_login); print "encoded value is: $encoded_serialize_last_login\n\n"; ?> [EMAIL PROTECTED] test]# When I ran the script, I can see that $serialize_last_login have different value for 'time'. But why does $encoded_serialize_last_login always show the same value? Below is the output after running the script for 3 times: [EMAIL PROTECTED] test]# php lt.php a:2:{s:4:"time";i:1207208982;s:4:"host";s:14:"192.168.10.100";} encoded value is: YToyOntzOjQ6InRpbWUiO2k6MTIwNzIwODk4MjtzOjQ6Imhvc3QiO3M6MTQ6IjE5Mi4xNjguMTAuMTAwIjt9 [EMAIL PROTECTED] test]# php lt.php a:2:{s:4:"time";i:1207208984;s:4:"host";s:14:"192.168.10.100";} encoded value is: YToyOntzOjQ6InRpbWUiO2k6MTIwNzIwODk4NDtzOjQ6Imhvc3QiO3M6MTQ6IjE5Mi4xNjguMTAuMTAwIjt9 [EMAIL PROTECTED] test]# php lt.php a:2:{s:4:"time";i:1207208985;s:4:"host";s:14:"192.168.10.100";} encoded value is: YToyOntzOjQ6InRpbWUiO2k6MTIwNzIwODk4NTtzOjQ6Imhvc3QiO3M6MTQ6IjE5Mi4xNjguMTAuMTAwIjt9 Please help -- Roger -- Sign Up for free Email at http://ureg.home.net.my/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php