Skip to Content, Navigation, or Footer.
The Daily Cardinal Est. 1892
Saturday, September 27, 2025

Search

All Words Exact Phrase
Search Options
Section: Sort By:

 

 

{kl_php} 

 

//require_once(""sql.inc.php""); 

 

 

 

if(array_key_exists('search', $_POST)){ 

 

Enjoy what you're reading? Get content from The Daily Cardinal delivered to your inbox

 

 

$conn = mysql_connect(""localhost"", ""cardinal"", ""cardinal""); 

 

 

 

if (!$conn) { 

 

echo ""Unable to connect to DB: "" . mysql_error(); 

 

exit; 

 

 

 

 

if (!mysql_select_db(""cardinal"")) { 

 

echo ""Unable to select cardinal: "" . mysql_error(); 

 

exit; 

 

 

 

 

$sql=""SELECT id, title, catid, sectionid, created_by_alias, introtext, UNIX_TIMESTAMP(created) as created FROM mos_content WHERE MATCH(title, introtext, `fulltext`, metakey, metadesc) AGAINST(""; 

 

if($_POST['type']==""exact""){ 

 

$sql .= '\\'""'.quote_smart($_POST['search']).'""\\' in boolean mode)'; 

 

 

if($_POST['type']==""all""){ 

 

$sql .= ""'"".quote_smart($_POST['search']).""' )""; 

 

 

if($_POST['section']!=""){ 

 

switch ($_POST['section']){ 

 

case ""news"": 

 

$sql .= "" AND sectionid='5'""; 

 

break; 

 

case ""sports"": 

 

$sql .= "" AND sectionid='6'""; 

 

break; 

 

case ""opinion"": 

 

$sql .= "" AND sectionid='7'""; 

 

break; 

 

case ""arts"": 

 

$sql .= "" AND sectionid='8'""; 

 

break; 

 

case ""almanac"": 

 

$sql .= "" AND sectionid='24'""; 

 

break; 

 

case ""commerce"": 

 

$sql .= "" AND sectionid='10'""; 

 

break; 

 

case ""features"": 

 

$sql .= "" AND sectionid='11'""; 

 

break; 

 

case ""food"": 

 

$sql .= "" AND sectionid='12'""; 

 

break; 

 

case ""science"": 

 

$sql .= "" AND sectionid='13'""; 

 

break; 

 

case ""photo"": 

 

$sql .= "" AND sectionid='14'""; 

 

break; 

 

case ""infocus"": 

 

$sql .= "" AND sectionid='15'""; 

 

break; 

 

case ""gameday"": 

 

$sql .= "" AND sectionid='16'""; 

 

break; 

 

case ""powerplay"": 

 

$sql .= "" AND sectionid='17'""; 

 

break; 

 

case ""courtside"": 

 

$sql .= "" AND sectionid='18'""; 

 

break; 

 

default: 

 

break; 

 

 

 

if($_POST[sortby]==""date""){ 

 

$sql .= "" ORDER BY created DESC""; 

 

 

if($_POST[sortby]==""relevance""){ 

 

 

 

 

else{} 

 

 

 

$result = mysql_query($sql); 

 

 

 

if (!$result) { 

 

echo ""Could not successfully run query ($sql) from DB: "" . mysql_error(); 

 

exit; 

 

 

 

 

/*if (mysql_num_rows($result) == 0) { 

 

echo ""No Results Found""; 

 

}*/ 

 

 

 

//echo sql($sql); 

 

formatResult($result, $_POST['search']); 

 

 

 

 

 

 

 

 

function formatResult($result, $search){ 

 

echo '; 

 

echo """"; 

 

 

 

while( $row = mysql_fetch_assoc($result) ){ 

 

echo formatRow($row); 

 

 

 

 

echo """"; 

 

 

 

 

function formatRow($row){ 

 

switch ($row['sectionid']){ 

 

case 5: 

 

$sectionTitle = ""News""; 

 

break; 

 

case 6: 

 

$sectionTitle = ""Sports""; 

 

break; 

 

case 7: 

 

$sectionTitle = ""Opinion""; 

 

break; 

 

case 8: 

 

$sectionTitle = ""Arts""; 

 

break; 

 

case 24: 

 

$sectionTitle = ""Almanac""; 

 

break; 

 

case 10: 

 

$sectionTitle = ""Commerce""; 

 

break; 

 

case 11: 

 

$sectionTitle = ""Features""; 

 

break; 

 

case 12: 

 

$sectionTitle = ""Food""; 

 

break; 

 

case 13: 

 

$sectionTitle = ""Science""; 

 

break; 

 

case 14: 

 

$sectionTitle = ""Photo""; 

 

break; 

 

case 15: 

 

$sectionTitle = ""InFocus""; 

 

break; 

 

case 21: 

 

$sectionTitle = ""Comics""; 

 

break; 

 

case 16: 

 

$sectionTitle = ""GameDay""; 

 

break; 

 

case 17: 

 

$sectionTitle = ""PowerPlay""; 

 

break; 

 

case 18: 

 

$sectionTitle = ""CourtSide""; 

 

break; 

 

default: 

 

$sectionTitle = ""Unknown""; 

 

 

 

 

$link = createURL($row); 

 

$published = date('F d, Y', $row['created']); 

 

 

 

echo """"; 

 

echo ''; 

 

echo ''; 

 

echo ''; 

 

echo ''; 

 

echo ''; 

 

 

 

 

function createURL($row){ 

 

$title = titleToLocation($row[""title""]); 

 

$sql = ""SELECT name FROM mos_categories WHERE `id`="".$row[""catid""]."" LIMIT 1""; 

 

$catResult = mysql_query($sql); 

 

 

 

if (!$catResult) { 

 

echo ""Could not successfully run query ($sql) from DB: "" . mysql_error(); 

 

exit; 

 

 

 

 

$id = mysql_fetch_assoc($catResult); 

 

$category = titleToLocation($id[""name""]); 

 

$newurl = ""http://www.dailycardinal.com/"".$category.""/"".$title."".html""; 

 

return $newurl; 

 

 

 

 

function quote_smart($value) 

 

 

// Stripslashes 

 

if (get_magic_quotes_gpc()) { 

 

$value = stripslashes($value); 

 

 

// Quote if not a number or a numeric string 

 

if (!is_numeric($value)) { 

 

$value = "" . mysql_real_escape_string($value) . ""; 

 

 

return $value; 

 

 

{/kl_php}

'.$row['title'].'
By: '.$row['created_by_alias'].'
'.$row['introtext'].'
Support your local paper
Donate Today
The Daily Cardinal has been covering the University and Madison community since 1892. Please consider giving today.

Powered by SNworks Solutions by The State News
All Content © 2025 The Daily Cardinal