PageRenderTime 53ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/md5.php

http://hamenui.googlecode.com/
PHP | 36 lines | 33 code | 3 blank | 0 comment | 3 complexity | 6f540ca1016ac5f28e120334b3350cff MD5 | raw file
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <head>
  4. <title> MD5 </title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6. <meta name="Generator" content="EditPlus">
  7. <meta name="Author" content="">
  8. <meta name="Keywords" content="">
  9. <meta name="Description" content="">
  10. </head>
  11. <body>
  12. <?php
  13. $max = 1000;
  14. $num_array = array();
  15. $sql = '';
  16. $db = new mysqli('localhost', 'root', 'root', 'test');
  17. if($db->connect_error) {
  18. die('Connect Errot(' . $db->connect_errno . ') ' . $db->connect_error);
  19. }
  20. for($i = 0; $i < $max; $i++) {
  21. $number = mt_rand(100000,999999);
  22. if(in_array($number, $num_array)) {
  23. continue;
  24. }
  25. $num_array[] = $number;
  26. $md5 = md5($number);
  27. $sql .= "INSERT INTO `md5`(number, md5) VALUES('{$number}','{$md5}');";
  28. }
  29. $db->multi_query($sql);
  30. echo "success!";
  31. ?>
  32. </body>
  33. </html>