Databases: CSRF protector
Michael A. Peters (contact me)
This class can be used to prevent Cross-site Request Forgery (CSRF) exploits by storing token keys in database.
It can generate a random key and store it in a database record associated to the current session. It uses PEAR MDB2 database abstraction layer to support many types of databases.
The class can also check if the key is valid when the form is submitted with a token hidden input field. If it exists, the key record is deleted from the database to avoid it is reused.
Click here for detailed information about this class on phpclasses.org