Get a Hashed SubDirectory


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



Copy this code and paste it in your HTML
  1. /**
  2.  * get a hashed subdir.
  3.  *
  4.  * @author liuran
  5.  */
  6. function getHashedDir ()
  7. {
  8. $key_1 = rand (32768, 65535);
  9. $key_2 = microtime ();
  10. $key_3 = sha1 (time ());
  11.  
  12. $sid = md5 ($key_1 . $key_3 . $key_2);
  13. $hash_dir = substr ($sid, 0, 2) . '/' . substr ($sid, 15, 2) . '/';
  14. return $hash_dir;
  15. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.