crodas/csrf-token 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

crodas/csrf-token

Composer 安装命令:

composer require crodas/csrf-token

包简介

Easier way to generate CSRF tokens

README 文档

README

Stateless CSRF-token generation and verification.

Instalation

composer require crodas/csrf-token:"^1.0"

Properties

  1. Hashes are unique per IP
  2. They require a site secret, so hashes are impossible to forge.
  3. Hashes expires after a certain amount of time (Default: 1 hour)

How to use it

Initialize the library:

require __DIR__ . '/vendor/autoload.php';

CSRF::setSecret($strong_secret_key);

Add it to your forms

<input type="hidden" name="_csrf" value="<?php echo CSRF::generate() ?>" />

And then verify the hashes are legit and still valid:

if (empty($_POST['_csrf']) || !CSRF::verify($_POST['_csrf'])) {
  throw new Exception("CSRF Token is invalid");
}

统计信息

  • 总下载量: 20
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-4-Clause
  • 更新时间: 2015-12-25

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固