<?php
require_once('/ed/sitebase.inc');
require_once('/ed/entry.inc');
require_once('/ed/signup.inc');
tophdr(0);
unset($_SESSION['HomeTopicno']);
$edid='ed_comments';
$cnum='c1';
edset();
?>
<title>The Schooner Sara B Comment Page</title></head>
<body>
<table width=100% cellspacing=0><tr>
<td bgcolor="#AAAAAA" align=center>
<a href="/index.htm">Home</a>
</td><td width=80% bgcolor="#BBBBBB"><center>
<font size=5>The Schooner <i>Sara B</i> Comment Page</font>
</center></td></tr></table>
<br>
<table><tr><td width=70%>
All comments welcome.  Civil and in good taste preferred.
<br><br>
To contribute you need to be registered - use the form at right.
<br><br>
Send email with your comment to:<br><center><img src="com_addr.jpg"></center>
<br>
Attached pictures (.jpg, .gif, or .png format) will be included.
</td><td>
<?php signup('Y');
?>
</td></tr></table>
<br><br>

<div class=pagebox>
<?php
$top_res=mysqli_query($msql,
        "SELECT topicno, entryno FROM ${edid}_topic ORDER BY topicno DESC");
if (!$top_res) {echo '<br>Malfunction<br>'; exit(); }
echo "<table width=100% cellpadding=2 cellspacing=0>\n";
$bg=array('#DDDDDD','#EEEEEE');
$bgn=0;

while ($topic=mysqli_fetch_assoc($top_res))
    {echo '<tr bgcolor="'.$bg[$bgn].'">';
    echo "<td align=right>"
        .'<a name="'.$topic['topicno'].'"></a> '
        .'<a href="entry.php?'.$edcfg['idq']
        .'&topicno='.$topic['topicno'].'">';
    printf('(%d)',$topic['topicno']);
    echo '</a>&nbsp;&nbsp;</td>';
    $entry=getrec('entry', 'entryno', $topic['entryno']);
    index_disent($entry);
    echo "</tr>\n";
    while ($entry['next'])
        {echo '<tr bgcolor="'.$bg[$bgn].'"><td></td>';
        $entry=getrec('entry', 'entryno', $entry['next']);
        index_disent($entry);
        echo "</tr>\n"; }
    $bgn=1-$bgn;
    }

mysqli_free_result($top_res);
?></table>
</div>

<?php
function index_disent($entry)
    {global $msql, $edid, $urec, $edcfg, $cnum;
    if (!$entry)
        {echo '*malfunction*</td><td></td><td></td>'; }
    else {
        echo '<td>'
            .'<a href="/ed/entry.php?'.$edcfg['idq']
            .'&entryno='.$entry['entryno'].'">'
            .(strlen($entry['subject'])==0?'(no title)':$entry['subject'])
            .'</a></td>';
        $dname=getfield('user', 'name', 'email', $entry['email']);
        echo "<td nowrap>${dname} &nbsp;</td>";
        echo "<td><nobr>${entry['edate']}</nobr></td>";
        }
    }
?>

</body></html>
