Advertisement
MohammedOsama

dynamic input field name

Sep 13th, 2016
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.62 KB | None | 0 0
  1. <?php
  2. //secret key for encoding form field
  3. $_SESSION['__form_key']=$secret=bin2hex(openssl_random_pseudo_bytes(16));
  4. $input=array();
  5. foreach ($filed_names as $v){
  6.  
  7. $hashed_name=hash_hmac('md5',$v,$secret);
  8.     if(isset($_POST[$hashed_name])){
  9.  
  10.     $input[$v]=$_POST[$hashed_name];
  11.     }
  12. }
  13.  
  14. ?>
  15. <form action='<? echo htmlentities($_SERVER['PHP_SELF']); ?>' method='POST'>
  16. username: <input type='text' name='<?= hash_hmac('md5','login',$secret); ?>' />
  17. password : <input type='password' name='<?= hash_hmac('md5' , 'password',$secret); ?>' />
  18. <input type='submit' name='<?= hash_hmac('md5','submit',$secret); ?>' />
  19. </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement