Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > 61cbe9faf4b37c89edd4a37841291785 > files > 20

ezcomponents-Authentication-1.3.1-3.mga4.noarch.rpm

<?php
require_once 'tutorial_autoload.php';

// generate a token and save it in the session or in a file/database
$pattern = "1234567890abcdefghijklmnopqrstuvwxyz";
$token  = "";
for( $i = 1; $i <= 6 ; $i++ )
{
    $token .= $pattern{rand( 0, 36 )};
}
$encryptedToken = sha1( $token );

// save the $encryptedToken in the session
session_start();
$_SESSION['encryptedToken'] = $encryptedToken;

// also generate a distorted image which contains the symbols from $token and use it
?>