Forum Moderators: coopster
To C++/COM programmers: just like the Microsoft's GUID Gen tool
So what's the best why to generate this unique id?
For example, is the following method reliable?
$user_ip_address = $_SERVER['REMOTE_ADDR'];
$unique_user_id = md5($user_ip_address . timer());
setcookie('user_id', $unique_user_id, ... );
Or is there a better method?
If you need the extra security, then you can md5 that with their IP address. But in 99% of cases, just using the session id should suffice.
1000 years.
>If you need the extra security, then you can md5 that with their IP address.
But the IP address may be changed from time to time. For example, a guy visits my site at Nov 20, 2005. His IP address may be 123.123.123.123. Another guy in the same city visit my site at Nov 21, 2005 and his IP address may be 123.123.123.123 too. Because they are all using dial up ADSL of the same ISP in that city. That's why I add a UNIX timestamp (time()) after IP address.