populate-cc_files.php 641 B

123456789101112131415161718192021
  1. <?php
  2. function GenerateRandomString($p_len=20, $p_chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789')
  3. {
  4. $string = '';
  5. for ($i = 0; $i < $p_len; $i++)
  6. {
  7. $pos = mt_rand(0, strlen($p_chars)-1);
  8. $string .= $p_chars{$pos};
  9. }
  10. return $string;
  11. }
  12. $connection = pg_connect("host=localhost dbname=airtime user=airtime password=airtime");
  13. for ($i=0; $i<1000000; $i++){
  14. $md5 = md5($i);
  15. $sql = "INSERT INTO cc_files (gunid, name, artist_name, track_title, album_title) VALUES ('$md5', '".md5($i."salt")."', '".md5($i."salt1")."', '".md5($i."salt2")."', '".md5($i."salt3")."')";
  16. pg_exec($connection, $sql);
  17. }