<?php
# Copyright 2004 Todd Palino
#
# This file is part of phpMyRecipes.
#
# phpMyRecipes is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# phpMyRecipes is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# phpMyRecipes; if not, write to the Free Software Foundation, Inc., 59 Temple
# Place, Suite 330, Boston, MA 02111-1307 USA
require("include.php");
if (($dbconn = mysql_pconnect(DB_HOST, DB_USER, DB_PASS)) <= 0) {
dberror("index.php", "Cannot connect to database");
}
if (! mysql_select_db(DB_DB, $dbconn)) {
dberror("index.php", "Cannot select database");
}
$session = getsession();
c_header("Home", "home");
?>
<FORM ACTION="dosearch.php" METHOD="POST">
<?php insSessionField(); ?>
<P ALIGN=CENTER>
<TABLE BORDER=0 WIDTH=80%>
<TR>
<TD VALIGN=MIDDLE>Search:</TD>
<TD VALIGN=MIDDLE><INPUT TYPE=TEXT NAME=words_preformat SIZE=40 MAXLENGTH=160></TD>
<TD VALIGN=MIDDLE><INPUT TYPE=submit VALUE="Search"></TD>
</TR>
</TABLE></P></FORM>
<?php
# Last 5 New Recipes
if ($results = mysql_query("SELECT id,name FROM recipes ORDER BY added DESC LIMIT 5")) {
?>
<P><HR></P>
<P CLASS="content"><B>Last 5 New Recipes:</B><BR>
<CENTER><TABLE WIDTH=80% BORDER=3>
<TR>
<TH>Recipe Name (click to view)</TH>
<TH COLSPAN=2>Action</TH>
</TR>
<?php
while ($row = mysql_fetch_array($results)) {
?>
<TR>
<TD ALIGN=LEFT VALIGN=MIDDLE><A HREF="<?php print slink("recipes/viewrecipe.php?r_id=" . $row[0]); ?>"><?php print $row[1]; ?></A></TD>
<?php
insEditRecipeField($row[0]);
insDelRecipeField($row[0]);
print "</TR>\n";
}
?>
</TABLE></CENTER></P>
<?php
}
# Last 5 Updated Recipes
if ($results = mysql_query("SELECT id,name FROM recipes ORDER BY modified DESC LIMIT 5")) {
?>
<P><HR></P>
<P CLASS="content"><B>Last 5 Updated Recipes:</B><BR>
<CENTER><TABLE WIDTH=80% BORDER=3>
<TR>
<TH>Recipe Name (click to view)</TH>
<TH COLSPAN=2>Action</TH>
</TR>
<?php
while ($row = mysql_fetch_array($results)) {
?>
<TR>
<TD ALIGN=LEFT VALIGN=MIDDLE><A HREF="<?php print slink("recipes/viewrecipe.php?r_id=" . $row[0]); ?>"><?php print $row[1]; ?></A></TD>
<?php
insEditRecipeField($row[0]);
insDelRecipeField($row[0]);
print "</TR>\n";
}
?>
</TABLE></CENTER></P>
<?php
}
c_footer();
?>