예제 #1
0
파일: listen.php 프로젝트: nsystem1/tuneefy
<?php

require '../../config.php';
$failSilently = true;
require _PATH . 'include/database/DBUtils.class.php';
require _PATH . 'include/database/DBLogger.class.php';
require _PATH . 'include/database/DBConnection.class.php';
if (isset($_GET['t']) && isset($_GET['p'])) {
    if (isset($_GET['i'])) {
        $track = intval(DBUtils::fromUId($_GET['i'], _BASE_MULTIPLIER));
    } else {
        $track = 0;
    }
    // Adds an entry
    DBLogger::addGlobalHit($_GET['p'], $track);
    header('Location: ' . $_GET['t']);
    return false;
} else {
    header('Location: ' . _SITE_URL . '/woops');
}
예제 #2
0
<?php

require _PATH . 'include/database/DBUtils.class.php';
require _PATH . 'include/database/DBLogger.class.php';
require _PATH . 'include/database/DBConnection.class.php';
// We retrieve the base_id and check it is correct :
$base_id = DBUtils::fromUId($request, _BASE_MULTIPLIER);
if ($base_id != intval($base_id)) {
    // Looks like the ID is not good
    header('Location: ' . _SITE_URL . '/404');
    exit;
}
// Retrieves the item
$item = DBUtils::retrieveItem($base_id);
if (!$item) {
    header('Location: ' . _SITE_URL . '/404');
}
// We add a hit
DBLogger::addHit($base_id);
// Checks if we want to display an album or a track
if ($action == 'track') {
    $requestedType = _TABLE_TRACK;
    $complementaryShortCode = '/a/';
} else {
    if ($action == 'album') {
        $requestedType = _TABLE_ALBUM;
        $complementaryShortCode = '/t/';
    }
}
// Is the requested type correct ?
if (intval($item['type']) != intval($requestedType)) {