mirror of
https://git.code.sf.net/p/quake/website
synced 2024-11-24 13:11:46 +00:00
62 lines
2.2 KiB
PHP
62 lines
2.2 KiB
PHP
<?
|
|
function newsItem( $date, $user, $text )
|
|
{
|
|
if ($user == "Theoddone33") $user = "theoddone33";
|
|
echo '<TR><TD><DL><DT><FONT SIZE=-1>Posted on ' . $date . ' by ' . $user . '</FONT></DT>' .
|
|
' <DD><P>' . $text . '</DD>' .
|
|
'</DL></TD></TR>';
|
|
}
|
|
|
|
function listMonths ( )
|
|
{
|
|
$startyear = 2000;
|
|
$today = getdate ();
|
|
while ($startyear <= $today['year'])
|
|
{
|
|
for ($month = $today['mon']+1 ; $month > 1 ; $month--)
|
|
{
|
|
echo '<P><A HREF="old_news.php?mon=' .
|
|
date ("m", mktime (0,0,0,$month,0,0,0)) .
|
|
'&yr=' .
|
|
date ("Y", mktime (0,0,0,0,0,$today['year']+1,0)). '">' .
|
|
date ("F, Y", mktime (0,0,0,$month,0,$today['year'],0)) .
|
|
'</A>';
|
|
}
|
|
$today['year']--;
|
|
}
|
|
}
|
|
function searchNews ($string)
|
|
{
|
|
need ('date sql');
|
|
echo '<TABLE width="100%" cellSpacing="0" cellPadding="0" border="0"> <TR vAlign="top"> <TD colSpan="2">';
|
|
tableBoxHeader( 'black', tableHeadColor );
|
|
tableTitle( "Search Results", 1, tableHeadColor );
|
|
|
|
$search = "\'%$string\%'";
|
|
$conn = @mysql_pconnect (sqlHost, sqlUser, sqlPass);
|
|
if ($conn) {
|
|
$query = 'SELECT n_date, n_user, n_news FROM news_main WHERE '.
|
|
'n_news LIKE ' . $search . ' ORDER BY n_date DESC';
|
|
print ($query);
|
|
$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 {
|
|
echo '<P>No news found matching "' . $string . '"\n';
|
|
}
|
|
} else {
|
|
echo '<P>No news found matching "' . $string . '"\n';
|
|
}
|
|
mysql_close ($conn);
|
|
} else {
|
|
echo '<P>SQL error, please contact the webmaster.';
|
|
}
|
|
tableBoxFooter();
|
|
echo '</TD></TR></TABLE>';
|
|
}
|
|
?>
|