Generating random hash


/ Published in: PHP
Save to your folder(s)

I'm using this to send verification emails.


Copy this code and paste it in your HTML
  1. function generateHash(){
  2. $result = "";
  3. $charPool = '0123456789abcdefghijklmnopqrstuvwxyz';
  4. for($p = 0; $p<15; $p++)
  5. $result .= $charPool[mt_rand(0,strlen($charPool)-1)];
  6. return sha1(md5(sha1($result)));
  7. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.