1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
2 "http://www.w3.org/TR/html4/strict.dtd">
5 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
6 <meta name="GENERATOR" content="Mozilla/4.61 [en] (Win98; U) [Netscape]">
7 <title>Songbook" Artist</title>
8 <link rel="stylesheet" type="text/css" media="screen" href="/css/Music.css">
9 <link rel="stylesheet" type="text/css" media="print" href="/css/Print.css">
10 <link rel="SHORTCUT ICON" href="http://defaria.com/favicon.ico" type="image/png">
13 include_once "songbook.php";
14 $searchterm = $_REQUEST ["searchterm"];
15 $songmatches = array();
17 function getSongText ($song) {
18 return join ("\n", file ($song));
21 function search ($searchterm) {
25 $tokens = preg_split ("/\s+/", $searchterm);
26 $searchfor = join (".*", $tokens);
28 foreach ($songs as $song) {
29 $text = getSongText ($song);
31 preg_match ("/$searchfor/i", $text, $matches);
34 array_push ($songmatches, $song);
41 $songmatches = search ($searchterm);
48 <a href="/songbook"><img src="/Icons/Home.png" alt="Home"></a>
49 <h1 class="centered">Andrew DeFaria's Songbook</h1>
52 if (count ($songmatches) == 0) {
53 print "No songs matched \"$searchterm\"";
54 } elseif (count ($songmatches) == 1) {
55 print "One song matched \"$searchterm\"";
57 print count ($songmatches) . " songs matched \"$searchterm\"";
65 if (count ($songmatches) > 0) {
69 foreach ($songmatches as $songmatch) {
70 $artist = getArtist ($songmatch);
71 $title = basename ($songmatch, ".pro");
72 print "<li><a href=\"webchord.cgi?chordpro=$songmatch\">$title</a>";
73 print " (<a href=\"displayartist.php?artist=$artist\">$artist</a>)</li>";
76 if (count ($songmatches) > 0) {