Index: trunk/DNSDB.pm
===================================================================
--- trunk/DNSDB.pm	(revision 4)
+++ trunk/DNSDB.pm	(revision 5)
@@ -209,5 +209,5 @@
 sub delDomain {
   my $dbh = shift;
-  my $domain = shift;
+  my $domid = shift;
 
   # Allow transactions, and raise an exception on errors so we can catch it later.
@@ -218,14 +218,8 @@
   # Wrap all the SQL in a transaction
   eval {
-    # brute force.
-    my $sth = $dbh->prepare("select domain_id from domains where domain=?");
-    $sth->execute($domain);
-    die "Domain not found, can't delete\n" if $sth->rows < 1;
-    my ($id) = $sth->fetchrow_array;
-
-    $sth = $dbh->prepare("delete from records where domain_id=$id");
-    $sth->execute;
-    $sth = $dbh->prepare("delete from domains where domain=?");
-    $sth->execute($domain);
+    my $sth = $dbh->prepare("delete from records where domain_id=?");
+    $sth->execute($domid);
+    $sth = $dbh->prepare("delete from domains where domain_id=?");
+    $sth->execute($domid);
 
     # once we get here, we should have suceeded.
Index: trunk/dns.cgi
===================================================================
--- trunk/dns.cgi	(revision 4)
+++ trunk/dns.cgi	(revision 5)
@@ -300,4 +300,25 @@
   }
 
+} elsif ($webvar{page} eq 'deldom') {
+
+  $page->param(id => $webvar{id});
+  # first pass = confirm y/n (sorta)
+  if (!defined($webvar{del})) {
+    $page->param(del_getconf => 1);
+    $page->param(domain => domainName($dbh,$webvar{id}));
+# print some neato things?
+  } elsif ($webvar{del} eq 'ok') {
+    my ($code,$msg) = delDomain($dbh, $webvar{id});
+    if ($code ne 'OK') {
+# need to find failure mode
+      $page->param(del_failed => 1);
+      $page->param(errmsg => $msg);
+    }
+  } else {
+    # cancelled.  whee!
+    $page->param(del_failed => 0);
+# more params?
+  }
+
 } elsif ($webvar{page} eq 'editsoa') {
 
