HomeAudio/ajax_queuesong.php

30 lines
855 B
PHP

<?php
require 'header.php';
if ( !isset($_REQUEST['songid']) ) {
exit();
}
$song = new Song($_REQUEST['songid']);
if ( (substr($song->getPath(), 0, 10) == "Christmas/") && (intval(date("n")) != 12) ) exit();
if ( $_SESSION['queuetarget'] == 0 ) {
$query = "INSERT INTO " . INSTANTQTABLE . " (songid) VALUES(:songid)";
$sth = $globaldbh->prepare($query);
$fields = array();
$fields[':songid'] = $song->getID();
$sth->execute($fields);
} else {
if ( RESTRICTQUEUES && (substr($_SERVER['REMOTE_ADDR'], 0, strlen(LOCALNETWORK)) != LOCALNETWORK) ) exit();
$query = "INSERT INTO " . QUEUECONTENTSTABLE . " (qid, songid) VALUES(:qid, :songid)";
$sth = $globaldbh->prepare($query);
$fields = array();
$fields[':qid'] = $_SESSION['queuetarget'];
$fields[':songid'] = $song->getID();
$sth->execute($fields);
}
exit();
?>