Well, just looking at your function (without looking at the rest of the code) I can already see some errors:
function deleteme(){
if ($set1 = 1){
unlink("/home/dhill/simplebit-www/dillenger/gallery/$thumbdir/$imageArray[$x]");
}else{
}
You're missing one closing curly bracket. You've got one for the "else" but you're missing one for the function.
Also, where do the variables $set1, $thumbdir, $imageArray, and $x come from? You have to either pass them to the function, or declare them as globals (which I wouldn't recommend).
Diego