base64 encode question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

[root@svr1 test]# cat lt.php
<?
$last_login = array('time' => 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";

?>
[root@svr1 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:

[root@svr1 test]# php lt.php
a:2:{s:4:"time";i:1207208982;s:4:"host";s:14:"192.168.10.100";}
encoded value is: YToyOntzOjQ6InRpbWUiO2k6MTIwNzIwODk4MjtzOjQ6Imhvc3QiO3M6MTQ6IjE5Mi4xNjguMTAuMTAwIjt9

[root@svr1 test]# php lt.php
a:2:{s:4:"time";i:1207208984;s:4:"host";s:14:"192.168.10.100";}
encoded value is: YToyOntzOjQ6InRpbWUiO2k6MTIwNzIwODk4NDtzOjQ6Imhvc3QiO3M6MTQ6IjE5Mi4xNjguMTAuMTAwIjt9

[root@svr1 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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux