\n"; $recstable .= "\n"; $recstable .= "".$series['title']." by "; if ($series['authorurl']) { $recstable .= "".$series['author'].""; } else { $recstable .= $series['author']; } $recstable .= "\n"; $recstable .= "Series:\n"; $recstable .= ""; $series_list = explode (", ", $series['series']); while (list($key, $val) = each($series_list)) { $series_search = str_replace(" ", "+", $val); $serieslinks .= "".$val.", "; } $serieslinks = rtrim($serieslinks, ", "); $recstable .= $serieslinks."\n\n"; unset ($serieslinks); $recstable .= "Pairing:\n ".$series['pairing']."\n"; $recstable .= "Submitted by:\n ". $series['userid']."\n"; $recstable .= "Rec ID:\n ". $series['id'].""; $comments = nl2br($series['comments']); $recstable .= "".$comments."\n"; $recstable .= "\n"; $recstable .= "\n"; $last = $series['id']; } return $recstable; } // Fin de función // Inicio contenido // Mostrar Serie if ($_GET['serie']) { include("includes/header.php"); if ($_GET['order']) { $orderby = $_GET['order']; } else { $orderby = "title"; } $serie = $_GET['serie']; $serie = str_replace("%2B", " ", $serie); $serie = str_replace("+", " ", $serie); $query = "SELECT * FROM slashrecs WHERE series like '%$serie%' ORDER by '$orderby'"; $result = mysql_query($query) or die(mysql_errno() . ": " . mysql_error() . "\n"); $serie_titulo = ucwords($serie); // Si no hay resultados if (!$rows = mysql_num_rows($result)) { echo "

Sorry, no recommendations found for "; echo "".$serie_titulo."

\n"; // Si hay resultados } else { $grantotal = mysql_num_rows($result); echo "

".$grantotal." recommendations for "; echo "".$serie_titulo."

\n"; $order_array = array("title","pairing","author"); echo "

Order: "; while (list($key, $val) = each($order_array)) { $val2 = ucwords($val); if ($val == $orderby) { echo "[ ".$val2." ] "; } else { $serie2 = str_replace(" ", "+", $serie); echo "[ ".$val2." ] "; } } $recs = create_recs($result); echo $recs; } include("includes/footer.php"); // Last recs } elseif ($_GET['lastones']) { include("includes/header.php"); $query = "SELECT * FROM slashrecs ORDER BY id DESC LIMIT 20"; $result = mysql_query($query) or die(mysql_errno() . ": " . mysql_error() . "\n"); echo "

Viewing 20 last added recommendations

"; echo "

Order: last ones first

"; $recs = create_recs($result); echo $recs; include("includes/footer.php"); // Search } elseif ($_GET['query']) { include("includes/header.php"); if ($_GET['order']) { $orderby = $_GET['order']; } elseif ($search == "userid") { $orderby = "series"; } else { $orderby = "title"; } $search = $_GET['search']; $query = $_GET['query']; $query2 = "SELECT * FROM slashrecs WHERE $search like '%$query%' ORDER by '$orderby'"; $result = mysql_query($query2) or die(mysql_errno() . ": " . mysql_error() . "\n"); echo "

Search results for ".$search." = ".$query."

\n"; // Si no hay resultados if (!$rows = mysql_num_rows($result)) { echo "

Sorry, no recommendations found.

\n"; // Si hay resultados } else { $order_array = array("title","pairing","author"); echo "

Order: "; while (list($key, $val) = each($order_array)) { $val2 = ucwords($val); if ($val == $orderby) { echo "[ ".$val2." ] "; } else { $serie2 = str_replace(" ", "+", $serie); echo "[ ".$val2." ] "; } } echo "

\n"; $recs = create_recs($result); echo $recs; } include("includes/footer.php"); // Si nada } else { Header("Location: browse.php"); } ?>