Guest User

Untitled

a guest
Jul 19th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. echo "<input name='rft' type='hidden' value='".random_form_token()."' />";
  2. if(random_form_token($_POST['rft'])){
  3. //
  4. }
  5. else{
  6. //
  7. }
  8. function random_form_token($value=NULL){
  9. if($value == NULL){
  10. $token = hash("sha256","tanzmal".microtime());
  11. $_SESSION['random_form_token'] = $token;
  12. return $token;
  13. }
  14. else{
  15. if($value == $_SESSION['random_form_token']){
  16. unset($_SESSION['random_form_token']);
  17. return true;
  18.  
  19. }
  20. else
  21. return false;
  22. }
  23. }
Add Comment
Please, Sign In to add comment