Mobile web pages ensure the uniqueness of users

my current project has a need, that is to make a mobile web page, the page has a button, the user clicks the button to add one, the user can only click once, you can share it and ask others to help.
the main requirement is that each user can only click once, how to achieve this function.
that is, how to obtain the unique identification information of the user so that multiple clicks can be prohibited
premise: the project has an authenticated Subscription account and cannot do the web page authorization function.
I"ve been looking for it for a long time, but I always say that I need the web authorization function of the service number.

Mar.13,2021

the URL of the question you asked is:

https://codeshelper.com/q/10.

this number should be used to indicate the ID of the problem. Can you learn to do it, too?

create a database table by yourself, store the shared ID, ID, and don't write it into URL. Uninstall hash

from=1010000015009732">https://codeshelper.com/q/?u.

then when the page loads, parsing URL, that does not have this value is deemed to have been shared, and if there is a value, request the server to check


so there is a unique identity ID? I don't know about this problem, mark.


if you just do this function in Wechat, you can use Wechat's jssdk, to get the currently logged-in user id, to judge according to id, but if you still need to share to other places, you may not be able to do so


Let the user enter the mobile phone number and get the verification code


can the user be a tourist or must he or she log in?
try assigning UUID to the user.


this problem has not been encountered, because when I do similar requirements, I have the authority to authenticate the service number. So I suggest you:

  1. confirm whether Subscription account has silent authorization permission? (this may require logging in to the background to check the list of existing permissions)
  2. if one of the above doesn't work, consider whether you can save the country through the unionID of the open platform. Because anyway, as long as you can get the unique ID of the same system, you can take either one.
  3. if neither of the above works, you have to check to see if there is a third-party service to obtain user information / OpenID.

I think it's a good way to input the mobile number verification code upstairs. After all, the mobile number is unique.


the authenticated number should be able to obtain the user's openid.

A lot of times you don't need to be so rigorous.

then, generate a unique identity for each user, then save it in the browser and save it through cookie or localStorage.


if you want to use Wechat's browser, you can get the openid of the user who currently enters the web page even if you don't pay attention to it. This is Wechat's web page authorization function:

Web authorization initiated with snsapi_base as scope is used to obtain the openid of the user entering the page, and is silently authorized and automatically redirected to the callback page. What the user perceives is to go directly to the callback page (often the business page)

if you share, call Wechat's jssdk, and add the current user's openid, to the shared link so that the user who clicks on the link later knows who shared it, so as to write the subsequent business code

.

of course you need a database or something to store the openid and other data

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3c549-2c310.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3c549-2c310.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?