File: server_FormToken.php

Recommend this page to a friend!
  Classes of Ray Paseur  >  Lightweight PHP Form Token Validation  >  server_FormToken.php  >  Download  
File: server_FormToken.php
Role: Application script
Content type: text/plain
Description: Server-side token generator
Class: Lightweight PHP Form Token Validation
Generate and validate form tokens served via AJAX
Author: By
Last change:
Date: 1 year ago
Size: 500 bytes


Class file image Download
<?php // server_FormToken.php
 * A server side script that responds to an AJAX request
 * This script gets a form token object and encodes it into a JSON string
 * It stores the JSON string in the PHP session and echos it to the client

// Get, save, and return a new form token object
$token = FormToken::get();
$_SESSION[$token->name] = json_encode($token);

For more information send a message to info at phpclasses dot org.