When registering on the website, the user automatically is given a unique page address of format a website.OU/id***
Where *** id number of the row from the database.
Ie when registering in the database a new record is created of the format (name, surname, telephone and, accordingly, is automatically generated ID), from there take the id.
The question how to check the uniqueness of the address?
For example a person wants to change at id123 on durov
1. How to check using php or html rule where you can only use Latin characters, a symbol "_" and "."?
2. How to make that the user could not select the address format id124 (since the next was will receive this id and it is unacceptable that there was a conflict of addresses - each must be unique)?
3. How do implement a function such as for example, in vk?