function myscan(&$arr, $dir) { $cont = glob($dir . "/*"); // echo "myscan"; foreach ($cont as $file) { if (is_dir($file)) { if ($file != '.' && $file != '..') { myscan($arr, $file); } } else { if (strpos($file, ".mp3") != false) { $tags = mp3tags($file); // print_r($tags); $artist = $tags["ARTISTS"]; $filename = substr($file, DIR_CUT_COUNT); $filename = iconv("windows-1251", "UTF-8", $filename); $artist = iconv("windows-1251", "UTF-8", $tags["ARTISTS"]); $album = iconv("windows-1251", "UTF-8", $tags["ALBUM"]); $title = iconv("windows-1251", "UTF-8", $tags["NAME"]); $genre = getGenre($tags["GENRENO"]); $year = $tags["YEAR"]; $cover = substr(dirname($file) . "/cover.jpg", DIR_CUT_COUNT); $cover = substr(dirname(iconv("windows-1251", "UTF-8", $file)) . "/cover.jpg", DIR_CUT_COUNT); $filename = mysql_real_escape_string($filename); $artist = mysql_real_escape_string($artist); $album = mysql_real_escape_string($album); $title = mysql_real_escape_string($title); $cover = mysql_real_escape_string($cover); //записываем в базу данных $sql = "insert into " . MUSIC_TABLE . " (artist,albums,tracks,filename,cover,genre,year) values \n\t\t\t\t('{$artist}','{$album}','{$title}','{$filename}','{$cover}','{$genre}','{$year}')"; $q = mysql_query($sql) or die(mysql_error()); echo "{$artist}|{$album}|{$title}|{$genre}|{$year}<br>{$filename}"; echo "<hr><br>"; } } } }
if ($file != '.' && $file != '..') { if ($file->isFile()) { if ($file->getExtension() == 'mp3') { $tags = mp3tags($file); $filename = $file; $cover = dirname($filename) . "/cover.jpg"; if (mb_detect_encoding($filename, 'UTF-8', true) === false) { // $filename = iconv("windows-1251","UTF-8",$filename); echo "Coding into WINDOWS-1251<br>"; $filename = iconv("WINDOWS-1251", "UTF-8", $filename); $cover = dirname($filename) . "/cover.jpg"; } $artist = iconv("windows-1251", "UTF-8", $tags["ARTISTS"]); $album = iconv("windows-1251", "UTF-8", $tags["ALBUM"]); $title = iconv("windows-1251", "UTF-8", $tags["NAME"]); $genre = getGenre($tags["GENRENO"]); $year = $tags["YEAR"]; $size_tracks += $file->getSize(); $count_tracks++; $filename = mysql_real_escape_string($filename); $artist = mysql_real_escape_string($artist); $album = mysql_real_escape_string($album); $title = mysql_real_escape_string($title); $cover = mysql_real_escape_string($cover); addToTable($artist, $album, $title, $genre, $year, $filename, $cover, $current_date); echo "{$artist}|{$album}|{$title}|{$genre}|{$year}<br> {$filename}"; echo "<hr><br>"; // if($count_tracks == 100) die(); // echo "$file<br>"; } }
<body> <?php include "navbar.php"; ?> <div class="content_wrapper"> <div id="sidebar"> <div id="sidebar_title">Occupations</div> <ul id="cats"> <?php getOccupation(); ?> </ul> <div id="sidebar_title">Genre</div> <ul id="cats"> <?php getGenre(); ?> </ul> </div> <div id = "product_box"> <form action="" method="post" enctype="multipart/form-data"> <table align="center" width="700" bgcolor="skyblue"> <tr align= "center"> <th>Remove</th> <th>Product($)</th> <th>Total Price:</th> </tr> <?php $total = 0; global $con; $ip = getIp();
<?php $page_title = 'Browse Movies'; include '_header.php'; include 'fun.inc.php'; ?> <link REL="SHORTCUT ICON" HREF="http://www.teachnet-uk.org.uk/2006%20Projects/ICT-Access_Database/AccessDB/Images/dvd-icon.jpg"> <p></p> <?php $list = getGenre(); foreach ($list as $value) { echo '<form action="ViewGenresMovies.php" method="post">'; echo '<p><div name=' . $value . '><p>'; echo $value; echo '<table name="' . $value . '"align="center" cellspacing="3" cellpadding="3" width="75%" style="border:dotted"> <tr><td align="left">Title</td><td align="left">Date of Release</td><td align="left">Genres</td><td align="left"></td></tr>'; getMovies($value); echo '</table>'; echo '<label><input type="submit" value="More..."/><input name="cat" type="hidden" value="' . $value . '"/></label>'; echo '</p></div></p>'; echo '</form>'; } ?> <?php include '_footer.php';
function addFolder($folder){ $dir_iterator = new RecursiveDirectoryIterator($folder); $iterator = new RecursiveIteratorIterator($dir_iterator, RecursiveIteratorIterator::SELF_FIRST); Log_("Запускаю сканирование по каталогу $folder"); $count_tracks = $size_tracks = 0; $current_date = date("Y-m-d H:i:s"); $cc = 0; foreach ($iterator as $file) { if( $file != '.' && $file != '..') if( $file->isFile() ) { if( $file->getExtension() == 'mp3' ) { $tags = mp3tags($file); $filename = $file; $cover = dirname($filename)."/cover.jpg"; if (mb_detect_encoding($filename, 'UTF-8', true) === false) { // $filename = iconv("windows-1251","UTF-8",$filename); echo "Coding into WINDOWS-1251<br>"; $filename = iconv("WINDOWS-1251","UTF-8",$filename); $cover = dirname($filename)."/cover.jpg"; } $artist = iconv("windows-1251","UTF-8",$tags["ARTISTS"]); $album = iconv("windows-1251","UTF-8",$tags["ALBUM"]); $title = iconv("windows-1251","UTF-8",$tags["NAME"]); $genre = getGenre($tags["GENRENO"]); $year = $tags["YEAR"]; $size_tracks += $file->getSize(); $count_tracks ++; $filename = mysql_real_escape_string($filename); $artist = mysql_real_escape_string($artist); $album = mysql_real_escape_string($album); $title = mysql_real_escape_string($title); $cover = mysql_real_escape_string($cover); addToTable($artist, $album, $title, $genre, $year, $filename, $cover, $current_date); Log_("Добавление файла: $filename"); Log_("С тегами: $artist - $album - $title - $genre - $year"); // echo "$artist|$album|$title|$genre|$year<br> $filename"; // echo "<hr><br>"; } } } Log_("Сканирование завершено. Добавлено файлов $count_tracks."); $size_tracks_mb = round($size_tracks / 1000000000,2); $mas = getInfoTable(); $size_tracks_mb += $mas["size"]; $count_tracks += $mas["count"]; setInfoToTable($count_tracks, $size_tracks_mb); return 1; }
</form> <?php $totalCount = getCount(); $avgPrice = getAvgPrice(); echo "<h2>Total Games: " . $totalCount[0] . "</h2>"; echo "<h4>Average Price: \$" . number_format($avgPrice[0], 2) . "</h4>"; ?> </nav> <?php if (isset($_POST['moreInfo'])) { $gameInfo = getGame($_POST['gameId']); $currentGenre = getGenre($gameInfo['gameGenre']); $currentRating = getRating($gameInfo['gameRating']); $currentPublisher = getPublisher($gameInfo['gamePublisher']); echo "<div id=\"moreInfoPanel\">"; echo "<img src = \"_images/_boxart/" . $gameInfo['gameId'] . ".jpg\" class = \"gameArt\" height = \"295px\" width = \"225px\">"; echo "<h3>" . $gameInfo['gameTitle'] . "</h3>"; echo "<p> Players: " . $gameInfo['players'] . "</p>"; echo "<p> Co-Op Play: " . $gameInfo['co-op'] . "</p>"; echo "<p>Rating: " . $currentRating[0] . "</p>"; echo "<p>Genre: " . $currentGenre[0] . "</p>"; echo "<p>Publisher: " . $currentPublisher[0] . "</p>"; echo "<p>Release Date: " . $gameInfo['releaseDate'] . "</p>"; echo "<a href=\"index.php\">Close More Info</a>"; echo "</div>"; } ?>
<?php require_once "connect.php"; require_once "functions.php"; //get author data if (!is_numeric($id) || is_numeric($_GET['id'])) { $id = $mysqli->real_escape_string($_GET['id']); } else { echo "Error: No genre selected"; exit; } //We now have the relevant genre ID, so load them $genres = getGenre($id); $genre = $genres['genre'][0]; ?> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title><?php echo $genre['name']; ?> - Shastrix Books</title> <link rel="stylesheet" type="text/css" href="/books/styles.css"> <link rel="icon" href="http://s3.shastrix.co.uk/favicon.ico" type="image/x-icon"> <script src="http://code.jquery.com/jquery-1.10.1.min.js"></script> <script src="scripts.js"></script> </head> <body> <div id="wrapper"> <header>