mirror of
https://git.code.sf.net/p/quake/website
synced 2025-02-22 11:41:41 +00:00
updates to fix searching
This commit is contained in:
parent
8353c23892
commit
e6559de260
4 changed files with 77 additions and 74 deletions
|
@ -25,40 +25,4 @@
|
||||||
$today['year']--;
|
$today['year']--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function searchNews ($string)
|
|
||||||
{
|
|
||||||
need ('date sql');
|
|
||||||
|
|
||||||
$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';
|
|
||||||
$result = @mysql_db_query (sqlDB, $query, $conn);
|
|
||||||
echo $query;
|
|
||||||
if ($result) {
|
|
||||||
$numRows = @mysql_num_rows ($result);
|
|
||||||
if ($numRows) {
|
|
||||||
echo '<TABLE width="100%" cellSpacing="0" cellPadding="0" border="0">'.
|
|
||||||
' <TR vAlign="top"> <TD colSpan="2">';
|
|
||||||
tableBoxHeader( 'black', tableHeadColor );
|
|
||||||
tableTitle( "Search Results", 1, tableHeadColor );
|
|
||||||
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));
|
|
||||||
}
|
|
||||||
tableBoxFooter();
|
|
||||||
echo '</TD></TR></TABLE>';
|
|
||||||
} 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.';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
|
|
32
news_search.php
Normal file
32
news_search.php
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
need ('date sql');
|
||||||
|
|
||||||
|
$searchString = "\'%$string%\'";
|
||||||
|
$conn = @mysql_pconnect (sqlHost, sqlUser, sqlPass);
|
||||||
|
if ($conn) {
|
||||||
|
$query = 'SELECT n_date, n_user, n_news FROM news_main WHERE '.
|
||||||
|
'n_news LIKE ' . $searchString . ' ORDER BY n_date DESC';
|
||||||
|
$result = @mysql_db_query (sqlDB, $query, $conn);
|
||||||
|
echo $query;
|
||||||
|
if ($result) {
|
||||||
|
$numRows = @mysql_num_rows ($result);
|
||||||
|
if ($numRows) {
|
||||||
|
echo '<TABLE width="100%" cellSpacing="0" cellPadding="0" border="0">'.
|
||||||
|
' <TR vAlign="top"> <TD colSpan="2">';
|
||||||
|
tableBoxHeader( 'black', tableHeadColor );
|
||||||
|
tableTitle( "Search Results", 1, tableHeadColor );
|
||||||
|
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));
|
||||||
|
}
|
||||||
|
tableBoxFooter();
|
||||||
|
echo '</TD></TR></TABLE>';
|
||||||
|
} 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.';
|
||||||
|
}
|
|
@ -72,9 +72,9 @@
|
||||||
echo '<CENTER><FONT size="-2">' .
|
echo '<CENTER><FONT size="-2">' .
|
||||||
'<FORM action="search.php" method="POST">' .
|
'<FORM action="search.php" method="POST">' .
|
||||||
' <SELECT name="type_of_search">' .
|
' <SELECT name="type_of_search">' .
|
||||||
|
' <OPTION value="news">News</OPTION>' .
|
||||||
' <OPTION value="bugs">Bug Tracking</OPTION>' .
|
' <OPTION value="bugs">Bug Tracking</OPTION>' .
|
||||||
' <OPTION value="lists">Mailing Lists</OPTION>' .
|
' <OPTION value="lists">Mailing Lists</OPTION>' .
|
||||||
' <OPTION value="news">News</OPTION>' .
|
|
||||||
' <OPTION value="patches">Patches</OPTION>' .
|
' <OPTION value="patches">Patches</OPTION>' .
|
||||||
' </SELECT>' .
|
' </SELECT>' .
|
||||||
' <BR>' .
|
' <BR>' .
|
||||||
|
|
|
@ -3,7 +3,14 @@
|
||||||
$focused = "none"; // Dock icon name to gets a border
|
$focused = "none"; // Dock icon name to gets a border
|
||||||
require("parts/preamble.php"); // Load most of document
|
require("parts/preamble.php"); // Load most of document
|
||||||
?>
|
?>
|
||||||
This page is still under construction. Please check back later.
|
<?php
|
||||||
|
if ($type_of_search == "news") {
|
||||||
|
$string = $search;
|
||||||
|
include("news_search.php");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
echo '<P>That type of search isn't supported yet. Please check back later.';
|
||||||
|
?>
|
||||||
<?
|
<?
|
||||||
require("parts/postamble.php"); // Finish this sucker up
|
require("parts/postamble.php"); // Finish this sucker up
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in a new issue