<?php

session_start();

    require_once('../libs/Ultraviolet.php');
	
	require_once('../libs/Database.php');
	
	require_once('../libs/AdminFunctions.php');
		
	$database =& DatabaseConnect::getInstance();
	
	$database->query("SET CHARACTER SET utf8");
	
	$functions =& AdminFunctions::getInstance();


for($i = 0; $i < count($_POST); $i++):

		${key($_POST)} = $_POST[key($_POST)];

		next($_POST);	

	endfor;

$database->setBareQuery("SELECT id FROM task WHERE user = '".$user."' AND date = '".$dateval."'");

				$task_id = $database->loadResultArray(0);
				
				if(count($task_id) != 0) { $database->query("DELETE FROM task WHERE user = '".$user."' AND date = '".$dateval."'");
				
				if(strlen(mysql_error()) > 0){
    				echo mysql_errno().': '.mysql_error();
				}
				else{
   				 echo 'success';
					}
				 }
				
				else { echo 'success';}
				

		


?>

