PHP Classes

File: index.php

Recommend this page to a friend!
  Classes of Muhammad Umer Farooq   PHP CSRF Token Generation   index.php   Download  
File: index.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP CSRF Token Generation
Generate tokens to protect against CSRF attacks
Author: By
Last change: Apply fixes from StyleCI
Date: 6 years ago
Size: 999 bytes
 

Contents

Class file image Download
<?php require_once 'start.php'; ?>
<head>
  <title>PHP Security class example 1</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
</head>
<div class="container">
  <form action='start.php' method="post">
    <div class="form-group">
        <input type='hidden' name='token' value="<?= $security->GenerateTokens(3, 20); ?>" />
      <label for="comment">Comment:</label>
      <textarea class="form-control" rows="5" name='q'></textarea>
      <br>
      <input type='submit' name='submit' class="btn btn-success" value='Submit' />
    </div>
  </form>
</div>