#!/usr/bin/perl -wT ############################################################ ## Written and copyright 2002 by ## Jacqueline D. Hamilton (kira@cgi101.com) ## ## This code is excerpted from "CGI Programming 201" ## (http://www.cgi101.com/advanced) ## ## You may use this code on your own website, however ## you may not publish or sell any copy or derivative work ## without permission of the author. ############################################################# use strict; use lib '../'; use MyBoard; &do_header("Delete Forum"); my($forum); if ($cgi->param('forum') !~ /^(\d+)$/) { &dienice($cgi->param('forum') . " isn't a valid forum number."); } else { $forum = $1; } my($sth) = $dbh->prepare("select * from forums where id=?") or &dbdie; my($rv) = $sth->execute($forum) or &dbdie; if ($rv < 1) { &dienice("Forum $forum doesn't exist."); } my($f); $f = $sth->fetchrow_hashref; $dbh->do("delete from forums where id=$forum") or &dbdie; $dbh->do("delete from messages where forum=$forum") or &dbdie; print <Deleted

Forum \#$forum - $f->{name} deleted.

Return to Administration

EndHTML &do_footer;