function create_track_record($input)
{
    // $input = str_replace ('&', '&', $input);
    $json = json_decode($input);
    $i = 0;
    foreach ($json->tracks->track as $track) {
        $lasttid = get_lasttnb();
        $trackid = $lasttid["lasttnb"] + 1;
        $mp3file = sprintf("trxx%08d.mp3", $trackid);
        $query = "INSERT INTO tracks \n\t\t\t\t\t\t(artist,\n\t\t\t\t\t\ttitle,\n\t\t\t\t\t\tcomposer,\n\t\t\t\t\t\tgenre1,\n\t\t\t\t\t\tgenre2,\n\t\t\t\t\t\tyear,\n\t\t\t\t\t\tlang,\n\t\t\t\t\t\ttype,\n\t\t\t\t\t\trating,\n\t\t\t\t\t\tlength,\n\t\t\t\t\t\tsource,\n\t\t\t\t\t\tsourceid,\n\t\t\t\t\t\ttracknb,\n\t\t\t\t\t\tquality,\n\t\t\t\t\t\tlyrics,\n\t\t\t\t\t\tmoreinfo,\n\t\t\t\t\t\tbitrate,\n\t\t\t\t\t\tcreated,\n\t\t\t\t\t\tmodified,\n\t\t\t\t\t\tmp3file ) \n\t\t\t\t\tVALUES ('" . html_entity_decode($track->artist) . "',\n\t\t\t\t\t\t'" . html_entity_decode($track->title) . "',\n\t\t\t\t\t\t'" . html_entity_decode($track->composer) . "',\n\t\t\t\t\t\t'{$track->genre1}',\n\t\t\t\t\t\t'{$track->genre2}',\n\t\t\t\t\t\t'{$track->year}',\n\t\t\t\t\t\t'{$track->lang}',\n\t\t\t\t\t\t'{$track->type}',\n\t\t\t\t\t\t'{$track->rating}',\n\t\t\t\t\t\t'{$track->length}',\n\t\t\t\t\t\t'{$track->source}',\n\t\t\t\t\t\t'{$track->sourceid}',\n\t\t\t\t\t\t'{$track->tracknb}',\n\t\t\t\t\t\t'{$track->quality}',\n\t\t\t\t\t\t'{$track->lyrics}',\n\t\t\t\t\t\t'{$track->moreinfo}',\n\t\t\t\t\t\t'{$track->bitrate}',\n\t\t\t\t\t\t'{$track->created}',\n\t\t\t\t\t\t'{$track->modified}',\n\t\t\t\t\t\t'{$mp3file}' )";
        $result = mysql_query($query) or die('Query failed: ' . mysql_error());
        if ($result != "1") {
            $res[$i]["created"] = false;
            $res[$i]["file"] = stripslashes(htmlspecialchars_decode($track->filename, ENT_QUOTES));
            $res[$i]["copied"] = false;
            $i++;
        } else {
            $res[$i]["created"] = true;
            $res[$i]["file"] = stripslashes(htmlspecialchars_decode($track->filename, ENT_QUOTES));
            $res[$i]["copied"] = copy_track(htmlspecialchars_decode($track->filename, ENT_QUOTES), $mp3file, htmlspecialchars_decode($track->mvdir, ENT_QUOTES));
            $i++;
        }
    }
    return $res;
}
/* **************************************************
/  REST Webservice for GiantDisc
/  created by Andreas Baierl, 25.11.2009
/  
/
/  infos.php - 	get special infos from db (get) 
/               
/
/* *************************************************/
require_once "include/includes.php";
$database = init_database();
if (isset($_GET['type'])) {
    $type = $_GET['type'];
}
// Check for the path elements
$path = $_SERVER[PATH_INFO];
if ($path != null) {
    $path_params = spliti("/", $path);
}
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
    // GET Request
    set_headers($type);
    if ($path_params[1] != null) {
        if ($path_params[1] == lasttnb) {
            render_result(get_lasttnb(), "infos", $type);
            /* render highest used tracknumber */
        }
    }
}
mysql_close($database);
			<tr>
			<th>Import</>
			<th>Filename</>
			<th>Artist,	Title, Composer</>
			<th>Genre1, Genre2, Year</>
			<th>Lang, Type, Rating</>
			<th>Length</>
			<th>Source, TrackNB, Quality</>
			<th>Lyrics, MoreInfo</>
			<th>Bitrate, Created, Modified, SourceID</>
			</tr>';
            for ($i = 0; $i < $_POST['album' . $k . '_len']; $i++) {
                $result = "";
                $json = json_decode(id3_info(stripslashes($_POST['album_' . $k . '_file_' . $i])));
                // get id3 infos (rest-request)
                $lasttnb = json_decode(get_lasttnb())->lasttnb;
                // last used tracknumber from db (rest-request)
                $album_cddbid = $lasttnb + $j + 1;
                // create editable track details
                echo '
				<tr>
				<td><input type="checkbox" checked name="album_' . $j . '_imp_' . $i . '" value="' . $i . '" /></td>
				<td><input type="hidden" name="album_' . $j . '_file_' . $i . '" value="' . stripslashes(htmlspecialchars($_POST['album_' . $k . '_file_' . $i])) . '"/>' . stripslashes(htmlspecialchars($_POST['album_' . $k . '_file_' . $i])) . '</td>
				<td><input type="text" name="album_' . $j . '_artist_' . $i . '" value="' . htmlspecialchars($json->tag->artist) . '"/>
				<input type="text" name="album_' . $j . '_title_' . $i . '" value="' . htmlspecialchars($json->tag->title) . '"/>
				<input type="text" name="album_' . $j . '_composer_' . $i . '" value="' . htmlspecialchars($json->tag->composer) . '" /></td>
				<td><select name="album_' . $j . '_genre1_' . $i . '" size="1">' . get_genres_select_options($json->tag->genre1) . '</select>
				<select name="album_' . $j . '_genre2_' . $i . '" size="1">' . get_genres_select_options($json->tag->genre2) . '</select>
				<input type="text" name="album_' . $j . '_year_' . $i . '" value="' . $json->tag->year . '"/></td>
				<td><select name="album_' . $j . '_lang_' . $i . '" size="1">' . get_language_select_options("") . '</select>
				<select name="album_' . $j . '_type_' . $i . '" size="1">' . get_type_select_options("") . '</select>