<%init>
use AwayMsg;
+use Data::Dumper;
db_connect();
www_begin($r,$m);
</%init><%args>
}
if ($textid eq 'new') {
- my $textid = time;
+ $textid = time;
my $ntextq = $dbh->prepare("SELECT textid FROM texts".
" ORDER BY textid DESC LIMIT 1");
$ntextq->execute();
}
}
+print STDERR Dumper([$textid, $desc, $subject, $text]);
+
my $dinsertq = $dbh->prepare("INSERT INTO texts (textid, desc, subject, text)".
" VALUES (?,?,?,?)");
$dinsertq->execute($textid, $desc, $subject, $text);
+my $tdeleteq = $dbh->prepare("DELETE FROM addresses WHERE textid = ?");
+$tdeleteq->execute($textid);
+
+my $odeleteq = $dbh->prepare("DELETE FROM addresses WHERE emailaddr = ?");
+
+my $tinsertq = $dbh->prepare("INSERT INTO addresses (emailaddr, textid)".
+ " VALUES (?,?)");
+my $tlistq = $dbh->prepare("SELECT * FROM config");
+$tlistq->execute();
+while (my $row = $tlistq->fetchrow_hashref()) {
+ if ($ARGS{"u_".hquote($row->{'emailaddr'})}) {
+ $odeleteq->execute($row->{'emailaddr'});
+ $tinsertq->execute($row->{'emailaddr'}, $textid);
+ }
+}
+
db_commit();
</%perl><& htmlhead, subpage => "Saved \"$desc\"" &>