Hi:
I turn off register_globals for security reason, and right now i have to insert import_request_variables("gPc", "rvar_"); to all my forms because they are not processing, all my forms are working fine after i insert import request variables, but i have problem to put this in my search engine. can anybody help because i am not good with search engine $string
<?php
// like i said, we must never forget to start the session
session_start();
// is the one accessing this page logged in or not?
if (!isset($_SESSION['db_is_logged_in'])
|| $_SESSION['db_is_logged_in'] !== true) {
// not logged in, move to login page
header('Location: login.php');
exit;
}
include ('connect.php');
$keywords = explode(" ", $search);
$query = "SELECT * FROM artist LEFT OUTER JOIN lyric on (artist.artist_id = lyric.artist_id) WHERE artist_name LIKE '%".$keywords['0']."%' OR song_title LIKE '%".$keywords['0']."%' OR english_name LIKE '%".$keywords['0']."%' OR lyric LIKE '%".$keywords['0']."%' ";
for ($i=1; $i<count($keywords); $i++) {
$query = $query." AND artist_name LIKE '%".$keywords[$i]."%' OR english_name LIKE '%".$keywords[$i]."%' OR song_title LIKE '%".$keywords[$i]."%'";
}
$query = $query." ORDER by english_name ASC";
$result = mysql_query($query) or die(mysql_error());
?>
<html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<form method="GET" action="<? $PHP_SELF ?>">
<b>Search:</b> <input type="text" name="search" size="20" />
<input type="submit" value="Search!">
</form>
<?php
while($row = mysql_fetch_array($result))
{
$artist_id = $row[artist_id];
$artist_name = $row[artist_name];
$english_name = $row[english_name];
$song_title = $row[song_title];
$lyric_id = $row[lyric_id];
$lyric = $row[lyric];
echo "<a href=\"show.php?artist_id=$artist_id\"><b>$artist_name $english_name</b></a>(<a href=\"artist-update.php?artist_id={$row['artist_id']}\">Edit Artist</a> - <a href=\"artist-delete.php?artist_id={$row['artist_id']}\">Delete Artist</a>)(<a href=\"lyric-add1.php?artist_id={$row['artist_id']}\">Add lyric</a>) - <a href=\"lyric.php?lyric_id=$lyric_id\">$song_title</a> (<a href=\"lyric-update.php?lyric_id={$row['lyric_id']}\">Edit Lyric</a> - <a href=\"lyric-delete.php?lyric_id={$row['lyric_id']}\">Delete Lyric</a>)<br>";
}
?>
</html>