I m new to php, but i know basics. still im learning in php.
In between gap, May i know, Is there possible to get unique id for differentiate from computer to another by using php?
Any suggestions would be highly appreciated.
Thanks.
A computer doesn't have a permanent unique id that can be read by php.
So depending on your requirement you can try IP address, but this is likely to change over time. So only for a short period of time you can use this information.
If you want to know for a longer period of time, when the user comes back to your page, the best way to do this is by assigning your own unique id in a cookie to the browser. This cookie will remember which computer is which.
You can set cookie to detect computer and also can detect IP. Now a days most of the ISPs uses dynamic IP address. Dynamic IP changes when client disconnect and reconnect internet connection. So cookie is the best way to detect a computer.
To set cookie use: setcookie('cookiename','cookievalue',time()+3600,'/','.example.com',0,1);
To retrive cookievalue: $_COOKIE['cookiename'];
To get IP: $_SERVER['REMOTE_ADDR'];
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.