1. Go to this page and download the library: Download softsmart/simple-nonce library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
softsmart / simple-nonce example snippets
php
// Generate Nonce
$UserID = 1; // This is the user account we're about to delete
$action = "deleteUser";
$meta = [$UserID];
// Optionally set configuration at runtime, else use config.inc.php
$nonceConfig = ["salt"=>"your-salt", "ttl"=>3600];
$nonceEngine = new \SoftSmart\Utilities\SimpleNonce($nonceConfig);
$nonceValues = $nonceEngine->generateNonce($action, $meta);
header("Location: ./deleteUser.php?userID=".$userID."&nonce=".$nonceValues["nonce"]."&timeStamp=".$nonceValues["timeStamp"]);
// Verify Nonce
$UserID = 1; // This is the user account we're about to delete
$action = "deleteUser";
$meta = [$UserID];
$result = SimpleNonce::verifyNonce($nonceValues["nonce"], $action, $nonceValues["timeStamp"], $meta);
if( ! $Result )
{
echo "Nonce failed";
exit();
}
echo "Nonce passed, continue....";
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.