PHP Classes

PHP CSRF Protection: Generate and validate tokens against CSRF attacks

Recommend this page to a friend!
  Info   View files Example   View files View files (2)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2023-06-02 (3 months ago) RSS 2.0 feedNot enough user ratingsTotal: 458 All time: 6,083 This week: 132Up
Version License PHP version Categories
php-csrf 1.7GNU General Publi...5.0PHP 5, Validation, Security


This class can generate and validate tokens against CSRF attacks.

It creates a random token based on the current user IP address, browser identification.

The generated token is stored in a session variable that may include the name of the form on which the token will be used.

The class can also validate the generated token passed via a form field or a link parameter to verify if it matches the token stored in the session variable.

Picture of Radovan Janjic
  Performance   Level  
Name: Radovan Janjic is available for providing paid consulting. Contact Radovan Janjic .
Classes: 14 packages by
Country: Serbia Serbia
Age: 35
All time rank: 2432 in Serbia Serbia
Week rank: 60 Up1 in Serbia Serbia Up
Innovation award
Innovation award
Nominee: 3x

  Files folder image Files  
File Role Description
Plain text file CSRF.class.php Class Class source
Accessible without login Plain text file example.php Example Example script

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:6,083
This week:132Up