%PDF- %PDF-
Direktori : /data/www_bck/varak.net_bck/wow2.varak.net/xml/ |
Current File : //data/www_bck/varak.net_bck/wow2.varak.net/xml/mplog.php |
<?php include("../lib.php"); $tzac=getmicrotime(); header("Content-type: text/plain"); $res = file("mplog.txt"); $spojeni = mysql_connect("localhost", "waritko", "blade666"); mysql_select_db("waritko_eqdkp", $spojeni); $cnt = count($res); for($i = 0; $i < $cnt-1; $i++) { $it = explode(';', $res[$i]); $it2 = explode(';', $res[$i+1]); $artist = str_replace("'", "''", $it[2]); $album = str_replace("'", "''", $it[3]); $track = str_replace("'", "''", $it[1]); $time = strtotime($it[4]); $t2 = strtotime($it2[4]); srand(21); $duration = ($t2-$time) > 30 && ($t2-$time) < 500 ? ($t2-$time) : (rand()%456) + 30; q("insert into played(artist, album, track, time, duration) values('$artist', '$album', '$track', $time, $duration);\n"); $count++; //echo $que; } mysql_close($spojeni); unlink("mplog.txt"); $mem = sprintf("%01.2f", memory_get_peak_usage(true)/(1024*2024)); $tkon=getmicrotime(); $time=$tkon-$tzac; $time = sprintf("%01.4f", $time); echo "Hotovo, importovano $count prehranych pisnicek\nImport trval $time sekund, bylo pouzito $mem MB pameti\n"; ?>