mirror of
https://git.code.sf.net/p/quake/website
synced 2024-11-10 23:32:38 +00:00
42 lines
1.5 KiB
PHP
42 lines
1.5 KiB
PHP
<?
|
|
if (((!is_int($yr)) || $yr < 2000)) $yr = date('Y',time());
|
|
if ($mon < 1 || $mon > 12) $mon = date('m',time());
|
|
$pageName = 'News: '. date("F, Y", mktime(0,0,0,$mon+1,0,$yr,0));
|
|
$focused = "none";
|
|
require("parts/preamble.php"); // Load most of document
|
|
|
|
need ('date sql');
|
|
require ("news_funcs.php");
|
|
echo '<TABLE width="100%" cellSpacing="0" cellPadding="0" border="0"> <TR vAlign="top"> <TD colSpan="2">';
|
|
tableBoxHeader( 'black', tableHeadColor );
|
|
tableTitle( $pageName, 1, tableHeadColor );
|
|
|
|
$mydate = $yr . '-' . $mon;
|
|
$conn = mysql_pconnect (sqlHost, sqlUser, sqlPass);
|
|
if ($conn) {
|
|
$query = 'SELECT n_date, n_user, n_news FROM news_main WHERE '.
|
|
'n_date BETWEEN \'' . $mydate . '-00 00:00:00\' AND '.
|
|
'\'' . $mydate . '-31 23:59:59\'' .
|
|
' ORDER BY n_date DESC';
|
|
$result = mysql_db_query (sqlDB, $query, $conn);
|
|
if ($result) {
|
|
$numRows = mysql_num_rows ($result);
|
|
if ($numRows) {
|
|
for ($i = 0 ; $i < $numRows ; $i++) {
|
|
list ($n_date, $n_user, $n_news) = mysql_fetch_row ($result);
|
|
newsItem (dateFromSQLDateTime ($n_date), $n_user, StripSlashes($n_news));
|
|
}
|
|
} else {
|
|
newsItem ('now', 'Web Server', '<P>No news for this month!');
|
|
}
|
|
} else {
|
|
newsItem ('now', 'Web Server', '<P>No news in database!');
|
|
}
|
|
mysql_close ($conn);
|
|
} else {
|
|
newsItem ('Now', 'Web Server', '<P>Error: Could not connect to SQL server to fetch news. Please notify the server administrator.');
|
|
}
|
|
tableBoxFooter();
|
|
echo '</TD></TR></TABLE>';
|
|
require("parts/postamble.php");
|
|
?>
|