This is a PHP5 class that will allow you to generate a key for an especific user and validate it. In the features, there are:
- It generates a 25 characters key
- You can change the length of the key that will be generated (default 25)
- You can set what characters do you want in the key (Default A-Z a-z 0-9 !@^$*()_+)
- You can set the file where will be saved the users/keys
- The key comes with rawurlencode(), this will allow you to pass the key trough an URL
- The system doesn’t duplicates keys or usernames! If the entered username is repeated, the system will just return the existing key of the respective user
- You can use this wherever you want (Integration is too easy)
- You don’t need database! And if you want, you can integrate this into a database
The finality is that you can easy implement this class to your API and allow the controlled use of it. With this class you only generate and validate keys, allowing to add whatever you want. For example, in the validating file you can save in a database each petition and control them!
Why do you not try it?
Rating will be really appreciated.
Questions? Suggestions? Please, don’t doubt to leave a comment!
*Renewed code estructure
*Fixed bugs in validation/generation. (bad url-encoding)
*Added setFile(), setChars() and setLength()
Item added in CodeCanyon