PHP Classes

CSRF protector: Prevent CSRF exploits by storing keys in database

Recommend this page to a friend!
     
  Info   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 873 All time: 4,028 This week: 455Up
Version License PHP version Categories
csrf_class 1.0Public Domain5PHP 5, Databases, User Management, Se...
Description 

Author

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.

Picture of Michael A. Peters
Name: Michael A. Peters <contact>
Classes: 6 packages by
Country: United States United States
Age: 51
All time rank: 882118 in United States United States
Week rank: 192 Up22 in United States United States Up
Innovation award
Innovation award
Nominee: 2x

  Files folder image Files (2)  
File Role Description
Plain text file csrf_class.php Class Class File
Accessible without login HTML file README.html Doc. Documentation

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:873
This week:0
All time:4,028
This week:455Up