This is not exactly a "Number Used Once". Neither a number Nor can be Just Used Once. But can Reduce the Repitive Attachs by Decreasing the Window of attach
To apply to your project
- include the class in all your file that needs to generate nonce or verify nonce. Eg.
<?php include(PATH TO ar_nonce.class.php ); ?>
- Then create new instance of class
<?php $nonce=new ar_Nonce(); ?>
- To attach a nonce we have 3 methods.
- To attach in Form :
<?php echo $nonce->generate_form_nonce(string $action , [ string $user ] , [ bool $output=false ]); ?>
- To attach in Url :
<?php echo $nonce->generate_url_nonce( string $action,[ string $user],[bool $out=false ]); ?>
- To other purposes :
<?php echo $nonce->generate( string $action ,[string $user] , [ int $timeoutSeconds , [ string $secretKey ]); ?>
- To attach in Form :
- To verify a nonce :
<?php $nonce->check(string $nonce , string $action , [ string $user ], [ string $secret]) ?>