It doesn't look like you are calling the function... don't you need to add:
<?php
$cart = $_GET['cart'];
$id = $_GET['id'];
function DeleteByID($cart,$id) {
for ($n=0; $n<sizeof($cart->Items); $n++) {
if ($cart->Items[$n]) {
if ($cart->Items[$n]->ID == $id) {
$cart->Items[$index] = null;
$cart->ReIndexContent();
$cart->ResetAll();
$cart->SaveCart();
}
}
}
}
DeleteByID($cart,$id)
?>