/*
* gCards - a web-based eCard application
* Copyright (C) 2003 Greg Neustaetter
*
* This program 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.
*
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
session_start();
if (isset($HTTP_SESSION_VARS['to_name'])) $HTTP_SESSION_VARS['to_name'] = NULL;
if (isset($HTTP_SESSION_VARS['to_email'])) $HTTP_SESSION_VARS['to_email'] = NULL;
if (isset($HTTP_SESSION_VARS['cardtext'])) $HTTP_SESSION_VARS['cardtext'] = NULL;
if (isset($HTTP_GET_VARS['reply'])) $HTTP_SESSION_VARS['to_email'] = $HTTP_GET_VARS['reply'];
include_once('inc/adodb300/adodb.inc.php'); # load code common to ADOdb
include_once('config.php');
include_once('inc/UIfunctions.php');
include_once("inc/".$languageFile);
showHeader($siteName);
$row = (int)$HTTP_GET_VARS['row'];
$catSearch = (int)$HTTP_GET_VARS['catSearch'];
if (!$row) $row = 0; // start on first row if a row is not selected
$limit = ($rowsPerPage * $cardsPerRow); // set the number of cards per page
$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
$conn = &ADONewConnection('mysql'); # create a connection
$conn->Connect($dbhost,$dbuser,$dbpass,$dbdatabase);
// Get the total number of cards, or the number of cards in a category if a category is selected
$rowsInTableSQL = "SELECT COUNT(*) from ".$tablePrefix."cardinfo";
if ($catSearch) $numrows = $conn->GetOne("$rowsInTableSQL where catid = '$catSearch'");
else $numrows = $conn->GetOne($rowsInTableSQL);
// calculate the number of pages needed to show the cards
if (($numrows % $limit) == 0)
$pages = ($numrows/$limit);
else
$pages = intval($numrows/$limit) + 1;
$current = ($row/$limit) + 1; // Current Page
if ($orderPop == 'yes')
{
$orderArg = "senttimes DESC,";
}
else $orderArg = " ";
$sqlstmt = 'select * from '.$tablePrefix.'cardinfo';
if ($catSearch) $recordSet = &$conn->SelectLimit("$sqlstmt where catid = '$catSearch' order by $orderArg imageid $order",$limit,$row );
else $recordSet = &$conn->SelectLimit("$sqlstmt order by $orderArg imageid $order",$limit,$row);
if (!$recordSet) print $conn->ErrorMsg();
?>
|
include('inc/getcategories.php'); // show the eCard Categories ?>
|
|
if ($selectedCategory) echo $selectedCategory;
else echo $index01;
?>
|
echo $index02;?>
|
if ($recordSet)
{
$numCards = $recordSet->RecordCount();
$cardCount = 0;
echo "\n\t";
while (!$recordSet->EOF)
{
$imageid = $recordSet->fields[imageid];
$cardname = $recordSet->fields[cardname];
$thumbpath = rawurlencode($recordSet->fields[thumbpath]);
if ((($cardCount % $cardsPerRow) == 0) && (!($cardCount == 0))) echo "\n\t \n\t";
echo "\n\t\t\n\t\t\t \n\t\t\t$cardname\n\t\t | ";
$recordSet->MoveNext();
$cardCount++;
}
$emptyCells = ($cardsPerRow - ($numCards % $cardsPerRow));
for ($i=0; $i < $emptyCells; $i++) echo "\n\t\t | ";
echo "\n\t \n ";
}
$recordSet->Close(); # optional
echo "| |
| ";
if (!($pages == 1))
{
echo "| | ";
if ($row != 0) { // if not the first page create back link with record set 1 page back (record - limit)
$backPage = $row - $limit;
echo "$nav01 \n";}
for ($i=1; $i <= $pages; $i++) {
$ppage = $limit*($i - 1); // ppage is record at a certain page
if ($ppage == $row){
echo "$i \n";} // if current page just show page number
else {
echo "$i \n";}} // else show link to page number
if ($current < $pages) { // Give next link if not last page
$nextPage = $row + $limit;
echo("$nav02");}
echo " | ";
}
echo " ";
if (($enableNews == 'yes') && ($newsLocation == 'bottom'))
{
echo "
| ";
include('inc/newssummary.php');
echo " | ";
}
echo " | ";
if (($enableNews == 'yes') && ($newsLocation == 'right'))
{
echo "";
include('inc/newssummary.php');
echo " | ";
}
echo "
";
$currentTime = time();
$timeToSeconds = ($deleteDays * 24 * 60 * 60);
$deletePriorTime = $currentTime - $timeToSeconds;
$deleteCardsSQL = "DELETE FROM ".$tablePrefix."sentcards WHERE cardid < $deletePriorTime";
$conn->Execute($deleteCardsSQL);
$conn->Close();
showFooter();
?>