PHP iteration verification problems

Source: Internet
Author: User
PHP iterative verification I want to register a user now, but the user and password do not need to be filled in by the user. it is generated by the system and I wrote a function by myself, I used mt_rand to do this, so I was afraid of repetition. I wrote a static method in the class. I can use myclass: chkeuser for verification to see if I already have this username and password, but I think the value is verified once, but no. if it is repeated next time, should it be verified? if it is not repeated, then I think of iteration, but how can I write it, my head is blurred. may I ask you?


Reply to discussion (solution)

First, insert a user into the database to obtain the unique id of the user. then, the user is equal to the value of user + id and can be directly generated by user id obfuscation.
For example, if the user ID is 3090, the user name is user3090, and the password is md5 ('Your private key'. 3090). This will certainly not be repeated.

No one has ever done anything else ??

I don't know what you want to verify? It doesn't matter if the password is repeated.
Isn't user verification a select statement? If the number is greater than 0, it will be repeated.

What is next? Next random value? Put all the usernames into the array. won't inarray be used to identify them? no iteration is required.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.