function reviewTrack($track_name, $disc_num, $track_num, $artist_name, $airabilityID, $albumID)
{
    if (!is_numeric($disc_num)) {
        return FALSE;
    }
    if (!is_numeric($track_num)) {
        return FALSE;
    }
    if (!is_numeric($airabilityID)) {
        return FALSE;
    }
    if (!is_numeric($albumID)) {
        return FALSE;
    }
    $track_name = mysql_real_escape_string($track_name);
    $artistID = artistCheck($artist_name);
    if (!$artistID) {
        $artistID = insertArtist($artist_name);
    }
    $query = sprintf("UPDATE libtrack SET track_name='%s', artistID='%d', airabilityID='%d' WHERE track_num='%d' AND disc_num='%d' AND albumID='%d'", $track_name, $artistID, $airabilityID, $track_num, $disc_num, $albumID);
    mysql_query($query) or die("reviewNewTrack failed : " . mysql_error());
    return TRUE;
}
示例#2
0
     if (!unlink($trFile)) {
         die("Could not delete: {$trFile}");
         echo "Deleted: {$trFile}<br>";
         echo "Success!<br>";
     }
 } else {
     $rs = fopen("import_todelete.txt", 'a');
     fwrite($rs, $trFile . "\n");
     fclose($rs);
 }
 /** libtrack modifying **/
 $qu = "SELECT * FROM libtrack WHERE albumID='{$cID}' AND track_num='{$trNum}' AND disc_num ='{$discNum}'";
 $rs = mysql_query($qu);
 if (mysql_num_rows($rs) == 1) {
     if (!($artistID = artistCheck($trArtist))) {
         $artistID = insertArtist($trArtist);
     }
     $qu2 = "UPDATE libtrack SET track_name='{$trName}', artistID='{$artistID}', file_name='" . urlencode($dirDB) . "' WHERE albumID='{$cID}' AND track_num='{$trNum}' AND disc_num ='{$discNum}'";
     //urlencode($newPath)
     mysql_query($qu2);
     //if(mysql_affected_rows() != 1)
     //	die("dead on qu2: ".mysql_error());
     echo "Track updated, already exists as album: {$cID} disc: {$discNum} track: {$trNum} <br>";
     $description = "UPDATED {$ctr} tracks for existing album: {$cID}";
 } elseif (mysql_num_rows($rs) == 0) {
     insertNewTrack($trName, $discNum, $trNum, $trArtist, $cID, urlencode($dirDB));
     //urlencode($newPath)
     echo "New track: {$trName} by {$trArtist}<br>";
     $description = "INSERTED {$ctr} tracks for new album: {$cID}";
 } else {
     die("libtrack rows not one or zero!");