简体   繁体   中英

How can I get a unique Id of each visitor? php

In php

I've created for each user a unique URL that if someone opens that URL points to be added to account user.

My problem here is that anyone can do it only once.

How can I get a unique Id of each visitor that does not duplicate?

How can I get information hardware PC or Mobile visitor?

您可以使用uniqid()函数来获得 uniq id 并将该值存储在 cookie 中。

You'll need another database that will store if the user has clicked on the link. Once the link is clicked, You will need to check if the link has been clicked previously (the way you store this data is up to you).

If Yes: Alert the user.

If No: You will then need to write to a database signifying that the link has been pressed, and the next time the link is clicked, you should get an alert.

As for detecting if Mobile or PC, take a look at this library: http://mobiledetect.net/

为每个访问者每次访问生成的服务器 PHP 会话也是唯一的。

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM