Location: PHPKode > projects > Radio404 > radio404/htdocs/find.php
<?php
/********************************************************************
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
********************************************************************/

/**
 * Purpose: search and find for tracks in the database, for purposes of voting/making favorite
 */

include("../sql.inc");
include("sessions.php");
include("functions.php");

if(isset($_GET['search']))
{
	$sql = "SELECT id, node, track FROM tracks WHERE MATCH (track) AGAINST ( '" .  safe_sql($_POST['searchfor']) . "' IN BOOLEAN MODE)";
	$result = sql_query($sql);

	if(count($result) > 0)
	{
		for($i = 0; $i <= count($result); $i++)
		{
			$trackinfo = get_track_info($result[$i]->track);

			echo $i . ") <a href='vote.php?tid=" . $result[$i]->id . "'>Vote</a> / <a href='addfavorite.php?tid=" . $result[$i]->id . "'>Add Favorite</a> &nbsp;&nbsp;&nbsp;" . 
$trackinfo['artist'] . " - " . $trackinfo['album'] . " - " . $trackinfo['song'] . "<br />";
		}
	}
	else
	{
		echo "No tracks found!";
	}
}
else
{
	echo "<form action='find.php?search=yes' method='post'>Search For: <input type='text' name='searchfor' /><br /><input type='submit' value='Find track!' /></form>";
}
?>
Return current item: Radio404