<?php
defined('_VALID') or die('Restricted Access!');

require $config['BASE_DIR']. '/classes/filter.class.php';
require $config['BASE_DIR']. '/include/adodb/adodb.inc.php';
require $config['BASE_DIR']. '/include/dbconn.php';
require $config['BASE_DIR']. '/include/sessions.php';

disableRegisterGlobals();

$response           = NULL;
if ( isset($_POST['video_id']) ) {
    if ( isset($_SESSION['uid']) ) {
        $filter     = new VFilter();
        $vid        = $filter->get('video_id', 'INTEGER');
        $uid        = intval($_SESSION['uid']);
        $sql        = "DELETE FROM playlist WHERE UID = " .$uid. " AND VID = " .$vid. " LIMIT 1";
        $conn->execute($sql);
    } else {
        $response   = 'Please login to remove videos from your playlist!';
    }
}

echo $response;
die();
?>
