How does php generate a machine code, which has a unique value on a client and does not repeat similar mac addresses? in this way, each machine can only be registered with a single one, preventing php from generating a machine code, the unique value of a client does not repeat similar mac addresses, so that each machine can only register one, preventing registration by refreshing
Reply content:
How does php generate a machine code, which has a unique value on a client and does not repeat similar mac addresses? in this way, each machine can only be registered with one account, preventing malicious registration.
We recommend that you do not use this unique identification number on the service end. What I have doneapp
Client interfaces, whether connectedIOS
OrAndroid
The client generates a uniqueToken
To our server, we only need to receive the recognition. There is no need for us to produce. If you have to perform unique generation on the server, usePHP
Built-in functionsuniqid()
To produce, this can be accurate to the subtle enough, you can add some parameters on your own, hope to help you
This depends on the specific situation. if the server is in a cluster, the server ip address, process id, and timestamp can be used.
base_convert(ip2long($_SERVER['REMOTE_ADDR']),10,36).'-'.getmypid().'-'.base_convert(microtime(true)*1000 - strtotime('2016-06-07 18:00:00')*1000,10,36)
It is a long and messy cluster. if multiple clusters have the same internal ip segments, it will not work. The advantage is that each server is generated independently.
In addition, redis auto-increment and mysql auto-increment can also be achieved. these solutions seem simple and difficult to maintain, such as redis failure and how to restore auto-increment fields.
It is generated by the client and a 6-byte copy mac address is randomly generated. Basically, it will not be repeated and can be found in the keychain.