Advertisement
Guest User

example

a guest
Nov 15th, 2012
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.94 KB | None | 0 0
  1. <?php
  2.  
  3. function unique_id($length) {
  4.   $rnd1 = mt_rand(0,10000);
  5.   $rnd2 = mt_rand(0,10000);
  6.   $rnd3 = mt_rand(0,10000);
  7.  
  8.   $hash = str_shuffle(sha1($rnd1).md5(microtime()).sha1($rnd2.microtime()).md5($rnd3));
  9.   return substr($hash, 0, $length);
  10. }
  11.  
  12. /**
  13.  * whoi, lets give feedback and
  14.  * show us some random-ids with
  15.  * a seckey / imploded with ; /
  16.  */
  17. $qnt = 40;
  18. for($i = 0; $i < $qnt; $i++) {
  19.   echo implode(';',array(
  20.     unique_id(20),
  21.     unique_id(8),
  22.   ));
  23.   echo '<br />';
  24. }
  25.  
  26. /** reult:
  27.  * 2ccf5e17999e0550c263;79ea79d7
  28.  * 9a50a23399b0a8e19d5e;099fb725
  29.  * f90a2d5b75f8.1deb8fd;3773061c
  30.  * 8ee9c480f5006334.cb5;e4f8048e
  31.  * 4f1f12a29b5c592e0a9b;4 f20d7a
  32.  * 4019620d0853cff290.7;058823d4
  33.  * abdb1681718bcd6859e1;5066.040
  34.  * 412df0f70f51b98efdc9;f583c0f7
  35.  * 692e85693fab3345a1e0;c0e22c1e
  36.  * e450f8879563d30aa472;42dc1197
  37.  * ..and so on..
  38.  * 1st row:
  39.  * unique-id:   2ccf5e17999e0550c263
  40.  * secKey:  79ea79d7
  41. **/
  42.  
  43. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement