Specifications

</TR>
</TABLE>
<INPUT TYPE=SUBMIT VALUE=”Log in”>
</FORM>
<?
}
else {
$conn = db_connect();
$w = get_writer_record($auth_user);
echo “Welcome, “.$w[full_name];
echo “ (<A HREF=\”logout.php\”>Logout</A>)”;
echo “<p>”;
$sql = “select * from stories where writer = ‘$auth_user’ “.
“order by created desc”;
$result = mysql_query($sql, $conn);
echo “Your stories: “;
echo mysql_num_rows($result);
echo “ (<A HREF=\”story.php\”>Add new</A>)”;
echo “<br><br>”;
if (mysql_num_rows($result)) {
echo “<TABLE>”;
echo “<TR><TH>Headline</TH><TH>Page</TH>”;
echo “<TH>Created</TH><TH>Last modified</TH></TR>”;
while ($qry = mysql_fetch_array($result)) {
echo “<TR>”;
echo “<TD>”;
echo $qry[headline];
echo “</TD>”;
echo “<TD>”;
echo $qry[page];
echo “</TD>”;
echo “<TD>”;
echo date(“M d, H:i”, $qry[created]);
echo “</TD>”;
echo “<TD>”;
echo date(“M d, H:i”, $qry[modified]);
echo “</TD>”;
echo “<TD>”;
if ($qry[published])
echo “[Published “.date(“M d, H:i”, $qry[published]).”]”;
else {
Building Practical PHP and MySQL Projects
P
ART V
604
LISTING 26.5 Continued
32 7842 ch26 3/6/01 3:36 PM Page 604