<html><head><title>Adding image to queue</title></head>
<body><?php
if (trim($_POST['caption']) == '') {
        echo '<h1 style="color: #ff0000">Missing Caption</h1>';
        echo '<p>Hit the Back button and try again.</p>';
} else {
        echo "INSERT INTO bw VALUES('" . $_POST[d] . "','" . $_POST['p'] .
         "','" . $_POST['caption'] . "','false','" .
         ($_POST['rotate'] == '' ? 'fals' : 'tru') . "e');";
        $ph = pg_connect ('dbname=bw host=localhost port=5432 user=$$USER$$ password=$$DBPW$$');
        $pq = pg_query ("INSERT INTO bw VALUES('" . $_POST[d] . "','" .
         $_POST['p'] . "','" . $_POST['caption'] . "','false');");
        pg_close ($ph);
        echo '<p>Image added. <a href="javascript:window.close();">Close me</a>.</p>';
}
?></body></html>